Skip to content

Migrate from Yarn to pnpm#469

Merged
kieran-osgood-shopify merged 2 commits intomainfrom
river/migrate-yarn-to-pnpm
May 1, 2026
Merged

Migrate from Yarn to pnpm#469
kieran-osgood-shopify merged 2 commits intomainfrom
river/migrate-yarn-to-pnpm

Conversation

@kieran-osgood-shopify
Copy link
Copy Markdown
Contributor

Converts the repo from Yarn v4 (.yarnrc.yml) to pnpm 10.28.0. Lockfile was imported via pnpm import to preserve resolved versions, then re-resolved to sync with each package.json.

Changes:

  • Replace yarn.lock with pnpm-lock.yaml; drop .yarnrc.yml and .yarn/.
  • Add pnpm-workspace.yaml (replaces root package.json#workspaces).
  • Add "packageManager": "pnpm@10.28.0" to root package.json.
  • Add pnpm.onlyBuiltDependencies for unrs-resolver so its postinstall runs (pnpm ignores build scripts by default).
  • Add .npmrc with node-linker=hoisted to preserve the flat node_modules layout React Native / Metro / CocoaPods / Gradle expect (mirrors the old .yarnrc.yml nodeLinker: node-modules), plus frozen-lockfile=true.
  • sample package.json: @shopify/checkout-sheet-kit now uses workspace:* instead of link:../modules/... (the pnpm-native equivalent).
  • Rewrite root scripts: yarn workspace <name> -> pnpm --filter <name>.
  • Swap yarn for pnpm across dev.yml, setup action, scripts, and CONTRIBUTING.md. README keeps yarn/npm install hints for end users installing the published package.
  • dev.yml: node task uses package_manager: pnpm@10.28.0 instead of yarn: 1.22.22.
  • Setup action: drop the custom yarn cache, add pnpm/action-setup and use cache: pnpm on setup-node. Drop the npm install -g npm@11 workaround since pnpm handles it.
  • Cocoapods cache key now hashes pnpm-lock.yaml.

Workflow file changes (ci.yml, publish.yml) are excluded from this commit because the GitHub App doesn't have the workflows permission on this repo. See the PR body for a patch to apply.

Requested by Kieran Osgood kieran.osgood@shopify.com

What changes are you making?


PR Checklist

Important

Releasing a new version of the kit?


Tip

See the Contributing documentation for instructions on how to publish a new version of the library.

Copy link
Copy Markdown
Contributor Author

kieran-osgood-shopify commented Apr 22, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 22, 2026

Coverage Report

Lines Statements Branches Functions
Coverage: 99%
99.53% (212/213) 97.54% (119/122) 100% (61/61)

Converts the repo from Yarn v4 (.yarnrc.yml) to pnpm 10.28.0. Lockfile
was imported via `pnpm import` to preserve resolved versions, then
re-resolved to sync with each package.json.

Changes:

- Replace yarn.lock with pnpm-lock.yaml; drop .yarnrc.yml and .yarn/.
- Add pnpm-workspace.yaml (replaces root package.json#workspaces).
- Add "packageManager": "pnpm@10.28.0" to root package.json.
- Add pnpm.onlyBuiltDependencies for unrs-resolver so its postinstall
  runs (pnpm ignores build scripts by default).
- Add .npmrc with `node-linker=hoisted` to preserve the flat
  node_modules layout React Native / Metro / CocoaPods / Gradle expect
  (mirrors the old .yarnrc.yml `nodeLinker: node-modules`), plus
  `frozen-lockfile=true`.
- sample package.json: `@shopify/checkout-sheet-kit` now uses
  `workspace:*` instead of `link:../modules/...` (the pnpm-native
  equivalent).
- Rewrite root scripts: `yarn workspace <name>` -> `pnpm --filter <name>`.
- Swap `yarn` for `pnpm` across dev.yml, setup action, scripts, and
  CONTRIBUTING.md. README keeps yarn/npm install hints for end users
  installing the published package.
- dev.yml: node task uses `package_manager: pnpm@10.28.0` instead of
  `yarn: 1.22.22`.
- Setup action: drop the custom yarn cache, add `pnpm/action-setup`
  and use `cache: pnpm` on setup-node. Drop the `npm install -g npm@11`
  workaround since pnpm handles it.
- Cocoapods cache key now hashes pnpm-lock.yaml.

Workflow file changes (ci.yml, publish.yml) are excluded from this
commit because the GitHub App doesn't have the `workflows`
permission on this repo. See the PR body for a patch to apply.

Requested by Kieran Osgood <kieran.osgood@shopify.com>
@kieran-osgood-shopify kieran-osgood-shopify changed the base branch from cx-rn-new-arch-v4 to graphite-base/469 May 1, 2026 10:18
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the river/migrate-yarn-to-pnpm branch from 46c8b4f to 05a1ef1 Compare May 1, 2026 10:18
@kieran-osgood-shopify kieran-osgood-shopify changed the base branch from graphite-base/469 to main May 1, 2026 10:18
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the river/migrate-yarn-to-pnpm branch from 05a1ef1 to afe41c0 Compare May 1, 2026 14:48
Address feedback: make package.json the single source of truth for node
and pnpm versions where possible, and bump pnpm to the latest release.

- package.json: bump `packageManager` to `pnpm@10.33.1` (pinned with
  the upstream sha512 integrity hash so corepack/pnpm verify the binary).
- package.json: tighten `engines.node` from `>=22` to `22.14.0` so
  dev's built-in node-version validator catches any drift against
  dev.yml on every `dev up`.
- dev.yml: bump to `package_manager: pnpm@10.33.1` and add a comment
  noting the versions must stay in lockstep with package.json.
- .github/actions/setup: read node from `engines.node` via
  `node-version-file: package.json`, and let `pnpm/action-setup`
  read the version from the `packageManager` field (drop the hardcoded
  `version: 10.28.0` and `node-version: 22.22.1`).

dev.yml itself is plain YAML (no ERB/interpolation) and the node task
requires an explicit `version:` + `package_manager:`, so full
deduplication into a single literal isn't supported upstream. Every
other pnpm-using zone in World mirrors the value. The setup we have
here — package.json as SoT, dev's validator as the enforcer, CI
reading directly from package.json — is the closest equivalent.

Requested by Kieran Osgood <kieran.osgood@shopify.com>
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the river/migrate-yarn-to-pnpm branch from afe41c0 to 64008fd Compare May 1, 2026 14:56
@kieran-osgood-shopify kieran-osgood-shopify marked this pull request as ready for review May 1, 2026 15:09
@kieran-osgood-shopify kieran-osgood-shopify requested a review from a team as a code owner May 1, 2026 15:09
Comment thread package.json
},
"engines": {
"node": ">=22"
"node": "22.14.0"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

explicit version means dev.yml will enforce this version

Comment on lines -26 to -37
- name: Cache dependencies
id: yarn-cache
uses: actions/cache@v4
with:
path: |
**/node_modules
.yarn/install-state.gz
key:
${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
${{ runner.os }}-yarn-
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We already caching somewhere else?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the setup node step has built in cache for pnpm

 - name: Setup Node.js
      uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2
      with:
        node-version-file: package.json
        registry-url: 'https://registry.npmjs.org'
        cache: pnpm

@markmur
Copy link
Copy Markdown
Contributor

markmur commented May 1, 2026

Thank you for taking care of this 🙌

@kieran-osgood-shopify kieran-osgood-shopify merged commit 83edbc5 into main May 1, 2026
8 checks passed
@kieran-osgood-shopify kieran-osgood-shopify deleted the river/migrate-yarn-to-pnpm branch May 1, 2026 15:38
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.

3 participants