chore: add prepare script so git-dep consumers build dist#4
Conversation
|
Warning Review limit reached
Next review available in: 16 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request adds a "prepare" script to package.json to run the build process. The reviewer pointed out that this can cause production installation failures when devDependencies like TypeScript are not installed, and suggested a conditional check to safely run the build.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| "package.json" | ||
| ], | ||
| "scripts": { | ||
| "prepare": "npm run build", |
There was a problem hiding this comment.
When this package is installed in a production environment (e.g., using npm install --omit=dev or when NODE_ENV=production is set), devDependencies like typescript are not installed. Since the prepare script runs automatically during these installations, it will attempt to run npm run build (which calls tsc) and fail, causing the entire installation to fail.
To prevent production installation failures while still supporting git-dependency builds, you can conditionally run the build only if typescript is available.
| "prepare": "npm run build", | |
| "prepare": "node -e \"try { require('typescript') } catch (e) { process.exit(0) }\" && npm run build", |
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Why
dist/is gitignored and there is noprepare/prepackscript. npm installs agit dependency by cloning and running
prepare— with neither, a consumer thatdepends on this repo by git URL gets a package whose
main: dist/index.jsdoesnot exist.
Reproduced before the fix:
After (same clone, this one line):
Verification
npm ci, not justnpm i— that is the path CI actually runs.ignore-scripts=truein the user npmrc: git-deppreparerunsthrough pacote's own install, so a consumer with that setting still gets a
built
dist/.typecheckclean,test34 pass / 0 fail.DaytonaRuntime, E2BSandboxRuntime, LocalSandboxRuntime, SandboxOrchestrator, ...Bonus
preparealso runs beforenpm publish, so this permanently guaranteesdistis built before publish — independent of the git-dep use case.
Build-script addition only. No source, config, or CI changes.
Summary by cubic
Add a
preparescript to build on install so git dependency consumers get a compileddist/andmain: dist/index.jsresolves. Also guaranteesdist/is built beforenpm publish.Written for commit 81a154a. Summary will update on new commits.