Skip to content

Make npm and bun scaffolds resolve consistent package versions (#682 follow-up) #692

Description

@vivek7405

Problem

After #682 (bun create skips install by default), the two scaffold paths can resolve DIFFERENT dependency versions for the same template:

So a fresh bun create webjs my-app and npm create webjs my-app of the same template can run different versions of @webjsdev/*, drizzle-orm, etc. The divergence is small at t=0 (latest equals latest-in-range when no out-of-range release exists) but GROWS once a dependency publishes a version outside the scaffold's range. Example: @webjsdev/core is pre-1.0, so once 0.8.0 ships, npm stays on 0.7.x (within ^0.7.0) while Bun jumps to 0.8.0.

The scaffold experience should be consistent across runtimes, especially the package versions an app actually runs.

Design / approach (decide, then implement)

Candidate directions:

  1. Exact-pin the scaffold's package.json (the CLI knows the exact current versions at create time). Then BOTH runtimes resolve identical versions: Bun honors exact pins via the feat: pin Bun zero-install deps via an onLoad specifier-rewrite from package.json #685 rewrite, npm installs the exact versions. Most consistent and reproducible. Tradeoff: no automatic patch/minor bumps until the user loosens to ^ (reasonable for a starting point, and a fresh webjs create always emits the current versions anyway).
  2. Accept and document the difference (Bun is an absolute-latest dev convenience, npm is latest-in-range pinned) as a deliberate per-runtime tradeoff, no code change. Cheapest, but leaves real divergence.
  3. Other alignment (for example a committed lockfile plus a runtime strategy). Note that a bun.lock does NOT pin under Bun zero-install (research: respect full package.json (ranges + tree) under Bun zero-install (default auto-install) #690), so a lockfile alone cannot align Bun.

Recommendation to evaluate: option 1 (exact pins) gives the strongest consistency and is the only thing that makes Bun zero-install pin at all (#690 showed only exact pins hold). The owner previously accepted absolute-latest for Bun dev (#682), so the decision is whether cross-runtime CONSISTENCY is worth switching the templates to exact pins.

Implementation notes (for the implementing agent)

Acceptance criteria

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions