-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix: handle npm git dep installation for GitHub installs #792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,7 +48,8 @@ | |
| "test:ui": "vitest --ui", | ||
| "test:coverage": "vitest --coverage", | ||
| "test:postinstall": "node scripts/postinstall.js", | ||
| "prepare": "pnpm run build", | ||
| "prepare": "node build.js", | ||
| "prepack": "node build.js", | ||
|
Comment on lines
+51
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Redundant double build during Both If the intent is for "prepare": "node build.js",
"prepack": "node -e \"const {existsSync}=require('fs'); if(!existsSync('dist')) process.exit(0);\" || node build.js",Or more cleanly, extract the "build if not already built" logic into |
||
| "prepublishOnly": "pnpm run build", | ||
| "postinstall": "node scripts/postinstall.js", | ||
| "check:pack-version": "node scripts/pack-version-check.mjs", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
node_modulescheck is CWD-sensitiveexistsSync('node_modules')resolves relative to the process's current working directory, not the script's location. npm lifecycle scripts set CWD to the package root, so this is safe in the intended scenarios. However, ifbuild.jsis ever invoked via a path likenode packages/openspec/build.jsfrom the monorepo root (e.g. in a CI script),node_moduleswould refer to the root-level directory rather than the package's own deps, making the check unreliable.Consider anchoring the check to the script's own directory for robustness: