From 51bba29fc6181450aec33fa9a10215684640282f Mon Sep 17 00:00:00 2001 From: yujeong-jeon Date: Thu, 5 Mar 2026 17:09:45 +0900 Subject: [PATCH 01/11] feat(@naverpay/commithelper-go): add platform-specific binary packages Add four platform packages that each contain the Go binary for their target OS/CPU combination: - @naverpay/commithelper-go-darwin-arm64 - @naverpay/commithelper-go-darwin-x64 - @naverpay/commithelper-go-linux-x64 - @naverpay/commithelper-go-win32-x64 Each package declares os/cpu fields so pnpm/npm installs only the matching package on each platform. Co-Authored-By: Claude Sonnet 4.6 --- .../commithelper-go-darwin-arm64/.gitignore | 1 + .../commithelper-go-darwin-arm64/package.json | 20 +++++++++++++++++++ .../commithelper-go-darwin-x64/.gitignore | 1 + .../commithelper-go-darwin-x64/package.json | 20 +++++++++++++++++++ packages/commithelper-go-linux-x64/.gitignore | 1 + .../commithelper-go-linux-x64/package.json | 20 +++++++++++++++++++ packages/commithelper-go-win32-x64/.gitignore | 1 + .../commithelper-go-win32-x64/package.json | 20 +++++++++++++++++++ 8 files changed, 84 insertions(+) create mode 100644 packages/commithelper-go-darwin-arm64/.gitignore create mode 100644 packages/commithelper-go-darwin-arm64/package.json create mode 100644 packages/commithelper-go-darwin-x64/.gitignore create mode 100644 packages/commithelper-go-darwin-x64/package.json create mode 100644 packages/commithelper-go-linux-x64/.gitignore create mode 100644 packages/commithelper-go-linux-x64/package.json create mode 100644 packages/commithelper-go-win32-x64/.gitignore create mode 100644 packages/commithelper-go-win32-x64/package.json diff --git a/packages/commithelper-go-darwin-arm64/.gitignore b/packages/commithelper-go-darwin-arm64/.gitignore new file mode 100644 index 0000000..00087c3 --- /dev/null +++ b/packages/commithelper-go-darwin-arm64/.gitignore @@ -0,0 +1 @@ +commithelper-go diff --git a/packages/commithelper-go-darwin-arm64/package.json b/packages/commithelper-go-darwin-arm64/package.json new file mode 100644 index 0000000..b3912de --- /dev/null +++ b/packages/commithelper-go-darwin-arm64/package.json @@ -0,0 +1,20 @@ +{ + "name": "@naverpay/commithelper-go-darwin-arm64", + "version": "1.2.0", + "description": "macOS ARM64 binary for @naverpay/commithelper-go", + "os": [ + "darwin" + ], + "cpu": [ + "arm64" + ], + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/NaverPayDev/cli/tree/main/packages/commithelper-go-darwin-arm64" + }, + "homepage": "https://github.com/NaverPayDev/cli/tree/main/packages/commithelper-go-darwin-arm64", + "files": [ + "commithelper-go" + ] +} diff --git a/packages/commithelper-go-darwin-x64/.gitignore b/packages/commithelper-go-darwin-x64/.gitignore new file mode 100644 index 0000000..00087c3 --- /dev/null +++ b/packages/commithelper-go-darwin-x64/.gitignore @@ -0,0 +1 @@ +commithelper-go diff --git a/packages/commithelper-go-darwin-x64/package.json b/packages/commithelper-go-darwin-x64/package.json new file mode 100644 index 0000000..f769ebf --- /dev/null +++ b/packages/commithelper-go-darwin-x64/package.json @@ -0,0 +1,20 @@ +{ + "name": "@naverpay/commithelper-go-darwin-x64", + "version": "1.2.0", + "description": "macOS x64 binary for @naverpay/commithelper-go", + "os": [ + "darwin" + ], + "cpu": [ + "x64" + ], + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/NaverPayDev/cli/tree/main/packages/commithelper-go-darwin-x64" + }, + "homepage": "https://github.com/NaverPayDev/cli/tree/main/packages/commithelper-go-darwin-x64", + "files": [ + "commithelper-go" + ] +} diff --git a/packages/commithelper-go-linux-x64/.gitignore b/packages/commithelper-go-linux-x64/.gitignore new file mode 100644 index 0000000..00087c3 --- /dev/null +++ b/packages/commithelper-go-linux-x64/.gitignore @@ -0,0 +1 @@ +commithelper-go diff --git a/packages/commithelper-go-linux-x64/package.json b/packages/commithelper-go-linux-x64/package.json new file mode 100644 index 0000000..3671e4a --- /dev/null +++ b/packages/commithelper-go-linux-x64/package.json @@ -0,0 +1,20 @@ +{ + "name": "@naverpay/commithelper-go-linux-x64", + "version": "1.2.0", + "description": "Linux x64 binary for @naverpay/commithelper-go", + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/NaverPayDev/cli/tree/main/packages/commithelper-go-linux-x64" + }, + "homepage": "https://github.com/NaverPayDev/cli/tree/main/packages/commithelper-go-linux-x64", + "files": [ + "commithelper-go" + ] +} diff --git a/packages/commithelper-go-win32-x64/.gitignore b/packages/commithelper-go-win32-x64/.gitignore new file mode 100644 index 0000000..499f9e4 --- /dev/null +++ b/packages/commithelper-go-win32-x64/.gitignore @@ -0,0 +1 @@ +commithelper-go.exe diff --git a/packages/commithelper-go-win32-x64/package.json b/packages/commithelper-go-win32-x64/package.json new file mode 100644 index 0000000..7bacf07 --- /dev/null +++ b/packages/commithelper-go-win32-x64/package.json @@ -0,0 +1,20 @@ +{ + "name": "@naverpay/commithelper-go-win32-x64", + "version": "1.2.0", + "description": "Windows x64 binary for @naverpay/commithelper-go", + "os": [ + "win32" + ], + "cpu": [ + "x64" + ], + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/NaverPayDev/cli/tree/main/packages/commithelper-go-win32-x64" + }, + "homepage": "https://github.com/NaverPayDev/cli/tree/main/packages/commithelper-go-win32-x64", + "files": [ + "commithelper-go.exe" + ] +} From 8a45174ba53db3fb36cebad6e0fe59d949b2d99c Mon Sep 17 00:00:00 2001 From: yujeong-jeon Date: Thu, 5 Mar 2026 17:10:48 +0900 Subject: [PATCH 02/11] feat(@naverpay/commithelper-go): replace postinstall with optionalDependencies pattern - Remove postinstall script (no more curl download at install time) - Add optionalDependencies for each platform binary package - Update build scripts to output binaries into platform package dirs - Update bin/cli.js to resolve binary path via installed platform package - Remove scripts/ from published files Co-Authored-By: Claude Sonnet 4.6 --- packages/commithelper-go/bin/cli.js | 25 +++++++++++++++++-------- packages/commithelper-go/package.json | 20 ++++++++++++-------- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/packages/commithelper-go/bin/cli.js b/packages/commithelper-go/bin/cli.js index 3f2e985..745bcb2 100644 --- a/packages/commithelper-go/bin/cli.js +++ b/packages/commithelper-go/bin/cli.js @@ -3,23 +3,32 @@ const {spawnSync} = require('child_process') const {platform, arch} = require('os') const path = require('path') -const binaries = { - 'darwin-x64': 'commithelper-go-darwin-amd64', - 'darwin-arm64': 'commithelper-go-darwin-arm64', - 'linux-x64': 'commithelper-go-linux-amd64', - 'win32-x64': 'commithelper-go-windows-amd64.exe', +const pkgMap = { + 'darwin-x64': '@naverpay/commithelper-go-darwin-x64', + 'darwin-arm64': '@naverpay/commithelper-go-darwin-arm64', + 'linux-x64': '@naverpay/commithelper-go-linux-x64', + 'win32-x64': '@naverpay/commithelper-go-win32-x64', } const key = `${platform()}-${arch()}` -const binaryName = binaries[key] +const pkgName = pkgMap[key] -if (!binaryName) { +if (!pkgName) { // eslint-disable-next-line no-console console.error(`Unsupported platform: ${platform()} ${arch()}`) process.exit(1) } -const binaryPath = path.join(__dirname, binaryName) +let binaryPath +try { + const pkgDir = path.dirname(require.resolve(`${pkgName}/package.json`)) + const binaryName = platform() === 'win32' ? 'commithelper-go.exe' : 'commithelper-go' + binaryPath = path.join(pkgDir, binaryName) +} catch (e) { + // eslint-disable-next-line no-console + console.error(`Platform package ${pkgName} is not installed. Please reinstall @naverpay/commithelper-go.`) + process.exit(1) +} const args = process.argv.slice(2) const result = spawnSync(binaryPath, args, {stdio: 'inherit'}) diff --git a/packages/commithelper-go/package.json b/packages/commithelper-go/package.json index 5132690..d1f297e 100644 --- a/packages/commithelper-go/package.json +++ b/packages/commithelper-go/package.json @@ -11,17 +11,21 @@ }, "homepage": "https://github.com/NaverPayDev/cli/tree/main/packages/commithelper-go", "scripts": { - "build:windows": "GOOS=windows GOARCH=amd64 go build -o dist/commithelper-go-windows-amd64.exe main.go", - "build:macos:amd64": "GOOS=darwin GOARCH=amd64 go build -o dist/commithelper-go-darwin-amd64 main.go", - "build:macos:arm64": "GOOS=darwin GOARCH=arm64 go build -o dist/commithelper-go-darwin-arm64 main.go", - "build:linux": "GOOS=linux GOARCH=amd64 go build -o dist/commithelper-go-linux-amd64 main.go", - "build": "pnpm build:windows && pnpm build:macos:amd64 && pnpm build:macos:arm64 && pnpm build:linux", - "postinstall": "node ./scripts/downloadBinary.js" + "build:windows": "GOOS=windows GOARCH=amd64 go build -o ../commithelper-go-win32-x64/commithelper-go.exe main.go", + "build:macos:amd64": "GOOS=darwin GOARCH=amd64 go build -o ../commithelper-go-darwin-x64/commithelper-go main.go", + "build:macos:arm64": "GOOS=darwin GOARCH=arm64 go build -o ../commithelper-go-darwin-arm64/commithelper-go main.go", + "build:linux": "GOOS=linux GOARCH=amd64 go build -o ../commithelper-go-linux-x64/commithelper-go main.go", + "build": "pnpm build:windows && pnpm build:macos:amd64 && pnpm build:macos:arm64 && pnpm build:linux" + }, + "optionalDependencies": { + "@naverpay/commithelper-go-darwin-arm64": "workspace:*", + "@naverpay/commithelper-go-darwin-x64": "workspace:*", + "@naverpay/commithelper-go-linux-x64": "workspace:*", + "@naverpay/commithelper-go-win32-x64": "workspace:*" }, "author": "", "license": "MIT", "files": [ - "bin", - "scripts" + "bin" ] } From aceb3d38cc2b4477db22c20b855cfcb8584686cd Mon Sep 17 00:00:00 2001 From: yujeong-jeon Date: Thu, 5 Mar 2026 17:11:01 +0900 Subject: [PATCH 03/11] chore(changeset): group all commithelper-go packages as fixed versioning Ensures @naverpay/commithelper-go and all platform binary packages always receive the same version bump together. Co-Authored-By: Claude Sonnet 4.6 --- .changeset/config.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.changeset/config.json b/.changeset/config.json index 97887d6..eb1bc58 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -2,7 +2,15 @@ "$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json", "changelog": "@changesets/cli/changelog", "commit": false, - "fixed": [], + "fixed": [ + [ + "@naverpay/commithelper-go", + "@naverpay/commithelper-go-darwin-arm64", + "@naverpay/commithelper-go-darwin-x64", + "@naverpay/commithelper-go-linux-x64", + "@naverpay/commithelper-go-win32-x64" + ] + ], "linked": [], "access": "public", "baseBranch": "main", From f7be6578f7e6faa4e9bef1a12debf893c9c63e72 Mon Sep 17 00:00:00 2001 From: yujeong-jeon Date: Thu, 5 Mar 2026 17:11:37 +0900 Subject: [PATCH 04/11] ci: remove binary upload workflow and SKIP_COMMIT_HELPER_POSTINSTALL Binaries are now bundled inside platform npm packages, so there is no longer a need to upload assets to GitHub Releases after publish. - Remove release-asset.yaml workflow entirely - Remove upload-assets job and checkCommitHelperGo step from release.yaml - Remove SKIP_COMMIT_HELPER_POSTINSTALL env var from all workflows Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/detect-changed-packages.yml | 1 - .github/workflows/release-asset.yaml | 94 ------------------- .github/workflows/release.yaml | 35 ------- 3 files changed, 130 deletions(-) delete mode 100644 .github/workflows/release-asset.yaml diff --git a/.github/workflows/detect-changed-packages.yml b/.github/workflows/detect-changed-packages.yml index 2515260..ce3a646 100644 --- a/.github/workflows/detect-changed-packages.yml +++ b/.github/workflows/detect-changed-packages.yml @@ -14,7 +14,6 @@ jobs: runs-on: ubuntu-latest env: GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }} - SKIP_COMMIT_HELPER_POSTINSTALL: 1 steps: - name: Checkout Repo uses: actions/checkout@v3 diff --git a/.github/workflows/release-asset.yaml b/.github/workflows/release-asset.yaml deleted file mode 100644 index a7d8e67..0000000 --- a/.github/workflows/release-asset.yaml +++ /dev/null @@ -1,94 +0,0 @@ -name: 'upload asset' -description: 'Upload asset for go packages' - -on: - workflow_dispatch: - inputs: - package: - description: 'Package to upload asset' - required: true - default: '@naverpay/commithelper-go' - version: - description: 'Which version to upload asset' - required: true - workflow_call: - inputs: - package: - description: 'Package to upload asset' - required: true - type: string - version: - description: 'Which version to upload asset' - required: true - type: string - -permissions: - contents: write # to create release - -jobs: - release-asset: - runs-on: ubuntu-latest - env: - SKIP_COMMIT_HELPER_POSTINSTALL: 1 - GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - name: checkoutRepo - uses: actions/checkout@v3 - with: - token: ${{ secrets.ACTION_TOKEN }} - fetch-depth: 0 - - - name: setupGo - uses: actions/setup-go@v4 - with: - go-version: '1.24' - - - name: useNodeJs - uses: actions/setup-node@v4 - with: - node-version: '20.x' - - - name: installCorepack - run: npm install -g corepack@0.31.0 - - - name: enableCorepack - run: corepack enable - - - name: installDependencies - run: pnpm install --frozen-lockfile - - - name: buildNodePackages - run: pnpm build - - - name: buildCrossPlatformBinaries - run: | - cd packages/commithelper-go - mkdir -p dist - # Build for Windows - GOOS=windows GOARCH=amd64 go build -o dist/commithelper-go-windows-amd64.exe main.go - # Build for macOS AMD64 - GOOS=darwin GOARCH=amd64 go build -o dist/commithelper-go-darwin-amd64 main.go - # Build for macOS ARM64 - GOOS=darwin GOARCH=arm64 go build -o dist/commithelper-go-darwin-arm64 main.go - # Build for Linux AMD64 - GOOS=linux GOARCH=amd64 go build -o dist/commithelper-go-linux-amd64 main.go - - - name: Upload release assets - run: | - packageName="${{ inputs.package }}" - packageVersion="${{ inputs.version }}" - releaseTag="$packageName@$packageVersion" - - echo "🔍 Uploading assets for release: $releaseTag" - - gh release upload "$releaseTag" \ - packages/commithelper-go/dist/commithelper-go-windows-amd64.exe \ - packages/commithelper-go/dist/commithelper-go-darwin-amd64 \ - packages/commithelper-go/dist/commithelper-go-darwin-arm64 \ - packages/commithelper-go/dist/commithelper-go-linux-amd64 \ - --clobber - - echo "✅ All assets uploaded successfully!" - env: - GH_TOKEN: ${{ secrets.ACTION_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 6043514..4ec1cf2 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -37,10 +37,7 @@ jobs: (github.event_name == 'issue_comment' && needs.get-branch.result == 'success')) outputs: published: ${{ steps.publish_release.outputs.published || steps.publish_canary.outputs.published || steps.publish_rc.outputs.published }} - commithelperGoWillBePublished: ${{ steps.checkCommitHelperGo.outputs.commithelperGoWillBePublished }} - packageVersion: ${{ steps.checkCommitHelperGo.outputs.publishedVersion }} env: - SKIP_COMMIT_HELPER_POSTINSTALL: 1 GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: @@ -121,35 +118,3 @@ jobs: create_release: true env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Check if commithelper-go was published - id: checkCommitHelperGo - if: always() - run: | - echo "publish_release publishedPackages: '${{ steps.publish_release.outputs.publishedPackages }}'" - echo "publish_canary publishedPackages: '${{ steps.publish_canary.outputs.publishedPackages }}'" - echo "publish_rc publishedPackages: '${{ steps.publish_rc.outputs.publishedPackages }}'" - publishedPackages='${{ steps.publish_release.outputs.publishedPackages || steps.publish_canary.outputs.publishedPackages || steps.publish_rc.outputs.publishedPackages }}' - echo "resolved publishedPackages: '$publishedPackages'" - if [ -z "$publishedPackages" ] || [ "$publishedPackages" == "null" ]; then - echo "commithelperGoWillBePublished=false" >> $GITHUB_OUTPUT - else - commithelperGo=$(echo "$publishedPackages" | jq -r '.[] | select(.name == "@naverpay/commithelper-go")') - if [ -n "$commithelperGo" ] && [ "$commithelperGo" != "null" ]; then - echo "commithelperGoWillBePublished=true" >> $GITHUB_OUTPUT - # Extract the actual published version (handles canary/RC versions) - version=$(echo "$commithelperGo" | jq -r '.version') - echo "publishedVersion=$version" >> $GITHUB_OUTPUT - else - echo "commithelperGoWillBePublished=false" >> $GITHUB_OUTPUT - fi - fi - - upload-assets: - needs: release - if: always() && needs.release.outputs.published == 'true' && needs.release.outputs.commithelperGoWillBePublished == 'true' - uses: ./.github/workflows/release-asset.yaml - with: - package: '@naverpay/commithelper-go' - version: ${{ needs.release.outputs.packageVersion }} - secrets: inherit From 72a0a501ce7f2d31829da863795466b241d677a7 Mon Sep 17 00:00:00 2001 From: yujeong-jeon Date: Thu, 5 Mar 2026 17:17:07 +0900 Subject: [PATCH 05/11] chore: add changeset for platform binary packages split Co-Authored-By: Claude Sonnet 4.6 --- .changeset/platform-binary-packages.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .changeset/platform-binary-packages.md diff --git a/.changeset/platform-binary-packages.md b/.changeset/platform-binary-packages.md new file mode 100644 index 0000000..5bd1d6c --- /dev/null +++ b/.changeset/platform-binary-packages.md @@ -0,0 +1,17 @@ +--- +"@naverpay/commithelper-go": minor +"@naverpay/commithelper-go-darwin-arm64": minor +"@naverpay/commithelper-go-darwin-x64": minor +"@naverpay/commithelper-go-linux-x64": minor +"@naverpay/commithelper-go-win32-x64": minor +--- + +Split Go binaries into platform-specific npm packages + +Each platform now has a dedicated package (`@naverpay/commithelper-go-darwin-arm64`, `-darwin-x64`, `-linux-x64`, `-win32-x64`) declared as `optionalDependencies`. pnpm/npm automatically installs only the package matching the current OS and CPU. + +This removes the `postinstall` script that previously downloaded binaries via `curl` from GitHub Releases, which means: + +- No more `onlyBuiltDependencies` registration required in consuming projects +- No more `--ignore-scripts` needed in CI +- Works in Nexus environments (binaries are bundled in the npm package, no external download) From 2a6426a3079b29d8a8827e4c4ee6e64ef0621ab5 Mon Sep 17 00:00:00 2001 From: yujeong-jeon Date: Thu, 5 Mar 2026 17:23:40 +0900 Subject: [PATCH 06/11] fix: add optionalDependencies for commithelper-go packages --- pnpm-lock.yaml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ac51ade..a014f56 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -67,7 +67,28 @@ importers: specifier: ^5.2.2 version: 5.3.3 - packages/commithelper-go: {} + packages/commithelper-go: + optionalDependencies: + '@naverpay/commithelper-go-darwin-arm64': + specifier: workspace:* + version: link:../commithelper-go-darwin-arm64 + '@naverpay/commithelper-go-darwin-x64': + specifier: workspace:* + version: link:../commithelper-go-darwin-x64 + '@naverpay/commithelper-go-linux-x64': + specifier: workspace:* + version: link:../commithelper-go-linux-x64 + '@naverpay/commithelper-go-win32-x64': + specifier: workspace:* + version: link:../commithelper-go-win32-x64 + + packages/commithelper-go-darwin-arm64: {} + + packages/commithelper-go-darwin-x64: {} + + packages/commithelper-go-linux-x64: {} + + packages/commithelper-go-win32-x64: {} packages/fmb: dependencies: From 1977ba542d0ecc1fd32ae03c5d290caa3586849d Mon Sep 17 00:00:00 2001 From: yujeong-jeon Date: Thu, 5 Mar 2026 22:22:30 +0900 Subject: [PATCH 07/11] chore: remove unused size-limit configuration and update dependencies --- .size-limit.js | 18 ------------------ package.json | 3 +-- pnpm-lock.yaml | 33 +++------------------------------ 3 files changed, 4 insertions(+), 50 deletions(-) delete mode 100644 .size-limit.js diff --git a/.size-limit.js b/.size-limit.js deleted file mode 100644 index f432526..0000000 --- a/.size-limit.js +++ /dev/null @@ -1,18 +0,0 @@ -const path = require('path') -const glob = require('glob') -const fs = require('fs') - -const packageJsonList = glob - .globSync('**/package.json', { - cwd: path.join(process.cwd(), 'packages'), - }) - .map((filePath) => { - const {name, main} = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'packages', filePath), 'utf8')) - const packageName = name.split('/')[1] - return { - name: packageName, - path: `packages/${packageName}${main.slice(1)}`, - } - }) - -module.exports = packageJsonList diff --git a/package.json b/package.json index dcc08ad..bf96107 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "name": "@naverpay/cli", + "private": true, "author": "@NaverPayDev/frontend", "repository": { "type": "git", @@ -36,10 +37,8 @@ "@naverpay/prettier-config": "^0.0.2", "@size-limit/preset-big-lib": "^11.0.2", "@types/node": "^20.12.7", - "glob": "^9.3.4", "husky": "^8.0.3", "lint-staged": "^15.0.1", - "size-limit": "^11.0.2", "turbo": "^1.10.16", "typescript": "^5.2.2" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a014f56..312931f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -26,18 +26,12 @@ importers: '@types/node': specifier: ^20.12.7 version: 20.12.7 - glob: - specifier: ^9.3.4 - version: 9.3.5 husky: specifier: ^8.0.3 version: 8.0.3 lint-staged: specifier: ^15.0.1 version: 15.2.2 - size-limit: - specifier: ^11.0.2 - version: 11.0.2 turbo: specifier: ^1.10.16 version: 1.12.4 @@ -469,7 +463,7 @@ packages: '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.24.4 - '@babel/helper-plugin-utils': 7.24.0 + '@babel/helper-plugin-utils': 7.25.9 dev: true /@babel/plugin-syntax-logical-assignment-operators@7.10.4(@babel/core@7.24.4): @@ -4530,6 +4524,7 @@ packages: /glob@10.3.10: resolution: {integrity: sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==} engines: {node: '>=16 || 14 >=14.17'} + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me hasBin: true dependencies: foreground-child: 3.1.1 @@ -4541,7 +4536,7 @@ packages: /glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} - deprecated: Glob versions prior to v9 are no longer supported + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me dependencies: fs.realpath: 1.0.0 inflight: 1.0.6 @@ -4551,16 +4546,6 @@ packages: path-is-absolute: 1.0.1 dev: true - /glob@9.3.5: - resolution: {integrity: sha512-e1LleDykUz2Iu+MTYdkSsuWX8lvAjAcs0Xef0lNIu0S2wOAzuTxCJtcd9S3cijlwYF18EsU3rzb8jPVobxDh9Q==} - engines: {node: '>=16 || 14 >=14.17'} - dependencies: - fs.realpath: 1.0.0 - minimatch: 8.0.4 - minipass: 4.2.8 - path-scurry: 1.10.1 - dev: true - /globals@11.12.0: resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} engines: {node: '>=4'} @@ -6035,13 +6020,6 @@ packages: brace-expansion: 1.1.11 dev: true - /minimatch@8.0.4: - resolution: {integrity: sha512-W0Wvr9HyFXZRGIDgCicunpQ299OKXs9RgZfaukz4qAW/pJhcpUfupc9c+OObPOFueNy8VSrZgEmDtk6Kh4WzDA==} - engines: {node: '>=16 || 14 >=14.17'} - dependencies: - brace-expansion: 2.0.1 - dev: true - /minimatch@9.0.3: resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} engines: {node: '>=16 || 14 >=14.17'} @@ -6069,11 +6047,6 @@ packages: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} dev: true - /minipass@4.2.8: - resolution: {integrity: sha512-fNzuVyifolSLFL4NzpF+wEF4qrgqaaKX0haXPQEdQ7NKAN+WecoKMHV09YcuL/DHxrUsYQOK3MiuDf7Ip2OXfQ==} - engines: {node: '>=8'} - dev: true - /minipass@7.0.4: resolution: {integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==} engines: {node: '>=16 || 14 >=14.17'} From c2fd4d365ba32ff7c0a87bcdf682cd7ad6b2f807 Mon Sep 17 00:00:00 2001 From: yujeong-jeon Date: Thu, 5 Mar 2026 22:57:30 +0900 Subject: [PATCH 08/11] fix: ensure binary has execute permission before spawning npm publish does not preserve file permissions, so the Go binary may be installed without execute permission. chmod +x before spawn. Co-Authored-By: Claude Opus 4.6 --- packages/commithelper-go/bin/cli.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/commithelper-go/bin/cli.js b/packages/commithelper-go/bin/cli.js index 745bcb2..f03588d 100644 --- a/packages/commithelper-go/bin/cli.js +++ b/packages/commithelper-go/bin/cli.js @@ -1,5 +1,6 @@ #!/usr/bin/env node const {spawnSync} = require('child_process') +const fs = require('fs') const {platform, arch} = require('os') const path = require('path') @@ -24,6 +25,9 @@ try { const pkgDir = path.dirname(require.resolve(`${pkgName}/package.json`)) const binaryName = platform() === 'win32' ? 'commithelper-go.exe' : 'commithelper-go' binaryPath = path.join(pkgDir, binaryName) + try { + fs.chmodSync(binaryPath, 0o755) + } catch (_) {} } catch (e) { // eslint-disable-next-line no-console console.error(`Platform package ${pkgName} is not installed. Please reinstall @naverpay/commithelper-go.`) From f2b3132886cab75f687f7cfd407edff60fcbfb29 Mon Sep 17 00:00:00 2001 From: yujeong-jeon Date: Thu, 5 Mar 2026 23:22:29 +0900 Subject: [PATCH 09/11] ci: add cross-platform test workflow for commithelper-go Tests binary build and CLI execution on Linux, macOS, and Windows via GitHub Actions matrix strategy. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/test-commithelper-go.yaml | 72 +++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/test-commithelper-go.yaml diff --git a/.github/workflows/test-commithelper-go.yaml b/.github/workflows/test-commithelper-go.yaml new file mode 100644 index 0000000..1a25f18 --- /dev/null +++ b/.github/workflows/test-commithelper-go.yaml @@ -0,0 +1,72 @@ +name: test commithelper-go + +on: + pull_request: + paths: + - 'packages/commithelper-go/**' + - 'packages/commithelper-go-*/**' + +jobs: + test: + strategy: + matrix: + include: + - os: ubuntu-latest + goos: linux + goarch: amd64 + binary: commithelper-go + pkg: commithelper-go-linux-x64 + - os: macos-latest + goos: darwin + goarch: arm64 + binary: commithelper-go + pkg: commithelper-go-darwin-arm64 + - os: windows-latest + goos: windows + goarch: amd64 + binary: commithelper-go.exe + pkg: commithelper-go-win32-x64 + + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: '1.24' + + - uses: pnpm/action-setup@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build binary + working-directory: packages/commithelper-go + run: go build -o ../commithelper-go-${{ matrix.goos }}-test/${{ matrix.binary }} main.go + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + + - name: Copy binary to platform package + shell: bash + run: cp packages/commithelper-go-${{ matrix.goos }}-test/${{ matrix.binary }} packages/${{ matrix.pkg }}/${{ matrix.binary }} + + - name: Verify binary exists + shell: bash + run: ls -la packages/${{ matrix.pkg }}/${{ matrix.binary }} + + - name: Test CLI execution + shell: bash + run: | + chmod +x packages/${{ matrix.pkg }}/${{ matrix.binary }} + echo "test commit message" > /tmp/test-msg.txt + node packages/commithelper-go/bin/cli.js /tmp/test-msg.txt + echo "CLI executed successfully with exit code $?" From 12c115a5fc41ff2f05f1a92a041ffe65926d685a Mon Sep 17 00:00:00 2001 From: yujeong-jeon Date: Thu, 5 Mar 2026 23:34:43 +0900 Subject: [PATCH 10/11] chore: remove downloadBinary.js script from commithelper-go --- .../commithelper-go/scripts/downloadBinary.js | 75 ------------------- 1 file changed, 75 deletions(-) delete mode 100644 packages/commithelper-go/scripts/downloadBinary.js diff --git a/packages/commithelper-go/scripts/downloadBinary.js b/packages/commithelper-go/scripts/downloadBinary.js deleted file mode 100644 index bac749f..0000000 --- a/packages/commithelper-go/scripts/downloadBinary.js +++ /dev/null @@ -1,75 +0,0 @@ -/* eslint-disable no-console */ -const {execSync} = require('child_process') -const {existsSync, mkdirSync, readFileSync} = require('fs') -const {platform, arch} = require('os') -const {join} = require('path') - -if (process.env.SKIP_COMMIT_HELPER_POSTINSTALL) { - console.log('Skipping postinstall script as SKIP_COMMIT_HELPER_POSTINSTALL is set.') - process.exit(0) -} - -console.log('Starting postinstall script: downloadBinary.js') - -// Define the mapping of platform and architecture to the corresponding binary file names -const binaries = { - 'darwin-x64': 'commithelper-go-darwin-amd64', - 'darwin-arm64': 'commithelper-go-darwin-arm64', - 'linux-x64': 'commithelper-go-linux-amd64', - 'win32-x64': 'commithelper-go-windows-amd64.exe', -} - -// Determine the current platform and architecture -const key = `${platform()}-${arch()}` -const binary = binaries[key] - -console.log(`Detected platform: ${platform()}, architecture: ${arch()}`) -console.log(`Selected binary: ${binary}`) - -// If the platform or architecture is not supported, exit with an error -if (!binary) { - console.error(`Unsupported platform: ${platform()} ${arch()}`) - process.exit(1) -} - -// Read the version from the package.json file -const packageJsonPath = join(__dirname, '../package.json') -const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8')) -const version = packageJson.version - -// Construct the URL to download the binary from the GitHub releases -const url = `https://github.com/NaverPayDev/cli/releases/download/@naverpay/commithelper-go@${version}/${binary}` -console.log(`Constructed URL: ${url}`) - -// Define the directory where the binary will be saved -const binDir = join(__dirname, '../bin') - -// Create the bin directory if it does not exist -if (!existsSync(binDir)) { - mkdirSync(binDir) - console.log(`Created bin directory: ${binDir}`) -} - -// Define the full path where the binary will be saved -const outputPath = join(binDir, binary) -console.log(`Binary will be saved to: ${outputPath}`) - -// Download the binary using curl and make it executable -try { - execSync(`curl -L ${url} -o ${outputPath}`, {stdio: 'inherit'}) - console.log(`Binary successfully downloaded to: ${outputPath}`) -} catch (error) { - console.error(`Failed to download binary: ${error.message}`) - process.exit(1) -} - -// Add execution permission to the binary -try { - execSync(`chmod +x ${outputPath}`, {stdio: 'inherit'}) - console.log(`Execution permission added to binary: ${outputPath}`) -} catch (error) { - console.error(`Failed to set execution permission: ${error.message}`) - process.exit(1) -} - -console.log('Postinstall script completed successfully.') From 980fbc588de0af5f09bc6a57ce73c8dcca88d301 Mon Sep 17 00:00:00 2001 From: yujeong-jeon Date: Thu, 5 Mar 2026 23:50:33 +0900 Subject: [PATCH 11/11] docs: add performance tip and update platform support in README Co-Authored-By: Claude Opus 4.6 --- packages/commithelper-go/README.md | 36 +++++++++--------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/packages/commithelper-go/README.md b/packages/commithelper-go/README.md index 76f636d..b26b384 100644 --- a/packages/commithelper-go/README.md +++ b/packages/commithelper-go/README.md @@ -28,7 +28,7 @@ npm install -g @naverpay/commithelper-go ### .husky/commit-msg ```bash -npx --yes @naverpay/commithelper-go@latest "$1" +node node_modules/@naverpay/commithelper-go/bin/cli.js "$1" ``` > `@latest` is not necessary but this option always provides latest version of commithelper-go. @@ -39,14 +39,14 @@ npx --yes @naverpay/commithelper-go@latest "$1" commit-msg: commands: commithelper: - run: npx --yes @naverpay/commithelper-go@latest {1} + run: node node_modules/@naverpay/commithelper-go/bin/cli.js {1} ``` -### Manual execution - -```bash -npx @naverpay/commithelper-go "your commit message" -``` +> [!TIP] +> +> `npx` adds ~460ms of overhead even when the package is installed locally. +> Calling `node cli.js` directly takes ~76ms — **about 6x faster** than `npx`. +> For hooks that run on every commit, direct `node` invocation is recommended. ## What it does @@ -125,7 +125,7 @@ This is Basic rule of `.commithelperrc.json`. "rules": { "feature": null }, - "template": "{{.Message}}\n\nRef. #{{.Number}}" + "template": "{{.Message}}\n\nRef. [#{{.Number}}]" } ``` @@ -134,7 +134,7 @@ Result: ``` :memo: Update documentation -Ref. #123 +Ref. [#123] ``` **Example 2: Custom format with repository** @@ -192,25 +192,9 @@ Result: > - commit on `qa/1` branch will be tagged as `[your-org/your-repo#1]`. > - direct commit attempt toward `main`, `master`, `develop`, `epic/*` branch will be blocked -## Environment Variables - -### SKIP_COMMIT_HELPER_POSTINSTALL - -You can skip the postinstall script (binary download) by setting the `SKIP_COMMIT_HELPER_POSTINSTALL` environment variable: - -```bash -SKIP_COMMIT_HELPER_POSTINSTALL=1 npm install @naverpay/commithelper-go -``` - -This is useful in environments where: - -- Network access is restricted -- You want to manage binary installation manually -- Running in CI/CD environments where postinstall scripts should be skipped - ## Platform Support -The CLI automatically downloads the appropriate binary for your platform during installation: +The appropriate platform-specific binary package is automatically installed via `optionalDependencies`. - **macOS**: Intel (x64) and Apple Silicon (arm64) - **Linux**: x64