You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A fresh Bun zero-install scaffold cannot set up its database. Reproduced cleanly (fresh bun pm cache rm, shipped cli@0.10.25):
npm create webjs@latest fs -- --runtime bun # skips install (#691)
cd fs && bun run db:generate
# SyntaxError: Export named 'defineRelations' not found in
# .../cache/drizzle-orm@0.45.2@@@1/index.js
Bun fetched drizzle-orm@0.45.2 and drizzle-kit@0.31.10 (both the wrong 0.x major), despite the package.json pinning 1.0.0-rc.3. All three templates use Drizzle, so this breaks db setup for every bun zero-install app. The npm/node path works (npm honors the exact pin).
Root cause (see #690 for the full cross-version research)
Bun RUNTIME auto-install ignores the package.json version for a bare import. An empty cache resolves to the absolute latest major. Verified across Bun 1.0.0 through 1.4.0-canary. Only an inline EXACT specifier (drizzle-orm@1.0.0-rc.3) is honored; inline ranges and tags ENOENT.
webjs db <generate|migrate|push|studio> (packages/cli/bin/webjs.js, case 'db') resolves the drizzle-kit bin (resolveBin(cwd, 'drizzle-kit')) and SPAWNS it as a separate bun drizzle-kit subprocess. That subprocess has no feat: pin Bun zero-install deps via an onLoad specifier-rewrite from package.json #685 plugin, so its bare import 'drizzle-orm' (from the schema) hits raw auto-install against an empty cache and gets the wrong major.
The trigger is #691 (skip-install default for bun). Before it, bun create ran bun install, which DOES honor pins, so the db worked. The cli AGENTS.md still says "since webjs create auto-installs", now stale for bun.
Design / approach
Recommended: A. do not default to skip-install for db templates (revert the #691 default, at least when Drizzle is present, which is all three templates). Bun zero-install fundamentally cannot pin a spawned tool's deps, so the skip-install default is unsafe for any app with db tooling. The npm path is unaffected.
C. webjs db runs a targeted bun install when node_modules is absent on bun. Works, but it is a per-command install that surprises the user mid-command.
For option A: make resolveCreateInstall (or the create path) install on bun when the template carries Drizzle, or revert the bun default to install outright. Update the next-steps banner and the "Skipped install" note accordingly.
Docs to resync: agent-docs/runtime.md (the zero-install section), docs/app/docs/runtime/page.ts, AGENTS.md scaffolding line, the scaffold templates/AGENTS.md, and packages/cli/AGENTS.md (the stale "webjs create auto-installs" note).
Tests: a scaffold test that a fresh bun db app can run db:generate (or that bun create installs for a db template). Counterfactual: it fails if skip-install is restored for a db template.
Acceptance criteria
A fresh bun create webjs (full-stack / api / saas) can run db:generate + db:migrate and boot with a working DB.
The npm/node path is unchanged.
A test proves the db-tooling path works on bun (with the counterfactual).
Docs resynced; the stale "auto-installs" note fixed.
Problem
A fresh Bun zero-install scaffold cannot set up its database. Reproduced cleanly (fresh
bun pm cache rm, shipped cli@0.10.25):Bun fetched drizzle-orm@0.45.2 and drizzle-kit@0.31.10 (both the wrong 0.x major), despite the package.json pinning 1.0.0-rc.3. All three templates use Drizzle, so this breaks db setup for every bun zero-install app. The npm/node path works (npm honors the exact pin).
Root cause (see #690 for the full cross-version research)
drizzle-orm@1.0.0-rc.3) is honored; inline ranges and tags ENOENT.Bun.pluginruns ONLY in the webjs server process.webjs db <generate|migrate|push|studio>(packages/cli/bin/webjs.js,case 'db') resolves the drizzle-kit bin (resolveBin(cwd, 'drizzle-kit')) and SPAWNS it as a separatebun drizzle-kitsubprocess. That subprocess has no feat: pin Bun zero-install deps via an onLoad specifier-rewrite from package.json #685 plugin, so its bareimport 'drizzle-orm'(from the schema) hits raw auto-install against an empty cache and gets the wrong major.The trigger is #691 (skip-install default for bun). Before it,
bun createranbun install, which DOES honor pins, so the db worked. The cli AGENTS.md still says "sincewebjs createauto-installs", now stale for bun.Design / approach
Recommended: A. do not default to skip-install for db templates (revert the #691 default, at least when Drizzle is present, which is all three templates). Bun zero-install fundamentally cannot pin a spawned tool's deps, so the skip-install default is unsafe for any app with db tooling. The npm path is unaffected.
Alternatives considered:
bun --preload <pin-registrar> drizzle-kit ...so the feat: pin Bun zero-install deps via an onLoad specifier-rewrite from package.json #685 plugin loads in that process. Incomplete on its own:resolveBinstill resolves the WRONG drizzle-kit bin (0.31.10) under an empty cache, which--preloaddoes not fix.webjs dbruns a targetedbun installwhen node_modules is absent on bun. Works, but it is a per-command install that surprises the user mid-command.Implementation notes (for the implementing agent)
resolveCreateInstall()inpackages/cli/lib/create.js(the per-runtime install default, bun create defaults to no install (zero-install onboarding); node unchanged #682/feat(cli): bun create skips install by default (zero-install dev); node unchanged #691) and thecase 'db'block inpackages/cli/bin/webjs.js.resolveCreateInstall(or the create path) install on bun when the template carries Drizzle, or revert the bun default to install outright. Update the next-steps banner and the "Skipped install" note accordingly.agent-docs/runtime.md(the zero-install section),docs/app/docs/runtime/page.ts,AGENTS.mdscaffolding line, the scaffoldtemplates/AGENTS.md, andpackages/cli/AGENTS.md(the stale "webjs create auto-installs" note).db:generate(or that bun create installs for a db template). Counterfactual: it fails if skip-install is restored for a db template.Acceptance criteria
bun create webjs(full-stack / api / saas) can rundb:generate+db:migrateand boot with a working DB.