From 1c1b667df0b8d2069a48c414572d2fc333a7e27e Mon Sep 17 00:00:00 2001 From: Simon Davies Date: Mon, 23 Mar 2026 12:04:17 +0000 Subject: [PATCH] fix: skip postinstall/prepare scripts when installed as npm package 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 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4d28ef3..0e49700 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,8 @@ "fmt": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\" \"plugins/**/*.ts\" \"builtin-modules/**/*.js\"", "fmt:check": "prettier --check \"src/**/*.ts\" \"tests/**/*.ts\" \"plugins/**/*.ts\" \"builtin-modules/**/*.js\"", "check": "npm run fmt:check && npm run typecheck && npm run test", - "prepare": "npm run build:modules", - "postinstall": "node scripts/patch-vscode-jsonrpc.js && node scripts/check-native-runtime.js" + "prepare": "[ ! -f scripts/build-modules.js ] || npm run build:modules", + "postinstall": "[ ! -f scripts/patch-vscode-jsonrpc.js ] || (node scripts/patch-vscode-jsonrpc.js && node scripts/check-native-runtime.js)" }, "dependencies": { "@github/copilot-sdk": "^0.1.32",