Skip to content

Commit a06a5c5

Browse files
authored
fix: skip postinstall/prepare scripts when installed as npm package (#3)
The postinstall and prepare hooks reference scripts in scripts/ which are not included in the published npm package (files: ['dist/'] only). This caused 'npm install -g @hyperlight-dev/hyperagent' to fail with MODULE_NOT_FOUND. Use '[ ! -f script ] || command' pattern so hooks skip gracefully when scripts don't exist (published package) but still fail loudly when they do exist and error (dev context). Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
1 parent 4041e33 commit a06a5c5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"fmt": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\" \"plugins/**/*.ts\" \"builtin-modules/**/*.js\"",
2626
"fmt:check": "prettier --check \"src/**/*.ts\" \"tests/**/*.ts\" \"plugins/**/*.ts\" \"builtin-modules/**/*.js\"",
2727
"check": "npm run fmt:check && npm run typecheck && npm run test",
28-
"prepare": "npm run build:modules",
29-
"postinstall": "node scripts/patch-vscode-jsonrpc.js && node scripts/check-native-runtime.js"
28+
"prepare": "[ ! -f scripts/build-modules.js ] || npm run build:modules",
29+
"postinstall": "[ ! -f scripts/patch-vscode-jsonrpc.js ] || (node scripts/patch-vscode-jsonrpc.js && node scripts/check-native-runtime.js)"
3030
},
3131
"dependencies": {
3232
"@github/copilot-sdk": "^0.1.32",

0 commit comments

Comments
 (0)