Skip to content

Commit 847837e

Browse files
authored
chore: migrate yarn 1 to pnpm (#8646)
**Motivation** Use the latest package manager which is more aligned with multi-runtime support. **Description** - Migrate yarn.lock file to pnpm-lock.yaml (`pnpm import`) - Update the scripts to use pnpm - Update the workflows to use pnpm **Steps to test or reproduce** - Run all tests **Useful commands migraiton** | Yarn 1 | pnpm | |---|---| | yarn | pnpm install | | yarn add dep | pnpm add dep | | yarn workspace "@lodestar/config" add dep | pnpm add dep --filter "@lodestar/config" | | yarn workspace foreach run build | pnpm -r build |
1 parent 100ab48 commit 847837e

Some content is hidden

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

76 files changed

+26570
-22162
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// "forwardPorts": [],
1616

1717
// Use 'postCreateCommand' to run commands after the container is created.
18-
// "postCreateCommand": "yarn install",
18+
// "postCreateCommand": "pnpm install",
1919

2020
// Configure tool-specific properties.
2121
// "customizations": {},

.github/actions/setup-and-build/action.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ inputs:
88
runs:
99
using: "composite"
1010
steps:
11+
- uses: pnpm/action-setup@v4
12+
1113
- name: Setup Node
12-
uses: actions/setup-node@v4
14+
uses: actions/setup-node@v6
1315
with:
1416
node-version: ${{inputs.node}}
1517
check-latest: true
16-
# The hash of yarn.lock file will be used as cache key
17-
# So unless our dependencies change, we can reuse the cache
18-
cache: yarn
18+
# Due to a known issue we have to disable package caching for now
19+
# https://github.com/pnpm/pnpm/issues/6234
20+
# cache: pnpm
21+
package-manager-cache: false
1922

2023
- name: Node.js version
2124
id: node
@@ -40,19 +43,19 @@ runs:
4043

4144
- name: Install & build
4245
shell: bash
43-
run: yarn install --frozen-lockfile && yarn build
46+
run: pnpm install --frozen-lockfile && pnpm build
4447

4548
- name: Check Build
4649
shell: bash
47-
run: yarn check-build
50+
run: pnpm check-build
4851

4952
- name: Build bundle
5053
shell: bash
51-
run: yarn build:bundle
54+
run: pnpm build:bundle
5255

5356
- name: Check bundle
5457
shell: bash
55-
run: yarn check-bundle
58+
run: pnpm check-bundle
5659

5760
- name: Cache build artifacts
5861
uses: actions/cache@v4

.github/workflows/benchmark.yml

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,9 @@ jobs:
3131
steps:
3232
# <common-build> - Uses YAML anchors in the future
3333
- uses: actions/checkout@v4
34-
- uses: actions/setup-node@v4
34+
- uses: "./.github/actions/setup-and-build"
3535
with:
36-
node-version: 24
37-
check-latest: true
38-
cache: yarn
39-
- name: Node.js version
40-
id: node
41-
run: echo "v8CppApiVersion=$(node --print "process.versions.modules")" >> $GITHUB_OUTPUT
42-
- name: Restore dependencies
43-
uses: actions/cache@v4
44-
id: cache-deps
45-
with:
46-
path: |
47-
node_modules
48-
packages/*/node_modules
49-
key: ${{ runner.os }}-${{ steps.node.outputs.v8CppApiVersion }}-${{ hashFiles('**/yarn.lock', '**/package.json') }}
50-
- name: Install & build
51-
if: steps.cache-deps.outputs.cache-hit != 'true'
52-
run: yarn install --frozen-lockfile && yarn build
53-
- name: Build
54-
run: yarn build
55-
if: steps.cache-deps.outputs.cache-hit == 'true'
36+
node: 24
5637
# </common-build>
5738

5839
# Restore performance downloaded states
@@ -63,7 +44,7 @@ jobs:
6344
key: perf-states-${{ hashFiles('packages/state-transition/test/perf/params.ts') }}
6445

6546
- name: Run benchmarks
66-
run: yarn benchmark
47+
run: pnpm benchmark
6748
env:
6849
# To download content for tests
6950
INFURA_ETH2_CREDENTIALS: ${{ secrets.INFURA_ETH2_CREDENTIALS }}

.github/workflows/binaries.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,8 @@ jobs:
3131
- name: Install arm64 specifics
3232
if: matrix.arch == 'arm64'
3333
run: |-
34-
# Install missing yarn
35-
# See https://github.com/github-early-access/arm-runners-beta/issues/5
36-
curl -fsSL --create-dirs -o $HOME/bin/yarn \
37-
https://github.com/yarnpkg/yarn/releases/download/v1.22.22/yarn-1.22.22.js
38-
chmod +x $HOME/bin/yarn
39-
echo "$HOME/bin" >> $GITHUB_PATH
34+
# Install missing pnpm
35+
curl -fsSL https://get.pnpm.io/install.sh | sh -
4036
# Install missing build-essential
4137
sudo apt-get update
4238
sudo apt-get install -y build-essential python3
@@ -45,8 +41,8 @@ jobs:
4541
node: 24
4642
- run: |
4743
mkdir -p dist
48-
yarn global add @chainsafe/[email protected]
49-
npx caxa -m "Unpacking Lodestar binary, please wait..." -e "dashboards/**" -e "docs/**" -D -p "yarn install --frozen-lockfile --production" --input . --output "lodestar" -- "{{caxa}}/node_modules/.bin/node" "--max-old-space-size=8192" "{{caxa}}/node_modules/.bin/lodestar"
44+
pnpm add -g @chainsafe/[email protected]
45+
npx caxa -m "Unpacking Lodestar binary, please wait..." -e "dashboards/**" -e "docs/**" -D -p "pnpm install --frozen-lockfile --production" --input . --output "lodestar" -- "{{caxa}}/node_modules/.bin/node" "--max-old-space-size=8192" "{{caxa}}/node_modules/.bin/lodestar"
5046
tar -czf "dist/lodestar-${{ inputs.version }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz" "lodestar"
5147
- name: Upload binaries
5248
uses: actions/upload-artifact@v4

.github/workflows/docs-check.yml

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,19 @@ jobs:
1313
steps:
1414
# <common-build> - Uses YAML anchors in the future
1515
- uses: actions/checkout@v4
16-
- uses: actions/setup-node@v4
16+
- uses: "./.github/actions/setup-and-build"
1717
with:
18-
node-version: 24
19-
cache: yarn
20-
- name: Node.js version
21-
id: node
22-
run: echo "v8CppApiVersion=$(node --print "process.versions.modules")" >> $GITHUB_OUTPUT
23-
- name: Restore dependencies
24-
uses: actions/cache@v4
25-
id: cache-deps
26-
with:
27-
path: |
28-
node_modules
29-
packages/*/node_modules
30-
key: ${{ runner.os }}-${{ steps.node.outputs.v8CppApiVersion }}-${{ hashFiles('**/yarn.lock', '**/package.json') }}
31-
- name: Install & build
32-
if: steps.cache-deps.outputs.cache-hit != 'true'
33-
run: yarn install --frozen-lockfile && yarn build
34-
- name: Build
35-
run: yarn build
36-
if: steps.cache-deps.outputs.cache-hit == 'true'
18+
node: 24
3719

3820
- name: Check wordlist is sorted
3921
run: scripts/wordlist_sort_check.sh
4022

4123
- name: Build and collect docs
42-
run: yarn docs:build
24+
run: pnpm docs:build
4325

4426
# Run prettier check after generating the docs
4527
- name: Check docs format
46-
run: yarn docs:lint
28+
run: pnpm docs:lint
4729

4830
# Run spellcheck AFTER building docs, in case the CLI reference has issues
4931
- name: Spellcheck

.github/workflows/docs.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,14 @@ jobs:
2929
with:
3030
ref: ${{ env.DEPLOY_REF }}
3131

32-
- uses: actions/setup-node@v4
32+
- name: Install pnpm before setup node
33+
uses: pnpm/action-setup@v4
34+
35+
- uses: actions/setup-node@v6
3336
with:
3437
node-version: 24
3538
check-latest: true
36-
cache: yarn
39+
cache: pnpm
3740

3841
- name: Node.js version
3942
id: node
@@ -46,25 +49,25 @@ jobs:
4649
path: |
4750
node_modules
4851
packages/*/node_modules
49-
key: ${{ runner.os }}-${{ steps.node.outputs.v8CppApiVersion }}-${{ hashFiles('**/yarn.lock', '**/package.json') }}
52+
key: ${{ runner.os }}-${{ steps.node.outputs.v8CppApiVersion }}-${{ hashFiles('**/pnpm-lock.yaml', '**/package.json') }}
5053

5154
- name: Install & build
5255
if: steps.cache-deps.outputs.cache-hit != 'true'
53-
run: yarn install --frozen-lockfile && yarn build
56+
run: pnpm install --frozen-lockfile && pnpm build
5457

5558
- name: Build
56-
run: yarn build
59+
run: pnpm build
5760
if: steps.cache-deps.outputs.cache-hit == 'true'
5861

5962
- name: Build and collect docs
60-
run: yarn docs:build
63+
run: pnpm docs:build
6164

6265
- name: Lint built docs
63-
run: yarn docs:lint:fix
66+
run: pnpm docs:lint:fix
6467

6568
- name: Build docs
6669
working-directory: docs
67-
run: yarn && yarn build
70+
run: pnpm && pnpm build
6871

6972
- name: Deploy
7073
uses: peaceiris/actions-gh-pages@v3

.github/workflows/publish-dev.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,16 @@ jobs:
2222
- uses: actions/checkout@v6
2323
with:
2424
fetch-depth: 0
25-
- uses: actions/setup-node@v4
25+
26+
- name: Install pnpm before setup node
27+
uses: pnpm/action-setup@v4
28+
29+
- uses: actions/setup-node@v6
2630
with:
2731
node-version: 24
2832
registry-url: "https://registry.npmjs.org"
2933
check-latest: true
30-
cache: yarn
34+
cache: pnpm
3135
- name: Node.js version
3236
id: node
3337
run: echo "v8CppApiVersion=$(node --print "process.versions.modules")" >> $GITHUB_OUTPUT
@@ -38,12 +42,12 @@ jobs:
3842
path: |
3943
node_modules
4044
packages/*/node_modules
41-
key: ${{ runner.os }}-${{ steps.node.outputs.v8CppApiVersion }}-${{ hashFiles('**/yarn.lock', '**/package.json') }}
45+
key: ${{ runner.os }}-${{ steps.node.outputs.v8CppApiVersion }}-${{ hashFiles('**/pnpm-lock.yaml', '**/package.json') }}
4246
- name: Install & build
4347
if: steps.cache-deps.outputs.cache-hit != 'true'
44-
run: yarn install --frozen-lockfile && yarn build
48+
run: pnpm install --frozen-lockfile && pnpm build
4549
- name: Build
46-
run: yarn build
50+
run: pnpm build
4751
if: steps.cache-deps.outputs.cache-hit == 'true'
4852
# </common-build>
4953
- name: Get version
@@ -61,7 +65,7 @@ jobs:
6165
# This "temp" commit doesn't change the actually release commit which is captured above.
6266
# git-data is also correct, since it's generated at build time, before `lerna version` run.
6367
run: |
64-
yarn lerna version ${{ steps.version.outputs.version }} \
68+
pnpm lerna version ${{ steps.version.outputs.version }} \
6569
--force-publish \
6670
--exact \
6771
--yes \
@@ -96,7 +100,7 @@ jobs:
96100
#
97101
# NOTE: Using --preid dev.$(git rev-parse --short=7 HEAD) results in `0.24.3-dev.3ddb91d.0+3ddb91d`
98102
run: |
99-
yarn lerna publish from-package \
103+
pnpm lerna publish from-package \
100104
--yes \
101105
--no-verify-access \
102106
--dist-tag next \

.github/workflows/publish-nextfork.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ jobs:
2525
- uses: actions/checkout@v6
2626
with:
2727
fetch-depth: 0
28-
- uses: actions/setup-node@v4
28+
- name: Install pnpm before setup node
29+
uses: pnpm/action-setup@v4
30+
- uses: actions/setup-node@v6
2931
with:
3032
node-version: 24
3133
registry-url: "https://registry.npmjs.org"
3234
check-latest: true
33-
cache: yarn
35+
cache: pnpm
3436
- name: Node.js version
3537
id: node
3638
run: echo "v8CppApiVersion=$(node --print "process.versions.modules")" >> $GITHUB_OUTPUT
@@ -41,12 +43,12 @@ jobs:
4143
path: |
4244
node_modules
4345
packages/*/node_modules
44-
key: ${{ runner.os }}-${{ steps.node.outputs.v8CppApiVersion }}-${{ hashFiles('**/yarn.lock', '**/package.json') }}
46+
key: ${{ runner.os }}-${{ steps.node.outputs.v8CppApiVersion }}-${{ hashFiles('**/pnpm-lock.yaml', '**/package.json') }}
4547
- name: Install & build
4648
if: steps.cache-deps.outputs.cache-hit != 'true'
47-
run: yarn install --frozen-lockfile && yarn build
49+
run: pnpm install --frozen-lockfile && pnpm build
4850
- name: Build
49-
run: yarn build
51+
run: pnpm build
5052
if: steps.cache-deps.outputs.cache-hit == 'true'
5153
# </common-build>
5254
- name: Get version
@@ -64,7 +66,7 @@ jobs:
6466
# This "temp" commit doesn't change the actually release commit which is captured above.
6567
# git-data is also correct, since it's generated at build time, before `lerna version` run.
6668
run: |
67-
yarn lerna version ${{ steps.version.outputs.version }} \
69+
pnpm lerna version ${{ steps.version.outputs.version }} \
6870
--force-publish \
6971
--exact \
7072
--yes \
@@ -99,7 +101,7 @@ jobs:
99101
#
100102
# NOTE: Using --preid dev.$(git rev-parse --short=7 HEAD) results in `0.24.3-dev.3ddb91d.0+3ddb91d`
101103
run: |
102-
yarn lerna publish from-package \
104+
pnpm lerna publish from-package \
103105
--yes \
104106
--no-verify-access \
105107
--dist-tag next \

.github/workflows/publish-rc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
# This "temp" commit doesn't change the actually release commit which is captured above.
9696
# git-data is also correct, since it's generated at build time, before `lerna version` run.
9797
run: |
98-
yarn lerna version ${{ needs.tag.outputs.version }} \
98+
pnpm lerna version ${{ needs.tag.outputs.version }} \
9999
--force-publish \
100100
--exact \
101101
--yes \
@@ -106,7 +106,7 @@ jobs:
106106
git commit -am "${{ needs.tag.outputs.version }}"
107107
108108
- name: Publish to npm registry
109-
run: yarn run release:publish --dist-tag rc
109+
run: pnpm run release:publish --dist-tag rc
110110

111111
# In case of failure
112112
- name: Rollback on failure

.github/workflows/publish-stable.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
prerelease: false
9797

9898
- name: Publish to npm registry (release)
99-
run: yarn run release:publish
99+
run: pnpm run release:publish
100100

101101
# In case of failure
102102
- name: Rollback on failure

0 commit comments

Comments
 (0)