Skip to content

Commit a82d0e8

Browse files
committed
Modify downloadBinary.js to update binary download URL format
1 parent 9967fbe commit a82d0e8

File tree

8 files changed

+30
-5
lines changed

8 files changed

+30
-5
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env node
2+
const {spawnSync} = require('child_process')
3+
const {platform, arch} = require('os')
4+
const path = require('path')
5+
6+
const binaries = {
7+
'darwin-x64': 'commithelper-go-darwin-amd64',
8+
'darwin-arm64': 'commithelper-go-darwin-arm64',
9+
'linux-x64': 'commithelper-go-linux-amd64',
10+
'win32-x64': 'commithelper-go-windows-amd64.exe',
11+
}
12+
13+
const key = `${platform()}-${arch()}`
14+
const binaryName = binaries[key]
15+
16+
if (!binaryName) {
17+
// eslint-disable-next-line no-console
18+
console.error(`Unsupported platform: ${platform()} ${arch()}`)
19+
process.exit(1)
20+
}
21+
22+
const binaryPath = path.join(__dirname, binaryName)
23+
24+
const args = process.argv.slice(2)
25+
const result = spawnSync(binaryPath, args, {stdio: 'inherit'})
26+
27+
process.exit(result.status)
-3.29 MB
Binary file not shown.
-3.36 MB
Binary file not shown.

packages/commithelper-go/bin/commithelper-go-darwin-arm64

Lines changed: 0 additions & 1 deletion
This file was deleted.
-3.44 MB
Binary file not shown.
-3.53 MB
Binary file not shown.

packages/commithelper-go/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
"version": "0.0.0",
44
"description": "A CLI tool to assist with commit messages based on branch names and configuration.",
55
"bin": {
6-
"commithelper-go": "bin/commithelper-go"
6+
"commithelper-go": "bin/cli.js"
77
},
88
"scripts": {
9-
"build:default": "go build -o bin/commithelper-go main.go",
109
"build:windows": "GOOS=windows GOARCH=amd64 go build -o bin/commithelper-go-windows-amd64.exe main.go",
1110
"build:macos:amd64": "GOOS=darwin GOARCH=amd64 go build -o bin/commithelper-go-darwin-amd64 main.go",
1211
"build:macos:arm64": "GOOS=darwin GOARCH=arm64 go build -o bin/commithelper-go-darwin-arm64 main.go",
1312
"build:linux": "GOOS=linux GOARCH=amd64 go build -o bin/commithelper-go-linux-amd64 main.go",
14-
"build": "pnpm build:default && pnpm build:windows && pnpm build:macos:amd64 && pnpm build:macos:arm64 && pnpm build:linux",
13+
"build": "pnpm build:windows && pnpm build:macos:amd64 && pnpm build:macos:arm64 && pnpm build:linux",
1514
"postinstall": "node ./scripts/downloadBinary.js"
1615
},
1716
"author": "",

packages/commithelper-go/scripts/downloadBinary.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'))
3333
const version = packageJson.version
3434

3535
// Construct the URL to download the binary from the GitHub releases
36-
const url = `https://github.com/NaverPayDev/cli/releases/download/v${version}/${binary}`
36+
const url = `https://github.com/NaverPayDev/cli/releases/download/@naverpay/commithelper-go@${version}/${binary}`
3737
console.log(`Constructed URL: ${url}`)
3838

3939
// Define the directory where the binary will be saved

0 commit comments

Comments
 (0)