Skip to content

Commit 4a50251

Browse files
authored
Migrate from Yarn to pnpm (blockscout#3323)
* migrate from yarn to pnpm * feature-reporter: migrate from webpack to vite * remove unnecessary deps * bump pnpm to 10.32.1 * fix sitemap and favicon generator tools in docker * review and workflow fixes * fix pw test * update screenshots * update screenshot and add default maxDiffPixels value
1 parent d4ae5a7 commit 4a50251

128 files changed

Lines changed: 31826 additions & 31281 deletions

File tree

Some content is hidden

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

.cursor/hooks.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"hooks": {
44
"afterFileEdit": [
55
{
6-
"command": "yarn eslint --fix ${file}",
6+
"command": "pnpm eslint --fix ${file}",
77
"filter": {
88
"include": ["**/*.{ts,tsx,js,jsx}"]
99
}

.github/workflows/checks.yml

Lines changed: 73 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ permissions:
2222
contents: read
2323
pull-requests: write
2424

25+
# pnpm deps: rely on actions/setup-node cache: pnpm (content-addressable store, keyed on
26+
# pnpm-lock.yaml). Always run pnpm install --frozen-lockfile in each job — with a warm store
27+
# it is mostly linking. Caching only the repo-root node_modules tarball omits workspace
28+
# package node_modules symlinks and breaks tsc/vite in toolkit and deploy/tools/* packages.
29+
2530
jobs:
2631
code_quality:
2732
name: Code quality
@@ -31,39 +36,32 @@ jobs:
3136
- name: Checkout repo
3237
uses: actions/checkout@v4
3338

39+
- name: Install pnpm
40+
uses: pnpm/action-setup@v4
41+
with:
42+
version: 10.32.1
43+
cache: true
44+
3445
- name: Setup node
3546
uses: actions/setup-node@v4
3647
with:
3748
node-version: 22.14.0
38-
cache: 'yarn'
39-
40-
- name: Cache node_modules
41-
uses: actions/cache@v4
42-
id: cache-node-modules
43-
with:
44-
path: |
45-
node_modules
46-
key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
49+
cache: 'pnpm'
4750

4851
- name: Install dependencies
49-
if: steps.cache-node-modules.outputs.cache-hit != 'true'
50-
run: yarn --frozen-lockfile
51-
52-
- name: Generate Chakra types
53-
if: steps.cache-node-modules.outputs.cache-hit == 'true'
54-
run: yarn chakra:typegen
52+
run: pnpm install --frozen-lockfile
5553

5654
- name: Run ESLint
57-
run: yarn lint:eslint
55+
run: pnpm lint:eslint
5856

5957
- name: Compile TypeScript
60-
run: yarn lint:tsc
58+
run: pnpm lint:tsc
6159

6260
- name: Check licenses
63-
run: yarn lint:license:check
61+
run: pnpm lint:license:check
6462

6563
- name: Check spelling
66-
run: yarn lint:cspell --no-progress
64+
run: pnpm lint:cspell --no-progress
6765

6866
toolkit_build_check:
6967
name: Toolkit build check
@@ -73,42 +71,26 @@ jobs:
7371
- name: Checkout repo
7472
uses: actions/checkout@v4
7573

74+
- name: Install pnpm
75+
uses: pnpm/action-setup@v4
76+
with:
77+
version: 10.32.1
78+
cache: true
79+
7680
- name: Setup node
7781
uses: actions/setup-node@v4
7882
with:
7983
node-version: 22.14.0
80-
cache: 'yarn'
81-
82-
- name: Cache node_modules
83-
uses: actions/cache@v4
84-
id: cache-node-modules
85-
with:
86-
path: |
87-
node_modules
88-
key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
84+
cache: 'pnpm'
8985

9086
- name: Install project dependencies
91-
if: steps.cache-node-modules.outputs.cache-hit != 'true'
92-
run: yarn --frozen-lockfile
93-
94-
- name: Generate Chakra types
95-
if: steps.cache-node-modules.outputs.cache-hit == 'true'
96-
run: yarn chakra:typegen
97-
98-
- name: Install package dependencies
99-
run: |
100-
cd ./toolkit/package
101-
yarn --frozen-lockfile
87+
run: pnpm install --frozen-lockfile
10288

10389
- name: Type check the package
104-
run: |
105-
cd ./toolkit/package
106-
yarn typecheck
90+
run: pnpm --filter @blockscout/ui-toolkit typecheck
10791

10892
- name: Build the package
109-
run: |
110-
cd ./toolkit/package
111-
yarn build
93+
run: pnpm --filter @blockscout/ui-toolkit build
11294

11395
- name: Verify build output
11496
run: |
@@ -136,38 +118,23 @@ jobs:
136118
- name: Checkout repo
137119
uses: actions/checkout@v4
138120

121+
- name: Install pnpm
122+
uses: pnpm/action-setup@v4
123+
with:
124+
version: 10.32.1
125+
cache: true
126+
139127
- name: Setup node
140128
uses: actions/setup-node@v4
141129
with:
142130
node-version: 22.14.0
143-
cache: 'yarn'
144-
145-
- name: Cache node_modules
146-
uses: actions/cache@v4
147-
id: cache-node-modules
148-
with:
149-
path: |
150-
node_modules
151-
key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
131+
cache: 'pnpm'
152132

153133
- name: Install dependencies
154-
if: steps.cache-node-modules.outputs.cache-hit != 'true'
155-
run: yarn --frozen-lockfile
156-
157-
- name: Generate Chakra types
158-
if: steps.cache-node-modules.outputs.cache-hit == 'true'
159-
run: yarn chakra:typegen
160-
161-
- name: Install script dependencies
162-
run: cd ./deploy/tools/envs-validator && yarn --frozen-lockfile
134+
run: pnpm install --frozen-lockfile
163135

164136
- name: Run validation tests
165-
run: |
166-
set +e
167-
cd ./deploy/tools/envs-validator && yarn test
168-
exitcode="$?"
169-
echo "exitcode=$exitcode" >> $GITHUB_OUTPUT
170-
exit "$exitcode"
137+
run: pnpm --filter envs-validator test
171138

172139
vitest_tests:
173140
name: Unit tests
@@ -179,30 +146,23 @@ jobs:
179146
with:
180147
fetch-depth: 0
181148

149+
- name: Install pnpm
150+
uses: pnpm/action-setup@v4
151+
with:
152+
version: 10.32.1
153+
cache: true
154+
182155
- name: Setup node
183156
uses: actions/setup-node@v4
184157
with:
185158
node-version: 22.14.0
186-
cache: 'yarn'
187-
188-
- name: Cache node_modules
189-
uses: actions/cache@v4
190-
id: cache-node-modules
191-
with:
192-
path: |
193-
node_modules
194-
key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
159+
cache: 'pnpm'
195160

196161
- name: Install dependencies
197-
if: steps.cache-node-modules.outputs.cache-hit != 'true'
198-
run: yarn --frozen-lockfile
199-
200-
- name: Generate Chakra types
201-
if: steps.cache-node-modules.outputs.cache-hit == 'true'
202-
run: yarn chakra:typegen
162+
run: pnpm install --frozen-lockfile
203163

204164
- name: Run Vitest
205-
run: yarn test:vitest ${{ github.event_name == 'pull_request' && '--changed=origin/main' || '' }} --passWithNoTests
165+
run: pnpm test:vitest ${{ github.event_name == 'pull_request' && '--changed=origin/main' || '' }} --passWithNoTests
206166

207167
pw_affected_tests:
208168
name: Resolve affected Playwright tests
@@ -215,33 +175,23 @@ jobs:
215175
with:
216176
fetch-depth: 0
217177

178+
- name: Install pnpm
179+
uses: pnpm/action-setup@v4
180+
with:
181+
version: 10.32.1
182+
cache: true
183+
218184
- name: Setup node
219185
uses: actions/setup-node@v4
220186
with:
221187
node-version: 22.14.0
222-
cache: 'yarn'
223-
224-
- name: Cache node_modules
225-
uses: actions/cache@v4
226-
id: cache-node-modules
227-
with:
228-
path: |
229-
node_modules
230-
key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
188+
cache: 'pnpm'
231189

232190
- name: Install dependencies
233-
if: steps.cache-node-modules.outputs.cache-hit != 'true'
234-
run: yarn --frozen-lockfile
235-
236-
- name: Generate Chakra types
237-
if: steps.cache-node-modules.outputs.cache-hit == 'true'
238-
run: yarn chakra:typegen
239-
240-
- name: Install script dependencies
241-
run: cd ./deploy/tools/affected-tests && yarn --frozen-lockfile
191+
run: pnpm install --frozen-lockfile
242192

243193
- name: Run script
244-
run: yarn test:pw:detect-affected
194+
run: pnpm test:pw:detect-affected
245195

246196
- name: Upload result file
247197
uses: actions/upload-artifact@v5
@@ -276,27 +226,20 @@ jobs:
276226
with:
277227
lfs: 'true'
278228

229+
- name: Install pnpm
230+
uses: pnpm/action-setup@v4
231+
with:
232+
version: 10.32.1
233+
cache: true
234+
279235
- name: Setup node
280236
uses: actions/setup-node@v4
281237
with:
282238
node-version: 22.14.0
283-
cache: 'yarn'
284-
285-
- name: Cache node_modules
286-
uses: actions/cache@v4
287-
id: cache-node-modules
288-
with:
289-
path: |
290-
node_modules
291-
key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
239+
cache: 'pnpm'
292240

293241
- name: Install dependencies
294-
if: steps.cache-node-modules.outputs.cache-hit != 'true'
295-
run: yarn --frozen-lockfile
296-
297-
- name: Generate Chakra types
298-
if: steps.cache-node-modules.outputs.cache-hit == 'true'
299-
run: yarn chakra:typegen
242+
run: pnpm install --frozen-lockfile
300243

301244
- name: Download affected tests list
302245
if: ${{ needs.pw_affected_tests.result == 'success' }}
@@ -307,7 +250,7 @@ jobs:
307250
path: ./playwright
308251

309252
- name: Run PlayWright
310-
run: yarn test:pw:ci --affected=${{ github.event_name == 'pull_request' }} --pass-with-no-tests
253+
run: pnpm test:pw:ci --affected=${{ github.event_name == 'pull_request' }} --pass-with-no-tests
311254
env:
312255
HOME: /root
313256
PW_PROJECT: ${{ matrix.project }}
@@ -349,25 +292,23 @@ jobs:
349292
if: steps.check-reports.outputs.has_reports == 'true'
350293
uses: actions/checkout@v4
351294

352-
- name: Setup node
295+
- name: Install pnpm
353296
if: steps.check-reports.outputs.has_reports == 'true'
354-
uses: actions/setup-node@v4
297+
uses: pnpm/action-setup@v4
355298
with:
356-
node-version: 22.14.0
357-
cache: 'yarn'
299+
version: 10.32.1
300+
cache: true
358301

359-
- name: Cache node_modules
302+
- name: Setup node
360303
if: steps.check-reports.outputs.has_reports == 'true'
361-
uses: actions/cache@v4
362-
id: cache-node-modules
304+
uses: actions/setup-node@v4
363305
with:
364-
path: |
365-
node_modules
366-
key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
306+
node-version: 22.14.0
307+
cache: 'pnpm'
367308

368309
- name: Install dependencies
369-
if: steps.check-reports.outputs.has_reports == 'true' && steps.cache-node-modules.outputs.cache-hit != 'true'
370-
run: yarn --frozen-lockfile
310+
if: steps.check-reports.outputs.has_reports == 'true'
311+
run: pnpm install --frozen-lockfile
371312

372313
- name: Merge into HTML Report
373314
if: steps.check-reports.outputs.has_reports == 'true'

.github/workflows/toolkit-npm-publisher.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,18 @@ jobs:
2626
- name: Checkout repo
2727
uses: actions/checkout@v4
2828

29+
- name: Install pnpm
30+
uses: pnpm/action-setup@v4
31+
with:
32+
version: 10.32.1
33+
2934
# Also it will setup .npmrc file to publish to npm
3035
- name: Setup node
3136
uses: actions/setup-node@v4
3237
with:
3338
node-version: '22.14.0'
3439
registry-url: 'https://registry.npmjs.org'
40+
cache: 'pnpm'
3541

3642
# Ensure npm 11.5.1 is installed
3743
- name: Update npm
@@ -41,13 +47,11 @@ jobs:
4147
run: |
4248
cd ./toolkit/package
4349
npm version ${{ inputs.version }}
44-
45-
- name: Build the package
50+
51+
- name: Install dependencies and build the package
4652
run: |
47-
yarn
48-
cd ./toolkit/package
49-
yarn
50-
yarn build
53+
pnpm install --frozen-lockfile
54+
pnpm --filter @blockscout/ui-toolkit build
5155
5256
- name: Publish to NPM registry
5357
run: |

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
# dependencies
44
/node_modules
55
/node_modules_linux
6+
/**/node_modules_linux
67
/.pnp
78
.pnp.js
9+
.pnpm-store
810

911
# testing
1012
/coverage
@@ -38,8 +40,6 @@ grafana
3840

3941
# debug
4042
npm-debug.log*
41-
yarn-debug.log*
42-
yarn-error.log*
4343
.pnpm-debug.log*
4444

4545
# local env files

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Enables `pnpm deploy` for workspace packages (pnpm 10+). See https://pnpm.io/cli/deploy
2+
inject-workspace-packages=true

0 commit comments

Comments
 (0)