fix(wb): run drizzle-kit and custom start scripts from the monorepo root when shared there#929
Merged
Merged
Conversation
…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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Monorepos like
WillBooster/smartse-zoom-botkeepdrizzle.config.tsandscripts/start-production.shat the repository root (matching Docker'sWORKDIR /app), whiledrizzle-ormis a dependency of a sub package (packages/server).wbran bothdrizzle-kit migrateand the custom start script with the sub package as cwd, so:drizzle-kitcould not finddrizzle.config.*and exited with code 1, which broke Playwright'swebServer(yarn wb start --mode test) and therefore localyarn test-e2e.scripts/start-production.sh(e.g.node_modules/.bin/wb,packages/server/dist/index.js) would not resolve from the sub package.Project.findFilealready supports the "shared file at the monorepo root" layout forDockerfile,scripts/start-production.sh, etc.; the drizzle commands and the start-script cwd were the only places missing that fallback.Changes
drizzleScripts: resolvedrizzle.config.*in the project directory first, then the monorepo root, and wrapdrizzle-kitcommands with(cd "<config dir>" && ...)because drizzle-kit resolves paths in its config against the cwd. Applied tomigrate/generate/studio, thewb db <args>passthrough, and thegen-codedrizzle-kit check.baseScripts: run a custom production start script found at the monorepo root with the root as cwd, like Docker'sWORKDIR.Verification
packages/wb/test/drizzleScripts.test.ts(4 tests).@willbooster/wbtest suite passes (111 tests) andyarn verifypasses.wband ran it againstsmartse-zoom-bot;yarn wb start --mode testinpackages/servernow migrates, seeds, and serves on :8080, and the previously failing localyarn test-e2epasses (6/6).🤖 Generated with Claude Code