Skip to content

Commit cf9e3d5

Browse files
authored
chore: switch package managers to pnpm (#3475)
* fix: npm audit vulnerabilities * chore: move overrides to root * chore: migrate package to rr7 * chore: migrate package to rr7 * type: excessive casting from llm * chore(deps): remove transitive dep * chore: migrate to pnpm * chore(deps): upgrade turbo * fix: dev:app command * chore: workspace deps * fix: workspace package version replacing * ci: setup pnpm * fix: setup pnpm before node * chore(deps): stable node types version * refactor: reuse packing logic * fix: cli hoisting node deps now broken * ci: remove rebuild, remove types from typeoutput * fix: missing react types declaration * fix: remove jest types, add node types to hydrogen * ci: fix testing library issues * fix: add missing types pacakges * fix: dep * chore: fmt * ci: add esbuild * fix: cli issues * ci: missing packages * chore: overly find and replace * feat: parallelise operations in compile template for dist * chore: repeated overrides * ci: use SHA versioned action * ci: let pnpm version be inferred from package json * chore: move overrides to pnpm-workspace * ci: fix snapit workflow * chore: fmt
1 parent 0880728 commit cf9e3d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+18560
-30405
lines changed

.changeset/test-calver-comparison.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,15 +283,15 @@ cp package.json package.json.backup
283283

284284
# Replace the version script to use raw changeset instead of CalVer script
285285
if command -v perl >/dev/null 2>&1; then
286-
perl -i -pe 's/"version": "npm run version:changeset && node \.changeset\/enforce-calver-ci\.js && npm run version:post && npm run format"/"version": "changeset version"/' package.json
286+
perl -i -pe 's/"version": "pnpm run version:changeset && node \.changeset\/enforce-calver-ci\.js && pnpm run version:post && pnpm run format"/"version": "changeset version"/' package.json
287287
else
288288
# Use portable sed syntax that works on both macOS and Linux
289289
if sed --version 2>/dev/null | grep -q GNU; then
290290
# GNU sed (Linux)
291-
sed -i 's/"version": "npm run version:changeset && node \.changeset\/enforce-calver-ci\.js && npm run version:post && npm run format"/"version": "changeset version"/' package.json
291+
sed -i 's/"version": "pnpm run version:changeset && node \.changeset\/enforce-calver-ci\.js && pnpm run version:post && pnpm run format"/"version": "changeset version"/' package.json
292292
else
293293
# BSD sed (macOS)
294-
sed -i.tmp 's/"version": "npm run version:changeset && node \.changeset\/enforce-calver-ci\.js && npm run version:post && npm run format"/"version": "changeset version"/' package.json
294+
sed -i.tmp 's/"version": "pnpm run version:changeset && node \.changeset\/enforce-calver-ci\.js && pnpm run version:post && pnpm run format"/"version": "changeset version"/' package.json
295295
rm -f package.json.tmp 2>/dev/null || true
296296
fi
297297
fi
@@ -312,7 +312,7 @@ else
312312
fi
313313

314314
# Run standard changeset (now using raw changeset without CalVer)
315-
npm run version > /dev/null 2>&1 || true
315+
pnpm run version > /dev/null 2>&1 || true
316316

317317
# Restore original package.json
318318
mv package.json.backup package.json

.claude/settings.local.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"allow": [
44
"WebFetch(domain:github.com)",
55
"Bash(gh run view:*)",
6-
"Bash(npm test:*)",
6+
"Bash(pnpm test:*)",
77
"Bash(gh pr view:*)",
8-
"Bash(npm run ci:checks:*)",
9-
"Bash(npm run cookbook:*)",
8+
"Bash(pnpm run ci:checks:*)",
9+
"Bash(pnpm run cookbook:*)",
1010
"WebFetch(domain:gist.githubusercontent.com)"
1111
]
1212
},

.cursor/worktrees.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"setup-worktree": ["npm ci"]
2+
"setup-worktree": ["pnpm install --frozen-lockfile"]
33
}

.github/workflows/changesets-reminder.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ jobs:
1616
changelogRegex: "\\.changeset"
1717
message: |
1818
We detected some changes in `packages/*/package.json` or `packages/*/src`, and there are no updates in the `.changeset`.
19-
If the changes are user-facing and should cause a version bump, run `npm run changeset add` to track your changes and include them in the next release CHANGELOG.
19+
If the changes are user-facing and should cause a version bump, run `pnpm run changeset add` to track your changes and include them in the next release CHANGELOG.
2020
If you are making simple updates to examples or documentation, you do not need to add a changeset.

.github/workflows/ci.yml

Lines changed: 61 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,24 @@ jobs:
7676
- name: ⬇️ Checkout repo
7777
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
7878

79+
- name: 📦 Setup pnpm
80+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061
81+
with:
82+
run_install: false
83+
7984
- name: ⎔ Setup node
8085
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
8186
with:
8287
node-version: '22'
83-
cache: 'npm'
84-
cache-dependency-path: '**/package-lock.json'
88+
cache: 'pnpm'
89+
cache-dependency-path: 'pnpm-lock.yaml'
8590

8691
- name: 📥 Install dependencies
8792
run: |
88-
npm ci
89-
npm rebuild
93+
pnpm install --frozen-lockfile
9094
9195
- name: 🔬 Lint
92-
run: npm run lint
96+
run: pnpm run lint
9397

9498
format:
9599
name: ⬣ Prettier
@@ -102,20 +106,24 @@ jobs:
102106
- name: ⬇️ Checkout repo
103107
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
104108

109+
- name: 📦 Setup pnpm
110+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061
111+
with:
112+
run_install: false
113+
105114
- name: ⎔ Setup node
106115
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
107116
with:
108117
node-version: '22'
109-
cache: 'npm'
110-
cache-dependency-path: '**/package-lock.json'
118+
cache: 'pnpm'
119+
cache-dependency-path: 'pnpm-lock.yaml'
111120

112121
- name: 📥 Install dependencies
113122
run: |
114-
npm ci
115-
npm rebuild
123+
pnpm install --frozen-lockfile
116124
117125
- name: 🔬 Check Formatting
118-
run: npm run format:check
126+
run: pnpm run format:check
119127

120128
typecheck:
121129
name: Typescript
@@ -128,17 +136,21 @@ jobs:
128136
- name: ⬇️ Checkout repo
129137
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
130138

139+
- name: 📦 Setup pnpm
140+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061
141+
with:
142+
run_install: false
143+
131144
- name: ⎔ Setup node
132145
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
133146
with:
134147
node-version: '22'
135-
cache: 'npm'
136-
cache-dependency-path: '**/package-lock.json'
148+
cache: 'pnpm'
149+
cache-dependency-path: 'pnpm-lock.yaml'
137150

138151
- name: 📥 Install dependencies
139152
run: |
140-
npm ci
141-
npm rebuild
153+
pnpm install --frozen-lockfile
142154
143155
# Enabling the turbo cache causes deployments to fail intermittently.
144156
# The build step fails with dependency issues. More investigation needed.
@@ -154,13 +166,13 @@ jobs:
154166
# turbo-${{ github.job }}-${{ github.ref_name }}-
155167

156168
- name: 📦 Build packages and templates
157-
run: SHOPIFY_HYDROGEN_FLAG_LOCKFILE_CHECK=false npm run build:all
169+
run: SHOPIFY_HYDROGEN_FLAG_LOCKFILE_CHECK=false pnpm run build:all
158170

159171
- name: ✅ Typecheck
160-
run: SHOPIFY_HYDROGEN_FLAG_LOCKFILE_CHECK=false npm run typecheck
172+
run: SHOPIFY_HYDROGEN_FLAG_LOCKFILE_CHECK=false pnpm run typecheck
161173

162174
- name: 🧑‍💻 CLI manifest check
163-
run: 'test -z "$(git status --porcelain "packages/cli/oclif.manifest.json" )" || { echo -e "Run npm generate:manifest in packages/cli before pushing new commands or flags. Diff here:\n\n$(git diff)" ; exit 1; }'
175+
run: 'test -z "$(git status --porcelain "packages/cli/oclif.manifest.json" )" || { echo -e "Run pnpm --dir packages/cli run generate:manifest before pushing new commands or flags. Diff here:\n\n$(git diff)" ; exit 1; }'
164176

165177
test_e2e:
166178
name: ⬣ E2E tests
@@ -173,23 +185,27 @@ jobs:
173185
- name: ⬇️ Checkout repo
174186
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
175187

188+
- name: 📦 Setup pnpm
189+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061
190+
with:
191+
run_install: false
192+
176193
- name: ⎔ Setup node
177194
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
178195
with:
179196
node-version: '22'
180-
cache: 'npm'
181-
cache-dependency-path: '**/package-lock.json'
197+
cache: 'pnpm'
198+
cache-dependency-path: 'pnpm-lock.yaml'
182199

183200
- name: 📥 Install dependencies
184201
run: |
185-
npm ci
186-
npm rebuild
202+
pnpm install --frozen-lockfile
187203
188204
- name: 📦 Build packages and templates
189-
run: SHOPIFY_HYDROGEN_FLAG_LOCKFILE_CHECK=false npm run build:all
205+
run: SHOPIFY_HYDROGEN_FLAG_LOCKFILE_CHECK=false pnpm run build:all
190206

191207
- name: 🎭 Install Playwright Chromium
192-
run: npx playwright install chromium --with-deps
208+
run: pnpm exec playwright install chromium --with-deps
193209

194210
- name: 🔐 Install ejson
195211
run: |
@@ -199,7 +215,7 @@ jobs:
199215
echo "$HOME/go/bin" >> $GITHUB_PATH
200216
201217
- name: 🧪 Run E2E tests
202-
run: npx playwright test --workers=1
218+
run: pnpm exec playwright test --workers=1
203219
env:
204220
EJSON_PRIVATE_KEY: ${{ secrets.EJSON_PRIVATE_KEY }}
205221

@@ -223,23 +239,27 @@ jobs:
223239
- name: ⬇️ Checkout repo
224240
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
225241

242+
- name: 📦 Setup pnpm
243+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061
244+
with:
245+
run_install: false
246+
226247
- name: ⎔ Setup node
227248
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
228249
with:
229250
node-version: '22'
230-
cache: 'npm'
231-
cache-dependency-path: '**/package-lock.json'
251+
cache: 'pnpm'
252+
cache-dependency-path: 'pnpm-lock.yaml'
232253

233254
- name: 📥 Install dependencies
234255
run: |
235-
npm ci
236-
npm rebuild
256+
pnpm install --frozen-lockfile
237257
238258
- name: 📦 Build packages and templates
239-
run: SHOPIFY_HYDROGEN_FLAG_LOCKFILE_CHECK=false npm run build:all
259+
run: SHOPIFY_HYDROGEN_FLAG_LOCKFILE_CHECK=false pnpm run build:all
240260

241261
- name: 🔬 Test
242-
run: SHOPIFY_HYDROGEN_FLAG_LOCKFILE_CHECK=false npm run test
262+
run: SHOPIFY_HYDROGEN_FLAG_LOCKFILE_CHECK=false pnpm run test
243263

244264
validate_recipes:
245265
name: ⬣ Validate Recipes
@@ -252,25 +272,29 @@ jobs:
252272
- name: ⬇️ Checkout repo
253273
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
254274

275+
- name: 📦 Setup pnpm
276+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061
277+
with:
278+
run_install: false
279+
255280
- name: ⎔ Setup node
256281
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
257282
with:
258283
node-version: '22'
259-
cache: 'npm'
260-
cache-dependency-path: '**/package-lock.json'
284+
cache: 'pnpm'
285+
cache-dependency-path: 'pnpm-lock.yaml'
261286

262287
- name: 📥 Install dependencies
263288
run: |
264-
npm ci
265-
npm rebuild
289+
pnpm install --frozen-lockfile
266290
267291
- name: 📦 Build packages
268-
run: SHOPIFY_HYDROGEN_FLAG_LOCKFILE_CHECK=false npm run build:pkg
292+
run: SHOPIFY_HYDROGEN_FLAG_LOCKFILE_CHECK=false pnpm run build:pkg
269293

270294
- name: 📝 Validate schema
271295
working-directory: cookbook
272-
run: npm run cookbook -- schema && git diff --exit-code recipe.schema.json
296+
run: pnpm run cookbook -- schema && git diff --exit-code recipe.schema.json
273297

274298
- name: 🧐 Validate Recipes
275299
working-directory: cookbook
276-
run: SHOPIFY_HYDROGEN_FLAG_LOCKFILE_CHECK=false npm run cookbook -- validate
300+
run: SHOPIFY_HYDROGEN_FLAG_LOCKFILE_CHECK=false pnpm run cookbook -- validate

.github/workflows/cla.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
|| (github.event.pull_request
1818
&& !github.event.pull_request.merged
1919
&& !contains(github.event.commits.*.message, '[ci] release')
20-
&& !contains(github.event.commits.*.message, '[ci] Update package-lock.json')
20+
&& !contains(github.event.commits.*.message, '[ci] Update pnpm-lock.yaml')
2121
)
2222
steps:
2323
- uses: Shopify/shopify-cla-action@v1

.github/workflows/deploy-examples.yml

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#! oxygen_storefront_id: 1000014888
33

44
name: Deploy Recipe Examples
5-
on:
5+
on:
66
push:
77
branches: [main]
88
pull_request:
@@ -26,76 +26,80 @@ jobs:
2626
runs-on: ubuntu-latest
2727
strategy:
2828
matrix:
29-
recipes:
30-
[
29+
recipes: [
3130
{name: 'metaobjects', token: '1000014928'},
32-
{name: 'third-party-api', token: '1000014929'}, # Replaces third-party-queries-caching
31+
{name: 'third-party-api', token: '1000014929'}, # Replaces third-party-queries-caching
3332
{name: 'custom-cart-method', token: '1000014930'},
3433
{name: 'legacy-customer-account-flow', token: '1000022490'},
3534
]
3635
steps:
3736
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3837

38+
- name: 📦 Setup pnpm
39+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061
40+
with:
41+
run_install: false
42+
3943
- name: ⎔ Setup node
4044
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
4145
with:
4246
node-version: '22'
43-
cache: 'npm'
44-
cache-dependency-path: '**/package-lock.json'
47+
cache: 'pnpm'
48+
cache-dependency-path: 'pnpm-lock.yaml'
4549

4650
- name: Cache node modules
47-
id: cache-npm
51+
id: cache-pnpm
4852
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
4953
env:
5054
cache-name: cache-node-modules
5155
with:
52-
path: ~/.npm
53-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
56+
path: ~/.pnpm-store
57+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('pnpm-lock.yaml') }}
5458
restore-keys: |
5559
${{ runner.os }}-build-${{ env.cache-name }}-
5660
${{ runner.os }}-build-
5761
${{ runner.os }}-
58-
62+
5963
- name: 📥 Install dependencies (root)
60-
run: npm ci
61-
64+
run: pnpm install --frozen-lockfile
65+
6266
- name: 📦 Build packages
6367
run: |
64-
CI=true npm run build:pkg
65-
68+
CI=true pnpm run build:pkg
69+
6670
- name: 📥 Install dependencies (cookbook)
6771
working-directory: cookbook
68-
run: npm ci
69-
72+
run: pnpm install --frozen-lockfile
73+
7074
- name: 🍳 Apply recipe to skeleton
7175
working-directory: cookbook
7276
run: |
7377
echo "Applying recipe: ${{ matrix.recipes.name }}"
74-
npm run cookbook -- apply --recipe ${{ matrix.recipes.name }}
75-
78+
pnpm run cookbook -- apply --recipe ${{ matrix.recipes.name }}
79+
7680
- name: 📥 Install dependencies (skeleton with recipe)
7781
working-directory: templates/skeleton
7882
run: |
7983
# Install in the monorepo context to use workspace packages
80-
npm install
81-
84+
pnpm install --frozen-lockfile
85+
8286
- name: 📝 Generate GraphQL types
8387
working-directory: templates/skeleton
8488
run: |
85-
npm run codegen
86-
89+
pnpm run codegen
90+
8791
- name: 🔨 Build skeleton with recipe
8892
working-directory: templates/skeleton
8993
run: |
90-
SHOPIFY_HYDROGEN_FLAG_LOCKFILE_CHECK=false npm run build
91-
94+
SHOPIFY_HYDROGEN_FLAG_LOCKFILE_CHECK=false pnpm run build
95+
9296
- name: 🚀 Deploy to Oxygen
9397
id: deploy
9498
working-directory: templates/skeleton
9599
run: |
96-
npx shopify hydrogen deploy --force --no-lockfile-check --token=$OXYGEN_DEPLOYMENT_TOKEN_${{ matrix.recipes.token }}
100+
pnpm exec shopify hydrogen deploy --force --no-lockfile-check --token=$OXYGEN_DEPLOYMENT_TOKEN_${{ matrix.recipes.token }}
97101
env:
98-
SHOPIFY_HYDROGEN_FLAG_METADATA_DESCRIPTION: "Recipe: ${{ matrix.recipes.name }} - ${{ github.event.head_commit.message }}"
102+
SHOPIFY_HYDROGEN_FLAG_METADATA_DESCRIPTION: 'Recipe: ${{ matrix.recipes.name }} - ${{ github.event.head_commit.message }}'
99103
OXYGEN_DEPLOYMENT_TOKEN_1000014888: ${{ secrets.OXYGEN_DEPLOYMENT_TOKEN_1000014888 }}
100104
OXYGEN_DEPLOYMENT_TOKEN_1000022490: ${{ secrets.OXYGEN_DEPLOYMENT_TOKEN_1000022490 }}
101105
OXYGEN_DEPLOYMENT_TOKEN_1000014892: ${{ secrets.OXYGEN_DEPLOYMENT_TOKEN_1000014892 }}

0 commit comments

Comments
 (0)