Skip to content

fix(wb): run drizzle-kit and custom start scripts from the monorepo root when shared there#929

Merged
exKAZUu merged 2 commits into
mainfrom
fix-wb-drizzle-root-config
Jul 13, 2026
Merged

fix(wb): run drizzle-kit and custom start scripts from the monorepo root when shared there#929
exKAZUu merged 2 commits into
mainfrom
fix-wb-drizzle-root-config

Conversation

@exKAZUu

@exKAZUu exKAZUu commented Jul 13, 2026

Copy link
Copy Markdown
Member

Problem

Monorepos like WillBooster/smartse-zoom-bot keep drizzle.config.ts and scripts/start-production.sh at the repository root (matching Docker's WORKDIR /app), while drizzle-orm is a dependency of a sub package (packages/server). wb ran both drizzle-kit migrate and the custom start script with the sub package as cwd, so:

  • drizzle-kit could not find drizzle.config.* and exited with code 1, which broke Playwright's webServer (yarn wb start --mode test) and therefore local yarn test-e2e.
  • Even with the config found, root-relative paths inside scripts/start-production.sh (e.g. node_modules/.bin/wb, packages/server/dist/index.js) would not resolve from the sub package.

Project.findFile already supports the "shared file at the monorepo root" layout for Dockerfile, scripts/start-production.sh, etc.; the drizzle commands and the start-script cwd were the only places missing that fallback.

Changes

  • drizzleScripts: resolve drizzle.config.* in the project directory first, then the monorepo root, and wrap drizzle-kit commands with (cd "<config dir>" && ...) because drizzle-kit resolves paths in its config against the cwd. Applied to migrate / generate / studio, the wb db <args> passthrough, and the gen-code drizzle-kit check.
  • baseScripts: run a custom production start script found at the monorepo root with the root as cwd, like Docker's WORKDIR.

Verification

  • New unit tests in packages/wb/test/drizzleScripts.test.ts (4 tests).
  • Full @willbooster/wb test suite passes (111 tests) and yarn verify passes.
  • End-to-end: built this branch's wb and ran it against smartse-zoom-bot; yarn wb start --mode test in packages/server now migrates, seeds, and serves on :8080, and the previously failing local yarn test-e2e passes (6/6).

🤖 Generated with Claude Code

…oot when shared there

Monorepos like smartse-zoom-bot keep drizzle.config.* and
scripts/start-production.sh at the repository root (matching Docker's
WORKDIR) while drizzle-orm lives in a sub package. wb previously ran
`drizzle-kit migrate` and the custom start script with the sub package
as cwd, so Playwright's webServer (`wb start --mode test`) failed to
find the config and root-relative paths inside the start script broke.

- Resolve drizzle.config.* in the project directory first, then the
  monorepo root, and wrap drizzle-kit commands with `cd` into the
  config's directory because drizzle-kit resolves config paths
  against the cwd.
- Run a custom production start script found at the monorepo root with
  the root as cwd, like Docker's WORKDIR.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

…upport

- Keep environment assignments valid by building them inside
  buildDrizzleKitCommand; `ALLOW_TO_SKIP_SEED=0 (cd ...)` was a shell
  syntax error in deployForce.
- Preserve the project cwd when the caller passes an explicit --config.
- Shell-escape the cd target directories via buildShellCommand.
- Resolve the local wrangler D1 state directory to an absolute path so
  the exported DATABASE_URL survives the cd to the monorepo root.
- Document why splitting migration commands on '&&' stays valid.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
@exKAZUu exKAZUu merged commit 01b5826 into main Jul 13, 2026
6 checks passed
@exKAZUu exKAZUu deleted the fix-wb-drizzle-root-config branch July 13, 2026 06:57
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