fix(dev): align api dev scripts and codegen runner#992
Conversation
3498efe to
abc81e1
Compare
abc81e1 to
30a04fe
Compare
|
Implementation note: This PR intentionally keeps Reason:
Switching Follow-up work should move this route-disabling behavior out of CLI startup mutation and into a stable plugin/config mechanism. After that, |
|
Follow-up investigation in PR #994 / issue #993 confirmed that keeping |
|
Ready for maintainer merge from my side. Local verification already completed:
There are no GitHub checks reported for this PR branch, and the PR is currently mergeable. I attempted to merge, but my GitHub account does not have |
|
Note on the reported failed check: The only reported GitHub Actions run is Observed details:
This usually means the workflow needs maintainer/admin action for a forked PR or required repository secrets/permissions are not available to the PR run. I also tried to rerun it, but GitHub rejected it because my account does not have admin rights on this repository. Local verification remains green:
|
medusa build runs with NODE_ENV=production, so the CodegenModuleService onApplicationStart hook early-returns and route types are not regenerated. mercurjs build runs writeRouteTypes() before delegating to medusa build, keeping .mercur route types in sync. dev stays on medusa develop because the codegen module fires on app start in development.
|
Fixed the reported �[32minfo�[39m: redisUrl not found. A fake redis instance will be used. |
|
Correction to the previous comment (shell quoting stripped inline code): Fixed the reported Root cause: Change: Verified locally after the fix: cd /Users/joon/fashion-marketplace-spikes/scratch/mercur/apps/api && bun run buildResult: |
Summary
startonmercurjs startso the existingpatchMedusa()behavior still disables default Medusa admin product/product-variant routes.buildonmercurjs buildso route-type codegen (writeRouteTypes()) still runs before the Medusa build (see Notes).bunxinstead of falling back tonpx.Why each script lands where it does
devmedusa developCodegenModuleService.onApplicationStartruns codegen automatically, but only whenNODE_ENV=development(whichmedusa developsets). Route types stay fresh without the CLI wrapper.buildmercurjs buildmedusa buildruns withNODE_ENV=production, so the codegen hook early-returns and route types would go stale.mercurjs buildcallswriteRouteTypes()first, then delegates tomedusa build(nopatchMedusa()), so types stay in sync.startmercurjs startpatchMedusa()to disable default admin product/product-variant routes in production.About the
.mercur/index.d.tsdiffThe regenerated types change
admin.invites.acceptfrom@mercurjs/core/api/admin/invites/accept/routeto@medusajs/medusa/api/admin/invites/accept/route. This is a correction, not a regression:packages/core/src/api/admin/invites/accept/route.tsin core (the only invites/accept route isvendor/members/invites/accept), so the old path pointed at a module that does not exist.packages/cli/src/codegen/constants.tsexplicitly maps/admin/invites/acceptto@medusajs/medusa/api/admin/invites/accept/route, which the regenerated value now matches.Verification
cd apps/api && medusa db:migratecd apps/api && bun run dev-> server ready on port 9000curl -i http://localhost:9000/health-> HTTP 200 OKbun run build-> 10 successful / 10 totalbun run test:integration:http -- fulfillment-sets-> 19 passed / 19 totalNotes
wasin-creator, so this PR is opened from the fork branchwasin-creator:fix/api-dev-codegen-runner.startintentionally remainsmercurjs startuntil the Medusa route patching done bypatchMedusa()is moved into a non-wrapper startup path.