@opencode/cli-node 0.0.0-beta-19507 → 0.0.0-dev-19276
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -6
- package/postinstall.mjs +2 -7
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"postinstall": "node ./postinstall.mjs"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.0.0-
|
|
9
|
+
"version": "0.0.0-dev-19276",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"x64"
|
|
23
23
|
],
|
|
24
24
|
"optionalDependencies": {
|
|
25
|
-
"@opencode/cli-node-windows-arm64": "0.0.0-
|
|
26
|
-
"@opencode/cli-node-
|
|
27
|
-
"@opencode/cli-node-
|
|
28
|
-
"@opencode/cli-node-linux-
|
|
29
|
-
"@opencode/cli-node-
|
|
25
|
+
"@opencode/cli-node-windows-arm64": "0.0.0-dev-19276",
|
|
26
|
+
"@opencode/cli-node-darwin-arm64": "0.0.0-dev-19276",
|
|
27
|
+
"@opencode/cli-node-windows-x64": "0.0.0-dev-19276",
|
|
28
|
+
"@opencode/cli-node-linux-x64": "0.0.0-dev-19276",
|
|
29
|
+
"@opencode/cli-node-linux-arm64": "0.0.0-dev-19276"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/postinstall.mjs
CHANGED
|
@@ -12,11 +12,10 @@ const require = createRequire(import.meta.url)
|
|
|
12
12
|
const packageJson = JSON.parse(fs.readFileSync(path.join(directory, "package.json"), "utf8"))
|
|
13
13
|
const command = Object.keys(packageJson.bin ?? {})[0]
|
|
14
14
|
if (!command) throw new Error("OpenCode package does not declare a binary")
|
|
15
|
-
const sourceCommand = packageJson.opencodeSourceBinary ?? command
|
|
16
15
|
|
|
17
16
|
const platform = { darwin: "darwin", linux: "linux", win32: "windows" }[os.platform()] ?? os.platform()
|
|
18
17
|
const arch = { x64: "x64", arm64: "arm64", arm: "arm" }[os.arch()] ?? os.arch()
|
|
19
|
-
const sourceBinary = platform === "windows" ? `${
|
|
18
|
+
const sourceBinary = platform === "windows" ? `${command}.exe` : command
|
|
20
19
|
const targetBinary = path.resolve(directory, packageJson.bin[command])
|
|
21
20
|
const dependencies = packageJson.optionalDependencies ?? {}
|
|
22
21
|
const base = Object.keys(dependencies).find((name) => name.endsWith(`-${platform}-${arch}`))
|
|
@@ -101,11 +100,7 @@ function packageNames() {
|
|
|
101
100
|
function copyBinary(source) {
|
|
102
101
|
if (!fs.existsSync(source)) throw new Error(`Binary not found at ${source}`)
|
|
103
102
|
fs.mkdirSync(path.dirname(targetBinary), { recursive: true })
|
|
104
|
-
if (fs.existsSync(targetBinary))
|
|
105
|
-
try {
|
|
106
|
-
fs.unlinkSync(targetBinary)
|
|
107
|
-
} catch {}
|
|
108
|
-
}
|
|
103
|
+
if (fs.existsSync(targetBinary)) fs.unlinkSync(targetBinary)
|
|
109
104
|
try {
|
|
110
105
|
fs.linkSync(source, targetBinary)
|
|
111
106
|
} catch {
|