Repository navigation
Fixed knex-migrator scripts failing until workspace packages are built - #31747
Conversation
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (1)
✨ Finishing Touches
Comment |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run ghost:test:ci:unit |
✅ Succeeded | 1m 36s | View ↗ |
nx run-many -t test:unit -p @internal/scripts,@... |
✅ Succeeded | 10m 10s | View ↗ |
nx run ghost:test:ci:integration |
✅ Succeeded | 2m 54s | View ↗ |
nx run ghost:test:integration |
✅ Succeeded | 2m 3s | View ↗ |
nx run @tryghost/admin:test:acceptance --shard=3/3 |
✅ Succeeded | 6m 5s | View ↗ |
nx run ghost:test:ci:e2e |
✅ Succeeded | 5m 37s | View ↗ |
nx run @tryghost/admin:test:acceptance --shard=2/3 |
✅ Succeeded | 6m 6s | View ↗ |
nx run @tryghost/admin:test:acceptance --shard=1/3 |
✅ Succeeded | 5m 39s | View ↗ |
Additional runs (17) |
✅ Succeeded | ... | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-10-10 17:28:08 UTC
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #31747 +/- ##
==========================================
- Coverage 85.24% 85.15% -0.09%
==========================================
Files 1365 1365
Lines 51276 51276
Branches 8809 8809
==========================================
- Hits 43710 43665 -45
- Misses 6471 6511 +40
- Partials 1095 1100 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
no ref `pnpm reset:db`, `migrate:db`, `rollback:db` and `knex-migrator` loaded workspace packages from `build/`, which only exists once `pnpm dev` has built them for Admin. Ghost itself runs from source (`--conditions=source --import=tsx`), so in a new worktree these scripts failed with MODULE_NOT_FOUND for `@tryghost/limit-service/build/index.js`, and elsewhere they ran the build from the last `pnpm dev` start rather than the current source. The flags go in NODE_OPTIONS because the `knex-migrator` bin runs each subcommand as a separate process, which doesn't inherit Node's command-line flags. `env` sets them on knex-migrator alone: set on `pnpm exec`, they'd also reach the lifecycle scripts of an automatic install, where `--import=tsx` doesn't resolve.
933600c to
a0123ad
Compare

pnpm reset:db,migrate:db,rollback:dbandpnpm knex-migratorloaded workspace packages frombuild/, which only exists oncepnpm devhas built them for Admin. Ghost itself runs from source. So in a new worktree these scripts failed withCannot find module '…/@tryghost/limit-service/build/index.js', and elsewhere they ran the build from the lastpnpm devstart instead of the current source.NODE_OPTIONS='--conditions=source --import=tsx', the flagspnpm devandpnpm reset:datagive Ghost.NODE_OPTIONSbecause theknex-migratorbin runs each subcommand as a separate process.envlimits them to knex-migrator, so an automatic install started bypnpm execdoesn't run lifecycle scripts with--import=tsx.Verified in a new worktree after
pnpm bootstraponly.knex-migrator initfailed on main and now succeeds.reset:db,migrate:dband arollback --force/migrate --forceround trip succeed againstdev_<worktree>, and an install from stale dependencies no longer fails.