bincode-dev 0.0.17 → 0.0.19
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/bin/bincode +1 -0
- package/package.json +6 -5
- package/scripts/postinstall.js +46 -0
package/bin/bincode
CHANGED
|
@@ -86,6 +86,7 @@ try {
|
|
|
86
86
|
`Missing optional dependency: ${targetPkg}`,
|
|
87
87
|
``,
|
|
88
88
|
`This usually happens if you installed with --no-optional (or your package manager skipped optional deps).`,
|
|
89
|
+
`Also check that install scripts are not disabled (npm config ignore-scripts).`,
|
|
89
90
|
`Reinstall without skipping optional dependencies, e.g.:`,
|
|
90
91
|
` npm i bincode-dev`,
|
|
91
92
|
``,
|
package/package.json
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bincode-dev",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"description": "Bincode: AI-powered development CLI (dev/test version, not affiliated with opencode)",
|
|
5
5
|
"bin": {
|
|
6
6
|
"bincode": "./bin/bincode"
|
|
7
7
|
},
|
|
8
8
|
"optionalDependencies": {
|
|
9
|
-
"bincode-dev-darwin-arm64": "0.0.
|
|
10
|
-
"bincode-dev-darwin-x64": "0.0.
|
|
11
|
-
"bincode-dev-linux-x64": "0.0.
|
|
12
|
-
"bincode-dev-windows-x64": "0.0.
|
|
9
|
+
"bincode-dev-darwin-arm64": "0.0.19",
|
|
10
|
+
"bincode-dev-darwin-x64": "0.0.19",
|
|
11
|
+
"bincode-dev-linux-x64": "0.0.19",
|
|
12
|
+
"bincode-dev-windows-x64": "0.0.19"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "bun script/build.ts",
|
|
16
16
|
"prepack": "node scripts/prepack.js",
|
|
17
|
+
"postinstall": "node scripts/postinstall.js",
|
|
17
18
|
"prepare:platform-packages": "node scripts/prepare-platform-packages.js"
|
|
18
19
|
},
|
|
19
20
|
"license": "MIT",
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-heal install: ensure the correct platform binary package exists.
|
|
3
|
+
*
|
|
4
|
+
* Some npm setups (especially global installs) may skip optionalDependencies.
|
|
5
|
+
* We still want `npm i(-g) bincode-dev` to work without manual platform installs.
|
|
6
|
+
*/
|
|
7
|
+
const childProcess = require("child_process")
|
|
8
|
+
const fs = require("fs")
|
|
9
|
+
const path = require("path")
|
|
10
|
+
const os = require("os")
|
|
11
|
+
|
|
12
|
+
const root = path.join(__dirname, "..")
|
|
13
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"))
|
|
14
|
+
const version = pkg.version
|
|
15
|
+
|
|
16
|
+
const platform = os.platform()
|
|
17
|
+
const arch = os.arch()
|
|
18
|
+
|
|
19
|
+
const targetPkgMap = {
|
|
20
|
+
"darwin:arm64": "bincode-dev-darwin-arm64",
|
|
21
|
+
"darwin:x64": "bincode-dev-darwin-x64",
|
|
22
|
+
"linux:x64": "bincode-dev-linux-x64",
|
|
23
|
+
"win32:x64": "bincode-dev-windows-x64",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const targetPkg = targetPkgMap[`${platform}:${arch}`]
|
|
27
|
+
if (!targetPkg || !version) process.exit(0)
|
|
28
|
+
|
|
29
|
+
function isInstalled() {
|
|
30
|
+
try {
|
|
31
|
+
require.resolve(`${targetPkg}/package.json`, { paths: [root] })
|
|
32
|
+
return true
|
|
33
|
+
} catch {
|
|
34
|
+
return false
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (isInstalled()) process.exit(0)
|
|
39
|
+
|
|
40
|
+
const npmCmd = process.platform === "win32" ? "npm.cmd" : "npm"
|
|
41
|
+
const args = ["install", "--no-save", "--no-audit", "--no-fund", `${targetPkg}@${version}`]
|
|
42
|
+
|
|
43
|
+
// Install into bincode-dev's own node_modules so `require.resolve()` works reliably.
|
|
44
|
+
childProcess.spawnSync(npmCmd, args, { cwd: root, stdio: "inherit", env: process.env })
|
|
45
|
+
|
|
46
|
+
|