-
Notifications
You must be signed in to change notification settings - Fork 5
yarn -> pnpm #253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
yarn -> pnpm #253
Conversation
…fig.json for TypeScript compilation, and preventing .js and .d.ts files from being generated in the src folder
Replace lerna run commands with pnpm -r to avoid NX dependency issues and simplify workspace script execution.
Replace symlink-workspace package with custom Node.js script to support pnpm workspace bin linking, as symlink-workspace doesn't work with pnpm's isolated node_modules structure.
Ensure TypeScript compiler uses correct config file to prevent output files from being generated in source directories instead of dist folder.
Add @launchql/logger, pg, and @types/pg to dependencies. Yarn automatically hoists dependencies to workspace root, allowing packages to access dependencies not declared in their package.json. pnpm requires explicit declarations, preventing phantom dependencies and ensuring better reproducibility
Add explicit dependencies to packages that were relying on yarn hoisting: - cli: @launchql/logger - url-domains: express, @types/express - introspectron: pg, @types/pg - pg-codegen: @launchql/logger, pg-cache, pg-env - pgsql-test: @launchql/logger Remove resolutions field from all packages (pnpm uses root overrides). Yarn hoists dependencies automatically, but pnpm requires explicit declarations in each package.json for better dependency isolation and reproducibility
- Add pg and @types/pg as devDependencies in packages/cli/package.json Required for TypeScript tests that import pg in pnpm's isolated structure - Fix module template build script to use 'tsc -p tsconfig.json' instead of 'tsc' Ensures consistent build behavior across generated modules - Update test snapshots to reflect corrected template output and file ordering
… pnpm - Add graphql@15.10.1 as devDependency in packages/launchql-gen/package.json - Required for TypeScript tests that import graphql in pnpm's isolated structure - GraphQL 15 includes built-in type definitions, no @types/graphql needed
…ith pnpm - Add @types/babel__generator@^7.6.8 as devDependency in packages/pg-codegen/package.json - Required for TypeScript tests that import @babel/generator in pnpm's isolated structure - Fixes TS7016 error: Could not find a declaration file for module '@babel/generator'
- Add glob@^11.0.2 and @types/glob@^8.1.0 as devDependencies in packages/s3-streamer/package.json - Required for TypeScript tests that import glob in pnpm's isolated structure - Update test snapshots to reflect hash value changes
…ependencies - Add moduleNameMapper configuration in packages/pgsql-test/jest.config.js - Maps @launchql/* packages to packages/*/dist directories for Jest resolution - Fixes Jest module resolution issues with pnpm's isolated structure - Required for tests that import @launchql/core and other workspace packages
- Add moduleNameMapper configuration in packages/cli/jest.config.js - Maps @launchql/* packages to packages/*/dist directories - Maps pg-env and pg-cache to their dist directories - Fixes Jest module resolution issues with pnpm's isolated structure - Update test snapshots to match corrected template build script format
- Add moduleNameMapper configuration in packages/introspectron/jest.config.js - Maps @launchql/* packages to packages/*/dist directories - Maps pgsql-test, graphile-test, pg-env, and pg-cache to their dist directories - Fixes Jest module resolution issues with pnpm's isolated structure - Required for tests that import workspace packages like pgsql-test and graphile-test
- Add moduleNameMapper configuration in packages/launchql-gen/jest.config.js - Maps @launchql/* packages to packages/*/dist directories - Maps pgsql-test, graphile-test, pg-env, and pg-cache to their dist directories - Fixes Jest module resolution issues with pnpm's isolated structure - Required for tests that import graphile-test which depends on pgsql-test
- Add moduleNameMapper configuration in packages/pg-codegen/jest.config.js - Maps @launchql/* packages to packages/*/dist directories - Maps pgsql-test, graphile-test, pg-env, and pg-cache to their dist directories - Fixes Jest module resolution issues with pnpm's isolated structure - Required for tests that import pgsql-test which depends on @launchql/logger
| "../../extensions/@webql/base32/revert/schemas/base32/procedures/decode.sql", | ||
| "../../extensions/@webql/base32/deploy/schemas/base32/schema.sql", | ||
| "../../extensions/@webql/base32/deploy/schemas/base32/procedures/encode.sql", | ||
| "../../extensions/@webql/base32/deploy/schemas/base32/procedures/decode.sql", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you know why these got out of order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did some research, and found the order changed because glob.sync() in packages/cli/tests/init.install.test.ts doesn't guarantee file order—it depends on file system traversal, which differs between Yarn's flat node_modules and pnpm's symlinked structure.
I found out two options:
Option 1: Keep depth-first sort — matches yarn's apparent behavior but more complex
Option 2: Use alphabetical sort (.sort()) — deterministic but changes snapshot order
I prefer Option 2 for simplicity and reliability, but I'm happy to keep the original order if you prefer. Which do you prefer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use option 2, I think you are right! :)
packages/cli/jest.config.js
Outdated
| '^@launchql/logger$': '<rootDir>/../../packages/logger/dist', | ||
| '^@launchql/(.*)$': '<rootDir>/../../packages/$1/dist', | ||
| '^pg-env$': '<rootDir>/../../packages/pg-env/dist', | ||
| '^pg-cache$': '<rootDir>/../../packages/pg-cache/dist', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these absolutely necessary?
Shouldn't this be picked up by pnpm workspace?
I never had to do this in other packages, it seems that it could be cruft.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried workspace:^ and it worked, I will fix those moduleNameMapper issue
| '^pgsql-test$': '<rootDir>/../../packages/pgsql-test/dist', | ||
| '^graphile-test$': '<rootDir>/../../packages/graphile-test/dist', | ||
| '^pg-env$': '<rootDir>/../../packages/pg-env/dist', | ||
| '^pg-cache$': '<rootDir>/../../packages/pg-cache/dist', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as before, this seems very very unmaintainble.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see reply above about workspace:^
packages/launchql-gen/jest.config.js
Outdated
| '^pgsql-test$': '<rootDir>/../../packages/pgsql-test/dist', | ||
| '^graphile-test$': '<rootDir>/../../packages/graphile-test/dist', | ||
| '^pg-env$': '<rootDir>/../../packages/pg-env/dist', | ||
| '^pg-cache$': '<rootDir>/../../packages/pg-cache/dist', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one also
maybe we use the workspace:* syntax and pnpm resolves this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see reply above about workspace:^
packages/pg-codegen/jest.config.js
Outdated
| '^graphile-test$': '<rootDir>/../../packages/graphile-test/dist', | ||
| '^pg-env$': '<rootDir>/../../packages/pg-env/dist', | ||
| '^pg-cache$': '<rootDir>/../../packages/pg-cache/dist', | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, we should NOT have moduleNameMapper
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see reply above about workspace:^
packages/pgsql-test/jest.config.js
Outdated
| modulePathIgnorePatterns: ['dist/*'], | ||
| moduleNameMapper: { | ||
| '^@launchql/logger$': '<rootDir>/../../packages/logger/dist', | ||
| '^@launchql/(.*)$': '<rootDir>/../../packages/$1/dist', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one too, can you explain what this was for?
perhaps, again, let's research if workspace:* syntax solves this instead of referencing the package versions directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see reply above about workspace:^
| "etag": "2524b9c1caad97610a5149886a7e793f", | ||
| "sha": "62c8208c3f148ada7e1a1a3b8972ac5898dfbf89", | ||
| "uuid": "89250a3c-a794-5d26-8ee4-d692dff9fc35", | ||
| "etag": "9086b336429e90603656255396a5d462", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this snap getting updated is pretty serious. Do you know why these are changing?
This needs to be documented, or likely reverted back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see reply above about glob.sync()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so the hashes are just getting moved around, but the hashes themselves aren't changing?
| "lint": "lerna run lint --parallel", | ||
| "symlink": "symlink-workspace --logLevel error", | ||
| "postinstall": "yarn symlink" | ||
| "postinstall": "pnpm run symlink" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we probably do not need to symlink anymore. Assuming we use workspace:* syntax, pnpm does the symlinking to simulate local modules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pnpm workspaces should solve this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, symlink is automatically run by pnpm when you do pnpm install anyways, this is unnecessary. It should be handled with workspace:* protocol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"postinstall": "pnpm run symlink" deleted
scripts/symlink-workspace.js
Outdated
| @@ -0,0 +1,41 @@ | |||
| const fs = require('fs'); | |||
| const path = require('path'); | |||
|
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this entire script should be deleted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file has been deleted
- Replace version-based dependencies with workspace:^ protocol in packages/cli/package.json - Remove moduleNameMapper from Jest config as pnpm workspace symlinks handle module resolution - Add .sort() to test file lists for deterministic snapshot ordering This leverages pnpm's native workspace protocol for better dependency resolution and simplifies Jest configuration by relying on pnpm's symlink structure.
…ve Jest moduleNameMapper - Replace workspace dependencies with workspace:^ protocol in: * packages/pgsql-test (dependencies) * packages/launchql-gen (devDependencies) * packages/pg-codegen (dependencies) * packages/introspectron (devDependencies) - Remove moduleNameMapper from Jest configs: * packages/pgsql-test/jest.config.js * packages/launchql-gen/jest.config.js * packages/pg-codegen/jest.config.js * packages/introspectron/jest.config.js This completes the migration to pnpm's native workspace protocol, allowing Jest to resolve workspace packages via pnpm's symlink structure without manual module path mappings.
- Remove symlink and postinstall scripts from root package.json - Remove symlink-workspace dependency from all package.json files - Replace lerna commands with pnpm commands in templates - Delete scripts/symlink-workspace.js (no longer needed) - Update workspace templates to use pnpm native workspace commands pnpm automatically handles workspace package linking via workspace:^ protocol, so manual symlink scripts are unnecessary.
Make the chmod step for lql binary conditional to prevent CI failures when node_modules/.bin/lql doesn't exist. pnpm workspace linking may not always create the binary symlink in node_modules/.bin, but pnpm exec still works correctly for workspace packages
Key Changes
moduleNameMapperfor workspace dependenciesTesting
✅ All local tests passing
CI/CD
workflows already use pnpm