Repository navigation
Read codemod target versions from workspace manifests at build time - #2419
Merged
felixweinberger merged 2 commits intoJul 2, 2026
Merged
Conversation
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.
Running
pnpm install && pnpm buildon a fresh clone leaves the repo dirty: the build regeneratespackages/codemod/src/generated/versions.tswith contents that differ from what's committed.Motivation and Context
The file is generated from the workspace
package.jsonversions, but the changesets "Version Packages" PR bumps those manifests without regenerating it (most recently #2416, beta.1 → beta.2). So after every release the committed copy is stale — every local build produces the diff, and source builds of the codemod write the stale versions into migrated projects (^2.0.0-beta.1instead of^2.0.0-beta.2). Published artifacts were unaffected since publishing rebuilds.Fix: stop committing derived state.
src/versions.tsis now a normal source file that imports the six workspacepackage.jsons; the bundler inlines the version fields at build time. The generator script,prebuildhook, andgenerated/directory are deleted. Version bumps flow through automatically; the only hand-maintained part is the name→path list the generator already hardcoded, now as imports that fail typecheck if a package moves. No tsconfig changes needed (resolveJsonModuleandmoduleResolution: bundlerare already set).How Has This Been Tested?
pnpm buildno longer modifies the tree.dist/has all six versions inlined; no runtime reads of sibling manifests.^2.0.0-beta.2(was stale^2.0.0-beta.1), devDependencies placement kept,--dry-runwrites nothing, re-run is idempotent.Breaking Changes
None.
V2_PACKAGE_VERSIONSis internal to the codemod.Types of changes
Checklist
Additional context
Alternatives considered: gitignoring the generated file (CI typechecks before building, so fresh clones would need extra generate hooks) and regenerating inside the changesets version command (fixes the release writer but keeps the duplicated state in sync by process rather than by construction).