Skip to content

chore: migrate to pnpm - #2229

Draft
alexmatson-da wants to merge 11 commits into
mainfrom
alex/pnpm
Draft

chore: migrate to pnpm#2229
alexmatson-da wants to merge 11 commits into
mainfrom
alex/pnpm

Conversation

@alexmatson-da

@alexmatson-da alexmatson-da commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

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

  • local development (build, test, start, ...)
  • ci concerns (caching, testing)
  • release & publishing

Signed-off-by: Alex Matson <alex.matson@digitalasset.com>
Copilot AI lite review requested due to automatic review settings August 4, 2026 19:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.yaml and updates root/workspace scripts and tooling hooks from yarn ... to pnpm ....
  • Centralizes tsdown build defaults in a new tsdown.base.mts and updates package tsdown.config.ts references 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.

Comment thread nx.json Outdated
Comment thread pnpm-workspace.yaml Outdated
Comment thread core/wallet-dapp-rpc-client/package.json
Comment thread scripts/package.json
Comment thread core/wallet-user-rpc-client/package.json Outdated
Comment thread core/wallet-dapp-remote-rpc-client/package.json Outdated
Comment thread core/token-standard/package.json Outdated
Comment thread core/test-token/package.json Outdated
Comment thread core/rpc-generator/templates/client/typescript/_package.json Outdated
Comment thread scripts/src/generate-protobufs.ts
Signed-off-by: Alex Matson <alex.matson@digitalasset.com>
Signed-off-by: Alex Matson <alex.matson@digitalasset.com>
Signed-off-by: Alex Matson <alex.matson@digitalasset.com>
Copilot AI review requested due to automatic review settings August 4, 2026 20:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 tsx via pnpm, prefer pnpm exec tsx to ensure the binary is resolved from the workspace.
    .github/actions/setup_yarn/initial/action.yml:40
  • The composite setup action runs pnpm run generate:all without ensuring dependencies are installed; the CI build will fail unless pnpm/setup implicitly runs an install. Add an explicit pnpm install --frozen-lockfile step 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-lockfile step 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-lockfile before the Generate step.
            - name: Generate
              run: pnpm run generate:all

            - name: Build
              run: pnpm run build:all

package.json:99

  • lint-staged commands should invoke workspace binaries explicitly to avoid ambiguity between scripts vs executables. Using pnpm exec here makes it clear we’re running the installed prettier/eslint binaries.
    core/rpc-generator/src/components/controller.ts:62
  • These hooks appear to be invoking the eslint/prettier binaries. Prefer pnpm exec so the generator doesn’t depend on pnpm’s script-resolution behavior.
    core/rpc-generator/src/components/client.ts:155
  • Use pnpm exec prettier here to unambiguously run the prettier binary (rather than relying on pnpm’s fallback behavior).
    scripts/src/test-stress-scripts.ts:52
  • Use pnpm exec tsx when invoking the tsx binary to avoid relying on package-manager-specific shorthand resolution.
    scripts/src/test-stress-scripts.ts:69
  • pino-pretty is a binary; invoking it via pnpm exec is more robust than passing it as a direct pnpm subcommand.
    scripts/src/test-example-scripts.ts:62
  • pino-pretty is a binary; invoke it via pnpm exec for consistent behavior across environments.
    scripts/src/test-examples-scripts-under-stress.ts:107
  • Use pnpm exec tsx when invoking the tsx binary 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-pretty is a binary; invoking it via pnpm exec is more robust and consistent.
    core/wallet-user-rpc-client/package.json:51
  • Other workspace packages include repository.directory metadata for correct source links in npm/GitHub. This package’s repository.directory was removed; please restore it for consistency and accurate package metadata.
    core/wallet-dapp-rpc-client/package.json:51
  • Other workspace packages include repository.directory metadata for correct source links in npm/GitHub. This package’s repository.directory was removed; please restore it for consistency and accurate package metadata.
    core/wallet-dapp-remote-rpc-client/package.json:51
  • Other workspace packages include repository.directory metadata for correct source links in npm/GitHub. This package’s repository.directory was removed; please restore it for consistency and accurate package metadata.

Comment on lines +64 to +78
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>
Copilot AI review requested due to automatic review settings August 4, 2026 22:42
Signed-off-by: Alex Matson <alex.matson@digitalasset.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:all is executed without installing dependencies first. On a fresh runner this will fail because node_modules/pnpm virtual store isn’t present (and the pnpm cache alone doesn’t install packages). Add a pnpm install --frozen-lockfile step 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 .nvmrc pins 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.

Comment thread .github/actions/setup_pnpm/artifacts/action.yml
Comment thread .github/workflows/publish.yml
Signed-off-by: Alex Matson <alex.matson@digitalasset.com>
Copilot AI review requested due to automatic review settings August 4, 2026 22:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ...), but execFileSync('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.directory field 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.directory field 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.directory field 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>
Copilot AI review requested due to automatic review settings August 4, 2026 23:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 the projectType argument), 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 declares packageManager: 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 sets shell: 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 pass bin + args explicitly.
    scripts/src/lib/flat-pack.ts:77
  • Reading package/package.json from each tarball uses execSync with a shell command string. This is fragile around escaping (and unnecessary since tar can be invoked safely with argv). Prefer execFileSync('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>
Signed-off-by: Alex Matson <alex.matson@digitalasset.com>
Copilot AI review requested due to automatic review settings August 5, 2026 00:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • execFileSync runs grpc_tools_node_protoc directly (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 named pnpm rather than execute the command. Run pnpm directly here.
    core/test-token/README.md:36
  • The repo root defines a generate:test-token script (not script: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 named pnpm rather than execute the command. Run pnpm directly here.

This issue also appears on line 52 of the same file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants