chore: migrate to pnpm - #2229
Conversation
Signed-off-by: Alex Matson <alex.matson@digitalasset.com>
There was a problem hiding this comment.
Pull request overview
This PR is a spike to migrate the repo from Yarn to pnpm by switching script invocations, adding pnpm workspace configuration, and removing Yarn SDK artifacts to enable pnpm-based local dev, CI, and release workflows.
Changes:
- Introduces
pnpm-workspace.yamland updates root/workspace scripts and tooling hooks fromyarn ...topnpm .... - Centralizes tsdown build defaults in a new
tsdown.base.mtsand updates packagetsdown.config.tsreferences accordingly. - Adjusts Nx build dependencies and TypeScript config include/exclude patterns for select packages/examples.
Reviewed changes
Copilot reviewed 82 out of 94 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| tsdown.base.mts | Adds shared tsdown base config for packages to import. |
| sdk/wallet-sdk/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| sdk/wallet-sdk/tsconfig.json | Adds excludes for build output/tests to TS config. |
| sdk/dapp-sdk/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| scripts/src/upgrade-splice.ts | Updates prettier check command from Yarn to pnpm. |
| scripts/src/test-stress-scripts.ts | Migrates stress-script runner commands from Yarn to pnpm. |
| scripts/src/test-examples-scripts-under-stress.ts | Migrates example stress runner commands from Yarn to pnpm. |
| scripts/src/test-example-scripts.ts | Migrates example runner commands from Yarn to pnpm. |
| scripts/src/start-canton.ts | Updates user-facing error message instructions from Yarn to pnpm. |
| scripts/src/retag.ts | Updates usage text from Yarn to pnpm. |
| scripts/src/release.ts | Migrates release command invocations from Yarn to pnpm. |
| scripts/src/lib/utils.ts | Migrates Nx command invocations from Yarn to pnpm. |
| scripts/src/generate-test-token.ts | Migrates localnet fetch invocation from Yarn to pnpm. |
| scripts/src/generate-protobufs.ts | Migrates plugin path resolution command from Yarn to pnpm. |
| scripts/src/docs-update-wg-config.ts | Migrates build/workspace execution instructions from Yarn to pnpm. |
| scripts/src/coverage-report.ts | Migrates command execution wrapper from Yarn to pnpm. |
| scripts/src/check-migration-lock.ts | Updates user-facing instructions from Yarn to pnpm. |
| scripts/package.json | Adds esbuild and adjusts scripts package dependencies for tooling needs. |
| pnpm-workspace.yaml | Adds pnpm workspace package globs plus build allowlist and overrides. |
| package.json | Updates root scripts, lint-staged commands, and packageManager to pnpm. |
| nx.json | Changes default build target dependencies. |
| examples/test-token-v1-registry/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| examples/test-token-v1-registry/tsconfig.json | Adds excludes for build output/tests to TS config. |
| examples/test-token-v1-registry/src/api/transfer-instruction/index.ts | Adds explicit Router typing to the router instance. |
| examples/test-token-v1-registry/src/api/metadata/index.ts | Adds explicit Router typing to the router instance. |
| examples/test-token-v1-registry/src/api/allocation/index.ts | Adds explicit Router typing to the router instance. |
| examples/test-token-v1-registry/src/api/allocation-instruction/index.ts | Adds explicit Router typing to the router instance. |
| core/wallet-user-rpc-client/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/wallet-user-rpc-client/package.json | Migrates scripts from Yarn to pnpm (docs/flatpack). |
| core/wallet-test-utils/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/wallet-store/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/wallet-store-sql/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/wallet-store-inmemory/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/wallet-discovery/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/wallet-dapp-rpc-client/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/wallet-dapp-rpc-client/package.json | Migrates scripts from Yarn to pnpm and changes version. |
| core/wallet-dapp-remote-rpc-client/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/wallet-dapp-remote-rpc-client/package.json | Migrates scripts from Yarn to pnpm (docs/flatpack). |
| core/wallet-auth/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/types/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/tx-visualizer/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/tx-parser/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/token-standard/package.json | Migrates build/flatpack scripts from Yarn to pnpm. |
| core/token-standard-service/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/test-token/package.json | Migrates build/flatpack scripts from Yarn to pnpm. |
| core/splice-provider/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/splice-client/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/signing-store-sql/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/signing-participant/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/signing-lib/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/signing-internal/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/signing-fireblocks/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/signing-dfns/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/signing-blockdaemon/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/rpc-transport/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/rpc-generator/templates/client/typescript/tsdown.config.ts | Switches template to importing the shared tsdown base from .mts. |
| core/rpc-generator/templates/client/typescript/_package.json | Migrates generated template scripts from Yarn to pnpm (docs/flatpack). |
| core/rpc-generator/src/components/controller.ts | Migrates generator formatting commands from Yarn to pnpm. |
| core/rpc-generator/src/components/client.ts | Migrates generator formatting commands from Yarn to pnpm. |
| core/rpc-errors/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/provider-ledger/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/provider-dapp/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/ledger-client/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/ledger-client-types/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/daml-codegen-helpers/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/asyncapi-client/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/amulet-service/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| core/acs-reader/tsdown.config.ts | Switches to importing the shared tsdown base from .mts. |
| .yarn/sdks/typescript/package.json | Removes Yarn SDK artifact as part of migration. |
| .yarn/sdks/typescript/lib/typescript.js | Removes Yarn SDK artifact as part of migration. |
| .yarn/sdks/typescript/lib/tsserverlibrary.js | Removes Yarn SDK artifact as part of migration. |
| .yarn/sdks/typescript/lib/tsserver.js | Removes Yarn SDK artifact as part of migration. |
| .yarn/sdks/typescript/lib/tsc.js | Removes Yarn SDK artifact as part of migration. |
| .yarn/sdks/typescript/bin/tsserver | Removes Yarn SDK artifact as part of migration. |
| .yarn/sdks/typescript/bin/tsc | Removes Yarn SDK artifact as part of migration. |
| .yarn/sdks/prettier/package.json | Removes Yarn SDK artifact as part of migration. |
| .yarn/sdks/prettier/index.cjs | Removes Yarn SDK artifact as part of migration. |
| .yarn/sdks/prettier/bin/prettier.cjs | Removes Yarn SDK artifact as part of migration. |
| .yarn/sdks/integrations.yml | Removes Yarn SDK integration file as part of migration. |
| .yarn/sdks/eslint/package.json | Removes Yarn SDK artifact as part of migration. |
| .yarn/sdks/eslint/lib/unsupported-api.js | Removes Yarn SDK artifact as part of migration. |
| .yarn/sdks/eslint/lib/universal.js | Removes Yarn SDK artifact as part of migration. |
| .yarn/sdks/eslint/lib/types/use-at-your-own-risk.d.ts | Removes Yarn SDK artifact as part of migration. |
| .yarn/sdks/eslint/lib/types/universal.d.ts | Removes Yarn SDK artifact as part of migration. |
| .yarn/sdks/eslint/lib/types/rules.d.ts | Removes Yarn SDK artifact as part of migration. |
| .yarn/sdks/eslint/lib/types/index.d.ts | Removes Yarn SDK artifact as part of migration. |
| .yarn/sdks/eslint/lib/types/config-api.d.ts | Removes Yarn SDK artifact as part of migration. |
| .yarn/sdks/eslint/lib/config-api.js | Removes Yarn SDK artifact as part of migration. |
| .yarn/sdks/eslint/lib/api.js | Removes Yarn SDK artifact as part of migration. |
| .yarn/sdks/eslint/bin/eslint.js | Removes Yarn SDK artifact as part of migration. |
| .husky/pre-commit | Updates pre-commit hook from Yarn to pnpm. |
| .commitlintrc.js | Migrates Nx project discovery command from Yarn to pnpm. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Alex Matson <alex.matson@digitalasset.com>
Signed-off-by: Alex Matson <alex.matson@digitalasset.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 142 out of 154 changed files in this pull request and generated 1 comment.
Suppressed comments (15)
scripts/src/test-examples-scripts-under-stress.ts:162
- When spawning
tsxvia pnpm, preferpnpm exec tsxto ensure the binary is resolved from the workspace.
.github/actions/setup_yarn/initial/action.yml:40 - The composite setup action runs
pnpm run generate:allwithout ensuring dependencies are installed; the CI build will fail unless pnpm/setup implicitly runs an install. Add an explicitpnpm install --frozen-lockfilestep before generating.
- name: generate all
shell: bash
run: pnpm run generate:all
.github/actions/setup_yarn/artifacts/action.yml:19
- This artifacts-based setup action downloads build artifacts but never installs JS dependencies; subsequent steps (commitlint/nx/prettier/etc.) require node_modules. Add a
pnpm install --frozen-lockfilestep after downloading the artifacts.
- name: Download build artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: build-dist-${{ github.run_id }}
.github/workflows/publish.yml:44
- The publish workflow runs generate/build without installing dependencies. Add an explicit
pnpm install --frozen-lockfilebefore the Generate step.
- name: Generate
run: pnpm run generate:all
- name: Build
run: pnpm run build:all
package.json:99
lint-stagedcommands should invoke workspace binaries explicitly to avoid ambiguity between scripts vs executables. Usingpnpm exechere makes it clear we’re running the installedprettier/eslintbinaries.
core/rpc-generator/src/components/controller.ts:62- These hooks appear to be invoking the eslint/prettier binaries. Prefer
pnpm execso the generator doesn’t depend on pnpm’s script-resolution behavior.
core/rpc-generator/src/components/client.ts:155 - Use
pnpm exec prettierhere to unambiguously run the prettier binary (rather than relying on pnpm’s fallback behavior).
scripts/src/test-stress-scripts.ts:52 - Use
pnpm exec tsxwhen invoking thetsxbinary to avoid relying on package-manager-specific shorthand resolution.
scripts/src/test-stress-scripts.ts:69 pino-prettyis a binary; invoking it viapnpm execis more robust than passing it as a direct pnpm subcommand.
scripts/src/test-example-scripts.ts:62pino-prettyis a binary; invoke it viapnpm execfor consistent behavior across environments.
scripts/src/test-examples-scripts-under-stress.ts:107- Use
pnpm exec tsxwhen invoking thetsxbinary so this doesn’t depend on pnpm’s script-resolution behavior.
This issue also appears on line 156 of the same file.
scripts/src/test-examples-scripts-under-stress.ts:120
pino-prettyis a binary; invoking it viapnpm execis more robust and consistent.
core/wallet-user-rpc-client/package.json:51- Other workspace packages include
repository.directorymetadata for correct source links in npm/GitHub. This package’srepository.directorywas removed; please restore it for consistency and accurate package metadata.
core/wallet-dapp-rpc-client/package.json:51 - Other workspace packages include
repository.directorymetadata for correct source links in npm/GitHub. This package’srepository.directorywas removed; please restore it for consistency and accurate package metadata.
core/wallet-dapp-remote-rpc-client/package.json:51 - Other workspace packages include
repository.directorymetadata for correct source links in npm/GitHub. This package’srepository.directorywas removed; please restore it for consistency and accurate package metadata.
| exec bash -c ' | ||
| PKG_NAME=$(node -p "require(\"./package.json\").name") | ||
| PKG_VER=$(node -p "require(\"./package.json\").version") | ||
|
|
||
| # Ask the registry if this exact version exists | ||
| PUBLISHED_VER=$(npm view "${PKG_NAME}@${PKG_VER}" version 2>/dev/null || echo "") | ||
|
|
||
| if [ "$PUBLISHED_VER" == "$PKG_VER" ]; then | ||
| echo "⏭️ ${PKG_NAME}@${PKG_VER} already published. Skipping." | ||
| else | ||
| echo "🚀 Publishing ${PKG_NAME}@${PKG_VER}..." | ||
| # We execute pnpm publish locally inside the package directory | ||
| pnpm publish --tag $NPM_TAG --no-git-checks | ||
| fi | ||
| ' |
Signed-off-by: Alex Matson <alex.matson@digitalasset.com>
Signed-off-by: Alex Matson <alex.matson@digitalasset.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 166 out of 178 changed files in this pull request and generated 2 comments.
Suppressed comments (3)
.github/actions/setup_pnpm/initial/action.yml:40
pnpm run generate:allis executed without installing dependencies first. On a fresh runner this will fail becausenode_modules/pnpm virtual store isn’t present (and the pnpm cache alone doesn’t install packages). Add apnpm install --frozen-lockfilestep before running any workspace scripts.
docs/CONTRIBUTING.md:11- The prerequisites list says
pnpm 4, but the repo is pinned to pnpm 11 (package.json#packageManager: pnpm@11.20.0) and the root README also references pnpm v11. Update this to avoid onboarding people onto the wrong major version.
README.md:120 - The README claims Node.js 20+, but the repo’s
.nvmrcpins Node v24.9.0 and CI uses Node 24. Update the prerequisite to match the actual required version so local setup doesn’t fail unexpectedly.
Signed-off-by: Alex Matson <alex.matson@digitalasset.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 166 out of 178 changed files in this pull request and generated no new comments.
Suppressed comments (5)
scripts/src/generate-protobufs.ts:64
- This argument uses shell command substitution
$(pnpm bin ...), butexecFileSync('grpc_tools_node_protoc', args)does not invoke a shell, so$(...)will not be expanded and protoc will receive a literal string. Resolve the plugin path in Node and pass the expanded path to--plugin=.
docs/CONTRIBUTING.md:10 - The prerequisites list says "pnpm 4", but the repo root docs and packageManager field indicate pnpm v11. This inconsistency can lead contributors to install the wrong major version.
core/wallet-user-rpc-client/package.json:51 - This package (and most other packages in the repo) includes a
repository.directoryfield to point npm users to the subfolder in the monorepo. It was removed here, which makes metadata inconsistent and less helpful for consumers.
core/wallet-dapp-rpc-client/package.json:51 - This package (and most other packages in the repo) includes a
repository.directoryfield to point npm users to the subfolder in the monorepo. It was removed here, which makes metadata inconsistent and less helpful for consumers.
core/wallet-dapp-remote-rpc-client/package.json:51 - This package (and most other packages in the repo) includes a
repository.directoryfield to point npm users to the subfolder in the monorepo. It was removed here, which makes metadata inconsistent and less helpful for consumers.
Signed-off-by: Alex Matson <alex.matson@digitalasset.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 166 out of 178 changed files in this pull request and generated no new comments.
Suppressed comments (7)
scripts/src/lib/flat-pack.ts:34
FlatPack’s constructor signature was changed (removed theprojectTypeargument), but there is still at least one call site using the old(pkgDir, 'npm', outDir)form (e.g.scripts/src/flat-pack.ts:12). This will cause a runtime/compile-time failure when running the CLI.
docs/CONTRIBUTING.md:10- The prerequisites list says
pnpm 4, but the repo now declarespackageManager: pnpm@11.20.0(and the root README mentions pnpm v11). This version should be updated to avoid confusing contributors and mismatched Corepack installs.
scripts/src/check-migration-lock.ts:88 - The guidance message is missing punctuation/grammar ("edit existing one run ..."), which makes the CLI output harder to read.
scripts/src/test-stress-scripts.ts:69 cmd()splits a command string on spaces and also setsshell: true, which breaks if the script path ever contains spaces (and is inconsistent with the other runner scripts in this repo that pass argv arrays). It’s safer to passbin+argsexplicitly.
scripts/src/lib/flat-pack.ts:77- Reading
package/package.jsonfrom each tarball usesexecSyncwith a shell command string. This is fragile around escaping (and unnecessary sincetarcan be invoked safely with argv). PreferexecFileSync('tar', ['-xzO','-f', tarballPath, 'package/package.json'], { encoding: 'utf8' })to avoid shell parsing/injection issues.
scripts/src/clean-coding.ts:26 - This comment no longer matches the ignore conditions (node_modules/.canton/.cache/etc are now ignored too), which can mislead future edits.
.github/workflows/build.yml:55 - The PR description marks "ci concerns" and "release & publishing" as not addressed, but this PR does update CI workflows/actions and publishing logic (e.g. switching build workflow to
setup_pnpm+pnpm build:all). Please update the PR description/checkboxes to reflect the actual scope so reviewers know CI/release changes are included in this spike.
- uses: ./.github/actions/setup_pnpm/initial
with:
daml_release_version: ${{ needs.version-config.outputs.daml_release_version }}
save_cache: 'true'
- name: Build project
run: pnpm build:all
Signed-off-by: Alex Matson <alex.matson@digitalasset.com>
Signed-off-by: Alex Matson <alex.matson@digitalasset.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 168 out of 180 changed files in this pull request and generated no new comments.
Suppressed comments (4)
scripts/src/generate-protobufs.ts:64
execFileSyncrunsgrpc_tools_node_protocdirectly (no shell), so$()command substitution in the--plugin=...argument will never be expanded. This currently passes the literal string$(pnpm bin ...)to protoc, so the plugin won't be found.
api-specs/README.md:52- Leading
.(source) will try to source a file namedpnpmrather than execute the command. Run pnpm directly here.
core/test-token/README.md:36 - The repo root defines a
generate:test-tokenscript (notscript:generate:test-token). As written, this command will fail when run from the repo root.
api-specs/README.md:43 - Leading
.(source) will try to source a file namedpnpmrather than execute the command. Run pnpm directly here.
This issue also appears on line 52 of the same file.
remove yarn and switch to pnpm for the repo. this pr is a spike to explore the landscape of such a change. I split my approach up into three main areas of impact