fix: declare ts-morph as a runtime dependency#498
Merged
Conversation
The `gqm` bin is bundled with esbuild `--packages=external`, so `ts-morph` (used by `gqm generate` to parse models.ts / knexfile.ts) must resolve at runtime in consumer installs. It had been moved to `devDependencies`, so a consumer installing only production dependencies hits `Error: Cannot find module 'ts-morph'` when running `gqm generate`. Move it back to `dependencies` (where 28.0.0 had it). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
🎉 This PR is included in version 28.0.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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
gqm generatefails in consumers on 28.0.1 with:Root cause
The
gqmbin is bundled with esbuild--packages=external(build:bin), so its imports are resolved at runtime from the consumer'snode_modules.ts-morphis imported across the bin (parse-models.ts,parse-knexfile.ts,parse-functions.ts,permissions.ts,static-eval.ts,visitor.ts,utils.ts) to parse the consumer'smodels.ts/knexfile.ts, so it is a runtime dependency.Between 28.0.0 and 28.0.1 it was moved from
dependenciestodevDependencies(28.0.0 shippedts-morph: ^27.0.2underdependencies; 28.0.1 declares nots-morphat all). Consumers install only production dependencies, sots-morphis absent andgqm generatethrows at module load.The project's own CI doesn't catch this because it installs devDependencies, so
ts-morphis always present in-repo.Fix
Move
ts-morphback todependencies. Verified a production-only install now resolves it (npm ls ts-morph --omit=dev→ts-morph@28.0.0); lint, unit tests, build andgqm generateall pass.🤖 Generated with Claude Code