Skip to content

Commit e8b31e3

Browse files
committed
chore(monorepo): migrate from Yarn to pnpm
Replace Yarn 4 workspaces with pnpm@11.5.1 across apps, packages, proxies, CI, Docker, and Azure pipelines. - Use hoisted node-linker for Next.js standalone tracing compatibility - Scope Docker builds with pnpm --filter to reduce build memory usage - Upgrade CI and Docker to Node 24 and pnpm-native tooling - Align Docker dev container port with UBI Node 24 base image (8080); docker-compose still publishes localhost:3000 to the host Refs: RATY-334, HH-486, TH-1474, LIIKUNTA-783
1 parent 23d9046 commit e8b31e3

77 files changed

Lines changed: 34446 additions & 28314 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.

.dockerignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ node_modules
1717
tsconfig.tsbuildinfo
1818
.eslintcache
1919

20-
# Yarn
21-
!.yarnrc.yml
22-
!.yarn/plugins
23-
!.yarn/releases
20+
# pnpm
21+
!pnpm-lock.yaml
22+
!pnpm-workspace.yaml
2423

2524
# Used when building with nextjs (next-eslint)
2625
!eslint.config.base.json

.github/dependabot.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
version: 2
22
updates:
3-
- package-ecosystem: "npm"
4-
directory: "/"
3+
- package-ecosystem: 'pnpm'
4+
directory: '/'
55
schedule:
6-
interval: "daily"
6+
interval: 'daily'
77
commit-message:
8-
prefix: "deps"
8+
prefix: 'deps'
99
# Disable version updates and only allow security updates
1010
open-pull-requests-limit: 0

.github/workflows/ci-events-graphql-proxy-check.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ on:
66
# Only consider those paths to trigger the action
77
paths:
88
- 'proxies/events-graphql-proxy/**'
9-
- '.yarnrc.yml'
9+
- 'pnpm-workspace.yaml'
10+
- 'pnpm-lock.yaml'
1011
- 'tsconfig.base.json'
1112
- '.prettier*'
1213
- '.github/workflows/ci-events-graphql-proxy-check.yml'
@@ -16,18 +17,19 @@ on:
1617
# Only consider those paths to trigger the action
1718
paths:
1819
- 'proxies/events-graphql-proxy/**'
19-
- '.yarnrc.yml'
20+
- 'pnpm-workspace.yaml'
21+
- 'pnpm-lock.yaml'
2022
- 'tsconfig.base.json'
2123
- '.prettier*'
2224
- '.github/workflows/ci-events-graphql-proxy-check.yml'
2325
workflow_dispatch:
2426

2527
jobs:
2628
common:
27-
uses: City-of-Helsinki/.github/.github/workflows/ci-node.yml@main
29+
uses: City-of-Helsinki/.github/.github/workflows/ci-pnpm-node.yml@main
2830
secrets: inherit
2931
with:
30-
node-version: 22
32+
node-version: '24'
3133
typecheck: true
3234
app-directory: proxies/events-graphql-proxy
3335
extra-commands: |

.github/workflows/ci-events-helsinki-check.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ on:
88
- 'apps/events-helsinki/**'
99
- 'packages/components/**'
1010
- 'packages/common-i18n/**'
11-
- '.yarnrc.yml'
11+
- 'pnpm-workspace.yaml'
12+
- 'pnpm-lock.yaml'
1213
- 'tsconfig.base.json'
1314
- '.prettier*'
1415
- '.github/workflows/ci-events-helsinki-check.yml'
@@ -20,7 +21,8 @@ on:
2021
- 'apps/events-helsinki/**'
2122
- 'packages/components/**'
2223
- 'packages/common-i18n/**'
23-
- '.yarnrc.yml'
24+
- 'pnpm-workspace.yaml'
25+
- 'pnpm-lock.yaml'
2426
- 'tsconfig.base.json'
2527
- '.prettier*'
2628
- '.github/workflows/ci-events-helsinki-check.yml'
@@ -33,10 +35,10 @@ env:
3335

3436
jobs:
3537
common:
36-
uses: City-of-Helsinki/.github/.github/workflows/ci-node.yml@main
38+
uses: City-of-Helsinki/.github/.github/workflows/ci-pnpm-node.yml@main
3739
secrets: inherit
3840
with:
39-
node-version: 22
41+
node-version: '24'
4042
typecheck: true
4143
app-directory: apps/events-helsinki
4244
extra-commands: |

.github/workflows/ci-hobbies-helsinki-check.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ on:
88
- 'apps/hobbies-helsinki/**'
99
- 'packages/components/**'
1010
- 'packages/common-i18n/**'
11-
- '.yarnrc.yml'
11+
- 'pnpm-workspace.yaml'
12+
- 'pnpm-lock.yaml'
1213
- 'tsconfig.base.json'
1314
- '.prettier*'
1415
- '.github/workflows/ci-hobbies-helsinki-check.yml'
@@ -20,18 +21,19 @@ on:
2021
- 'apps/hobbies-helsinki/**'
2122
- 'packages/components/**'
2223
- 'packages/common-i18n/**'
23-
- '.yarnrc.yml'
24+
- 'pnpm-workspace.yaml'
25+
- 'pnpm-lock.yaml'
2426
- 'tsconfig.base.json'
2527
- '.prettier*'
2628
- '.github/workflows/ci-hobbies-helsinki-check.yml'
2729
workflow_dispatch:
2830

2931
jobs:
3032
common:
31-
uses: City-of-Helsinki/.github/.github/workflows/ci-node.yml@main
33+
uses: City-of-Helsinki/.github/.github/workflows/ci-pnpm-node.yml@main
3234
secrets: inherit
3335
with:
34-
node-version: 22
36+
node-version: '24'
3537
typecheck: true
3638
app-directory: apps/hobbies-helsinki
3739
extra-commands: |

.github/workflows/ci-monorepo-integrity.yml

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,60 +4,48 @@ on:
44
push:
55
branches: [main]
66
paths:
7-
- 'yarn.lock'
8-
- '.yarnrc.yml'
7+
- 'pnpm-lock.yaml'
8+
- 'pnpm-workspace.yaml'
99
- '.github/workflows/ci-monorepo-integrity.yml'
1010

1111
pull_request:
1212
branches: [main]
1313
paths:
14-
- 'yarn.lock'
15-
- '.yarnrc.yml'
14+
- 'pnpm-lock.yaml'
15+
- 'pnpm-workspace.yaml'
1616
- '.github/workflows/ci-monorepo-integrity.yml'
1717

1818
jobs:
1919
test:
2020
runs-on: ubuntu-latest
2121
strategy:
2222
matrix:
23-
node-version: [22.x]
23+
node-version: [24.x]
2424
steps:
25-
- uses: actions/checkout@v4
25+
- uses: actions/checkout@v6
2626

2727
- name: Use Node.js ${{ matrix.node-version }}
28-
uses: actions/setup-node@v4
28+
uses: actions/setup-node@v6
2929
with:
30-
node-version: ${{ matrix.node-version }}
30+
# pnpm 11.5+ requires Node >=22.13; setup Node before pnpm/action-setup
31+
node-version: '24'
3132

32-
# Why not using setup-node 2.2+ cache option (yet) ?
33-
# see https://github.com/belgattitude/nextjs-monorepo-example/pull/369
34-
- name: Get yarn cache directory path
35-
id: yarn-cache-dir-path
36-
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
33+
- name: Setup pnpm
34+
uses: pnpm/action-setup@v6
3735

38-
- name: Restore yarn cache
39-
uses: actions/cache@v4
40-
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
36+
- name: Cache pnpm store
37+
uses: actions/setup-node@v6
4138
with:
42-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
43-
key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
44-
restore-keys: |
45-
yarn-cache-folder-
39+
node-version: '24'
40+
cache: pnpm
4641

4742
- name: Install dependencies
48-
run: |
49-
yarn install --immutable --inline-builds
43+
run: pnpm install --frozen-lockfile
5044
env:
5145
HUSKY: 0
5246

53-
- name: Check for duplicate dependencies in lock file
54-
run: |
55-
yarn dedupe --check
56-
57-
- name: Check for yarn constraints.pro
58-
run: |
59-
yarn constraints
47+
- name: Check monorepo workspace rules
48+
run: pnpm exec manypkg check
6049

6150
- name: Check monorepo dependency graph
62-
run: |
63-
yarn check:install
51+
run: pnpm run check:install

.github/workflows/ci-packages.yml

Lines changed: 30 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ on:
77
- main
88
paths:
99
- 'packages/**'
10-
- '.yarnrc.yml'
11-
- 'yarn.lock'
10+
- 'pnpm-workspace.yaml'
11+
- 'pnpm-lock.yaml'
1212
- '.prettier*'
1313
- 'tsconfig.base.json'
14-
- '.prettier*'
1514
- '.github/workflows/ci-packages.yml'
1615

1716
pull_request:
@@ -21,11 +20,10 @@ on:
2120
- reopened
2221
paths:
2322
- 'packages/**'
24-
- '.yarnrc.yml'
25-
- 'yarn.lock'
23+
- 'pnpm-workspace.yaml'
24+
- 'pnpm-lock.yaml'
2625
- '.prettier*'
2726
- 'tsconfig.base.json'
28-
- '.prettier*'
2927
- '.github/workflows/ci-packages.yml'
3028

3129
env:
@@ -36,87 +34,69 @@ jobs:
3634
runs-on: ubuntu-latest
3735
strategy:
3836
matrix:
39-
node-version: [22.x]
37+
node-version: [24.x]
4038
steps:
41-
- uses: actions/checkout@v4
39+
- uses: actions/checkout@v6
4240
with:
43-
# Fetch all git history so that yarn workspaces --since can compare with the correct commits
44-
# @link https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches
4541
fetch-depth: 0
4642

4743
- name: Use Node.js ${{ matrix.node-version }}
48-
uses: actions/setup-node@v4
44+
uses: actions/setup-node@v6
4945
with:
50-
node-version: ${{ matrix.node-version }}
46+
# pnpm 11.5+ requires Node >=22.13; setup Node before pnpm/action-setup
47+
node-version: '24'
5148

52-
# Why not using setup-node 2.2+ cache option (yet) ?
53-
# see https://github.com/belgattitude/nextjs-monorepo-example/pull/369
54-
- name: Get yarn cache directory path
55-
id: yarn-cache-dir-path
56-
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
49+
- name: Setup pnpm
50+
uses: pnpm/action-setup@v6
5751

58-
- name: Restore yarn cache
59-
uses: actions/cache@v4
60-
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
52+
- name: Cache pnpm store
53+
uses: actions/setup-node@v6
6154
with:
62-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
63-
key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
64-
restore-keys: |
65-
yarn-cache-folder-
55+
node-version: '24'
56+
cache: pnpm
6657

6758
- name: Restore packages cache
68-
uses: actions/cache@v4
59+
uses: actions/cache@v5
6960
with:
7061
path: |
7162
${{ github.workspace }}/.cache
7263
${{ github.workspace }}/**/tsconfig.tsbuildinfo
73-
74-
key: ${{ runner.os }}-packages-cache-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('packages/**.[jt]sx?', 'packages/**.json') }}
64+
key: ${{ runner.os }}-packages-cache-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('packages/**.[jt]sx?', 'packages/**.json') }}
7565
restore-keys: |
76-
${{ runner.os }}-packages-cache-${{ hashFiles('**/yarn.lock') }}-
66+
${{ runner.os }}-packages-cache-${{ hashFiles('**/pnpm-lock.yaml') }}-
7767
7868
- name: Install dependencies
79-
run: |
80-
yarn install --immutable --inline-builds
69+
run: pnpm install --frozen-lockfile
8170
env:
8271
HUSKY: 0
8372

84-
# Typecheck packages that have changed + packages and apps that depends on them (--from & --since)
85-
# That allows to see if we're introducing "surface" regressions (just the types)
73+
# pnpm unions multiple --filter flags (OR). Limit to changed packages under packages/
74+
# (yarn: workspaces foreach --include '@events-helsinki/*' --since=origin/main).
8675
- name: Typecheck
87-
run: |
88-
yarn workspaces foreach -tv --from '@events-helsinki/*' --since=origin/main --recursive run typecheck
76+
run: pnpm --filter '[origin/main]' --filter '!{apps/**}' --filter '!{proxies/**}' --filter '!events-helsinki-monorepo' run typecheck
8977

90-
# Lint packages that have changed (--include & --since)
9178
- name: Linter
9279
run: |
93-
yarn workspaces foreach -tv --include '@events-helsinki/*' --since=origin/main --recursive run lint
94-
yarn workspaces foreach -tv --include '@events-helsinki/*' --since=origin/main --recursive run lint-styles
80+
pnpm --filter '[origin/main]' --filter '!{apps/**}' --filter '!{proxies/**}' --filter '!events-helsinki-monorepo' run lint
81+
pnpm --filter '[origin/main]' --filter '!{apps/**}' --filter '!{proxies/**}' --filter '!events-helsinki-monorepo' --if-present run lint-styles
9582
96-
# Test packages that have changed (--include & --since)
9783
- name: Unit tests changed packages
98-
run: |
99-
yarn workspaces foreach -tv --include '@events-helsinki/*' --since=origin/main --recursive run test --coverage
100-
# to debug cache issues: ls ${{ github.workspace }}/.cache
101-
# Build packages that have changed (--include & --since), assuming that
102-
# apps build are done already. Otherwise --from & --since
84+
run: pnpm --filter '[origin/main]' --filter '!{apps/**}' --filter '!{proxies/**}' --filter '!events-helsinki-monorepo' run test --coverage
85+
10386
- name: Run build for changed packages
104-
run: |
105-
yarn workspaces foreach -tv --include '@events-helsinki/*' --since=origin/main run build
87+
run: pnpm --filter '[origin/main]' --filter '!{apps/**}' --filter '!{proxies/**}' --filter '!events-helsinki-monorepo' run build
10688

107-
# Test storybook build on packages that have changed (--include & --since)
10889
- name: Run storybook build for changed packages
109-
run: |
110-
yarn workspaces foreach -tv --exclude hobbies-helsinki --exclude events-helsinki --exclude sports-helsinki --since=origin/main run build-storybook
90+
run: pnpm --filter '[origin/main]' --filter '!{apps/**}' --filter '!{proxies/**}' --filter '!events-helsinki-monorepo' --if-present run build-storybook
11191

11292
- name: Run tests
11393
working-directory: packages/components
114-
run: yarn test:coverage
94+
run: pnpm test:coverage
11595
env:
11696
CI: true
11797

11898
- name: SonarQube Cloud Scan
119-
uses: SonarSource/sonarqube-scan-action@v6
99+
uses: SonarSource/sonarqube-scan-action@59db25f34e16620e48ab4bb9e4a5dce155cb5432 # v8.0.0
120100
with:
121101
projectBaseDir: packages/components
122102
env:

.github/workflows/ci-sports-helsinki-check.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ on:
88
- 'apps/sports-helsinki/**'
99
- 'packages/components/**'
1010
- 'packages/common-i18n/**'
11-
- '.yarnrc.yml'
11+
- 'pnpm-workspace.yaml'
12+
- 'pnpm-lock.yaml'
1213
- 'tsconfig.base.json'
1314
- '.prettier*'
1415
- '.github/workflows/ci-sports-helsinki-check.yml'
@@ -20,17 +21,18 @@ on:
2021
- 'apps/sports-helsinki/**'
2122
- 'packages/components/**'
2223
- 'packages/common-i18n/**'
23-
- '.yarnrc.yml'
24+
- 'pnpm-workspace.yaml'
25+
- 'pnpm-lock.yaml'
2426
- 'tsconfig.base.json'
2527
- '.prettier*'
2628
- '.github/workflows/ci-sports-helsinki-check.yml'
2729

2830
jobs:
2931
common:
30-
uses: City-of-Helsinki/.github/.github/workflows/ci-node.yml@main
32+
uses: City-of-Helsinki/.github/.github/workflows/ci-pnpm-node.yml@main
3133
secrets: inherit
3234
with:
33-
node-version: 22
35+
node-version: '24'
3436
typecheck: true
3537
app-directory: apps/sports-helsinki
3638
extra-commands: |

0 commit comments

Comments
 (0)