Skip to content

chore: add prepare script so git-dep consumers build dist#4

Merged
khaliqgant merged 1 commit into
mainfrom
chore/prepare-build-script
Jul 18, 2026
Merged

chore: add prepare script so git-dep consumers build dist#4
khaliqgant merged 1 commit into
mainfrom
chore/prepare-build-script

Conversation

@khaliqgant

@khaliqgant khaliqgant commented Jul 18, 2026

Copy link
Copy Markdown
Member

Why

dist/ is gitignored and there is no prepare/prepack script. npm installs a
git dependency by cloning and running prepare — with neither, a consumer that
depends on this repo by git URL gets a package whose main: dist/index.js does
not exist.

Reproduced before the fix:

$ npm i git+file://.../sandbox
added 1 package
$ ls node_modules/@agent-relay/sandbox/
LICENSE  README.md  package.json      <-- no dist/

After (same clone, this one line):

$ ls node_modules/@agent-relay/sandbox/dist/
index.js  index.d.ts  daytona/  e2b/  local/  mount-script.js

Verification

  • Holds on npm ci, not just npm i — that is the path CI actually runs.
  • Holds even with ignore-scripts=true in the user npmrc: git-dep prepare runs
    through pacote's own install, so a consumer with that setting still gets a
    built dist/.
  • Package gates unchanged and green: typecheck clean, test 34 pass / 0 fail.
  • Consumer resolves real exports: DaytonaRuntime, E2BSandboxRuntime, LocalSandboxRuntime, SandboxOrchestrator, ...

Bonus

prepare also runs before npm publish, so this permanently guarantees dist
is 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 prepare script to build on install so git dependency consumers get a compiled dist/ and main: dist/index.js resolves. Also guarantees dist/ is built before npm publish.

Written for commit 81a154a. Summary will update on new commits.

Review in cubic

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@khaliqgant, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 16 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a1254822-2c6e-405b-abef-89a8790552c3

📥 Commits

Reviewing files that changed from the base of the PR and between 7b163ad and 81a154a.

📒 Files selected for processing (1)
  • package.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/prepare-build-script

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread package.json
"package.json"
],
"scripts": {
"prepare": "npm run build",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
"prepare": "npm run build",
"prepare": "node -e \"try { require('typescript') } catch (e) { process.exit(0) }\" && npm run build",

@khaliqgant
khaliqgant marked this pull request as ready for review July 18, 2026 12:34
@khaliqgant
khaliqgant merged commit 4fb29c8 into main Jul 18, 2026
2 checks passed
@cursor

cursor Bot commented Jul 18, 2026

Copy link
Copy Markdown

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.

@khaliqgant
khaliqgant deleted the chore/prepare-build-script branch July 18, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant