Skip to content

Commit 77f762d

Browse files
committed
fix: rename build script so opencode can git-install the plugin
opencode's plugin installer can't prepare a git dependency whose package.json declares build/prepare/preinstall/install/postinstall/prepack (or workspaces): pacote runs npm install through opencode's bundled npm-cli.js, which a compiled binary can't execute, so install fails with NpmInstallFailedError: git dep preparation failed (anomalyco/opencode#49704). dist/ is committed, so rename the script to 'compile'.
1 parent bb3dded commit 77f762d

5 files changed

Lines changed: 18 additions & 7 deletions

File tree

‎.github/pull_request_template.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ What does this PR change and why?
44

55
## How verified
66

7-
- [ ] `npm run build` passes
7+
- [ ] `npm run compile` passes
88
- [ ] `npm test` passes (Node 20/22/24 via CI)
99
- [ ] Added/updated tests for the change
1010

‎.github/workflows/ci.yml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,8 @@ jobs:
2323
node-version: ${{ matrix.node }}
2424
cache: npm
2525
- run: npm ci
26-
- run: npm run build
26+
# "compile", not "build": a git-installed plugin that declares a
27+
# build/prepare/install script can't be prepared by opencode's bundled
28+
# npm (see anomalyco/opencode#49704). Keep the script renamed.
29+
- run: npm run compile
2730
- run: npm test

‎CONTRIBUTING.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ and tests are all welcome.
77

88
```bash
99
npm ci
10-
npm run build
10+
npm run compile
1111
npm test
1212
```
1313

14+
The build script is named `compile` so opencode can git-install this plugin
15+
(see anomalyco/opencode#49704).
16+
1417
CI repeats the same gate on Node 20, 22, and 24.
1518

1619
## Pull requests

‎README.md‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,15 @@ see [NOTICE](NOTICE).
5252

5353
```sh
5454
npm install
55-
npm run build
55+
npm run compile
5656
npm test
5757
```
5858

59+
The build script is named `compile` (not `build`) on purpose: opencode's
60+
plugin installer cannot prepare a git dependency that declares a
61+
`build`/`prepare`/`install` script (anomalyco/opencode#49704), and `dist/` is
62+
committed, so no build runs at install time.
63+
5964
## License
6065

6166
MIT — see [LICENSE](LICENSE).

‎package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
"@opencode/plugin": "^2.0.0"
4242
},
4343
"scripts": {
44-
"build": "tsc",
45-
"pretest": "npm run build",
44+
"compile": "tsc",
45+
"pretest": "npm run compile",
4646
"test": "node --test --test-concurrency=1 \"tests/*.test.ts\"",
47-
"prepublishOnly": "npm run build"
47+
"prepublishOnly": "npm run compile"
4848
},
4949
"devDependencies": {
5050
"@types/node": "^22.20.3",

0 commit comments

Comments
 (0)