fix(workspace): keep generated versions/* out of the root pnpm workspace - #333
Merged
Conversation
packages/{parser,deparser}/versions/* are generated by prepare-versions and
gitignored, but the root pnpm-workspace.yaml globbed them. Workspace membership
therefore depended on whether a machine had run the generator: every install on
a machine that had would add their importers to pnpm-lock.yaml, and every clean
checkout would prune them back out, so the lockfile ping-ponged forever and
--frozen-lockfile failed locally.
Drop the two globs and have both generators emit a pnpm-workspace.yaml into
versions/, making each generated tree a self-contained workspace with its own
gitignored lockfile. Release flow gains one 'pnpm install' inside versions/.
Also drops the versions/* importers the last release commit added, and with them
every old libpg-query / pgsql-deparser / @pgsql/types they dragged in.
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Summary
pnpm-lock.yamlping-pongs forever, andpnpm install --frozen-lockfilefails locally:packages/{parser,deparser}/versions/*are generated byprepare-versionsand gitignored(
packages/parser/.gitignore,packages/deparser/.gitignore) — but the root workspace globbed them:So workspace membership depended on whether a given machine had happened to run the generator.
A machine that had adds those importers on every install; CI's clean checkout never has the dirs
and prunes them straight back out. The diff comes back no matter which side you commit, and
git reset --harddoesn't help — gitignored dirs survive it, so the stale membership persists.Fix is to make membership deterministic rather than incidental: drop the two globs, and have both
generators emit a
pnpm-workspace.yamlintoversions/so the generated tree is a self-containedworkspace with its own (gitignored) lockfile.
// packages/parser/scripts/prepare-versions.ts // packages/deparser/scripts/generate-version-packages.ts +fs.writeFileSync(path.join(versionsDir, 'pnpm-workspace.yaml'), "packages:\n - '*'\n");Release flow gains one step, documented in
PUBLISH.md:The lockfile shrinks by ~2900 lines net: the last release commit had committed the
versions/*importers, which dragged in every old
libpg-query/pgsql-deparser/@pgsql/typesreferencedby PG 13–18 sub-packages. Removing the importers removes them too. That diff is the point of the
PR, not collateral.
Verification
pnpm install --frozen-lockfileat the root — passes with the generated dirs present on disk,which is the case that used to fail
pnpm installwith the dirs present — leavespnpm-lock.yamluntouched (the churn is gone)pnpm build— all 15 packages passcd packages/parser/versions && pnpm install && cd 13 && npm run build— the generated treestill builds standalone, producing
dist/{index.js,index.d.ts,esm/}Note for anyone with an existing checkout
Generated dirs from before this change have no nested
pnpm-workspace.yaml. Re-runnpm run prepare-versions(or just deletepackages/{parser,deparser}/versions) to pick it up.Link to Devin session: https://app.devin.ai/sessions/2aa454e560904773a0a6955712e0aeda
Requested by: @pyramation