Skip to content

Commit a2fcfe0

Browse files
authored
chore: migrate to mise + bump yarn to 4.14.1 + cache pattern (#93)
* chore: migrate to mise + bump yarn to 4.14.1 + cache pattern - Replace volta block in package.json with mise.toml at repo root. - Bump packageManager to yarn@4.14.1 (root + functions/). - Lockfile metadata 8 -> 9. - Delete .nvmrc (stale, conflicted with mise.toml; mise is source of truth). - .yarnrc.yml: nodeLinker: node-modules, enableScripts: true, enableHardenedMode: false. Drop auto-added 'approvedGitRepositories: ["**"]' (no git deps in this project; it was a permissive default to nothing). - Workflow main.yml: takken.io cache pattern applied to all 4 jobs (test, build, testDeploy, deploy). Each job now reads Node from mise.toml, caches node_modules + yarn cacheFolder + install-state, sets YARN_ENABLE_HARDENED_MODE: 'false' on install. Yarn workspaces structure preserved (single root yarn.lock; functions/ inherits). Firebase-specific Cloud Build quirks (compressionLevel pin) not needed here because there's no separate functions/ install -- Cloud Build runs against the root workspace. Yarn 4.x -> 4.14.1: lockfile metadata bump, scripts default flipped; within-major (no API breakage). Note: firebase-functions ^6.1.0 and firebase-admin ^12.7.0 are major versions behind current (7.2.5, 13.8.0). Not bumped here -- separate PR with release notes review per the global Upgrades rule. * chore(yarn): enableScripts off, allowlist via dependenciesMeta Drop enableScripts: true (Yarn 4.14 default is false for security). Allowlist each package that legitimately needs install scripts via dependenciesMeta.X.built: true in package.json. This shrinks the supply-chain RCE blast radius from 'every dep running install code' to only the listed packages. * chore(yarn): allowlist build scripts via dependenciesMeta Force-fresh yarn install identified the packages with install scripts. Added dependenciesMeta.X.built: true for each so they build under the global enableScripts: false default. * chore(yarn): update lockfile for dependenciesMeta dependenciesMeta entries change the lockfile's resolution hash. Without this commit, CI's yarn install --immutable would error with 'lockfile would have been modified'. * chore(mise): pin yarn alongside node in mise.toml `mise install` now brings up both node and yarn — no separate `corepack enable` step needed for fresh checkouts. Mirrors the yarn version already in package.json's packageManager field.
1 parent f15faab commit a2fcfe0

8 files changed

Lines changed: 150 additions & 25 deletions

File tree

.github/workflows/main.yml

Lines changed: 120 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ jobs:
1212
- name: Checkout
1313
uses: actions/checkout@v4
1414

15+
- name: Read Node version from mise.toml
16+
id: node
17+
run:
18+
echo "version=$(grep -E '^node\s*=' mise.toml | sed -E 's/.*"([^"]+)".*/\1/')" >>
19+
"$GITHUB_OUTPUT"
20+
1521
- name: Install package manager (from package.json)
1622
run: |
1723
corepack enable
@@ -20,11 +26,32 @@ jobs:
2026
- name: Setup Node
2127
uses: actions/setup-node@v4
2228
with:
23-
node-version-file: package.json
24-
cache: 'yarn'
29+
node-version: ${{ steps.node.outputs.version }}
30+
31+
- name: Resolve yarn cache folder
32+
id: yarn-config
33+
run: echo "cacheFolder=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
34+
35+
- name: Restore yarn install cache (node_modules + cacheFolder + install-state)
36+
id: yarn-cache
37+
uses: actions/cache@v4
38+
with:
39+
path: |
40+
node_modules
41+
${{ steps.yarn-config.outputs.cacheFolder }}
42+
.yarn/install-state.gz
43+
key:
44+
yarn-${{ runner.os }}-node${{ steps.node.outputs.version }}-${{
45+
hashFiles('yarn.lock') }}
46+
restore-keys: |
47+
yarn-${{ runner.os }}-node${{ steps.node.outputs.version }}-
2548
2649
- name: Install deps
27-
run: yarn install --immutable
50+
env:
51+
YARN_ENABLE_HARDENED_MODE: 'false'
52+
run: |
53+
case "$(yarn --version)" in 1.*) echo 'expected up-to-date yarn version'; exit 1 ;; esac
54+
yarn install --immutable
2855
2956
- name: run linter
3057
run: yarn lint
@@ -53,6 +80,12 @@ jobs:
5380
- name: Checkout
5481
uses: actions/checkout@v4
5582

83+
- name: Read Node version from mise.toml
84+
id: node
85+
run:
86+
echo "version=$(grep -E '^node\s*=' mise.toml | sed -E 's/.*"([^"]+)".*/\1/')" >>
87+
"$GITHUB_OUTPUT"
88+
5689
- name: Install package manager (from package.json)
5790
run: |
5891
corepack enable
@@ -61,11 +94,32 @@ jobs:
6194
- name: Setup Node
6295
uses: actions/setup-node@v4
6396
with:
64-
node-version-file: package.json
65-
cache: 'yarn'
97+
node-version: ${{ steps.node.outputs.version }}
98+
99+
- name: Resolve yarn cache folder
100+
id: yarn-config
101+
run: echo "cacheFolder=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
102+
103+
- name: Restore yarn install cache (node_modules + cacheFolder + install-state)
104+
id: yarn-cache
105+
uses: actions/cache@v4
106+
with:
107+
path: |
108+
node_modules
109+
${{ steps.yarn-config.outputs.cacheFolder }}
110+
.yarn/install-state.gz
111+
key:
112+
yarn-${{ runner.os }}-node${{ steps.node.outputs.version }}-${{
113+
hashFiles('yarn.lock') }}
114+
restore-keys: |
115+
yarn-${{ runner.os }}-node${{ steps.node.outputs.version }}-
66116
67117
- name: Install deps
68-
run: yarn install --immutable
118+
env:
119+
YARN_ENABLE_HARDENED_MODE: 'false'
120+
run: |
121+
case "$(yarn --version)" in 1.*) echo 'expected up-to-date yarn version'; exit 1 ;; esac
122+
yarn install --immutable
69123
70124
- name: build
71125
run: yarn workspace functions build
@@ -78,6 +132,12 @@ jobs:
78132
- name: Checkout
79133
uses: actions/checkout@v4
80134

135+
- name: Read Node version from mise.toml
136+
id: node
137+
run:
138+
echo "version=$(grep -E '^node\s*=' mise.toml | sed -E 's/.*"([^"]+)".*/\1/')" >>
139+
"$GITHUB_OUTPUT"
140+
81141
- name: Install package manager (from package.json)
82142
run: |
83143
corepack enable
@@ -86,11 +146,32 @@ jobs:
86146
- name: Setup Node
87147
uses: actions/setup-node@v4
88148
with:
89-
node-version-file: package.json
90-
cache: 'yarn'
149+
node-version: ${{ steps.node.outputs.version }}
150+
151+
- name: Resolve yarn cache folder
152+
id: yarn-config
153+
run: echo "cacheFolder=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
154+
155+
- name: Restore yarn install cache (node_modules + cacheFolder + install-state)
156+
id: yarn-cache
157+
uses: actions/cache@v4
158+
with:
159+
path: |
160+
node_modules
161+
${{ steps.yarn-config.outputs.cacheFolder }}
162+
.yarn/install-state.gz
163+
key:
164+
yarn-${{ runner.os }}-node${{ steps.node.outputs.version }}-${{
165+
hashFiles('yarn.lock') }}
166+
restore-keys: |
167+
yarn-${{ runner.os }}-node${{ steps.node.outputs.version }}-
91168
92169
- name: Install deps
93-
run: yarn install
170+
env:
171+
YARN_ENABLE_HARDENED_MODE: 'false'
172+
run: |
173+
case "$(yarn --version)" in 1.*) echo 'expected up-to-date yarn version'; exit 1 ;; esac
174+
yarn install --immutable
94175
95176
- name: Deploy test to Firebase
96177
uses: w9jds/firebase-action@v14.19.0
@@ -116,6 +197,12 @@ jobs:
116197
- name: Checkout
117198
uses: actions/checkout@v4
118199

200+
- name: Read Node version from mise.toml
201+
id: node
202+
run:
203+
echo "version=$(grep -E '^node\s*=' mise.toml | sed -E 's/.*"([^"]+)".*/\1/')" >>
204+
"$GITHUB_OUTPUT"
205+
119206
- name: Install package manager (from package.json)
120207
run: |
121208
corepack enable
@@ -124,11 +211,32 @@ jobs:
124211
- name: Setup Node
125212
uses: actions/setup-node@v4
126213
with:
127-
node-version-file: package.json
128-
cache: 'yarn'
214+
node-version: ${{ steps.node.outputs.version }}
215+
216+
- name: Resolve yarn cache folder
217+
id: yarn-config
218+
run: echo "cacheFolder=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
219+
220+
- name: Restore yarn install cache (node_modules + cacheFolder + install-state)
221+
id: yarn-cache
222+
uses: actions/cache@v4
223+
with:
224+
path: |
225+
node_modules
226+
${{ steps.yarn-config.outputs.cacheFolder }}
227+
.yarn/install-state.gz
228+
key:
229+
yarn-${{ runner.os }}-node${{ steps.node.outputs.version }}-${{
230+
hashFiles('yarn.lock') }}
231+
restore-keys: |
232+
yarn-${{ runner.os }}-node${{ steps.node.outputs.version }}-
129233
130234
- name: Install deps
131-
run: yarn install --immutable
235+
env:
236+
YARN_ENABLE_HARDENED_MODE: 'false'
237+
run: |
238+
case "$(yarn --version)" in 1.*) echo 'expected up-to-date yarn version'; exit 1 ;; esac
239+
yarn install --immutable
132240
133241
- name: Deploy to Firebase
134242
uses: w9jds/firebase-action@v14.19.0

.nvmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

.yarnrc.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
nodeLinker: node-modules
22

3+
4+
# Solo project; PRs are exclusively from the maintainer. Re-enable when
5+
# accepting third-party PRs that auto-trigger CI without manual review.
6+
enableHardenedMode: false
7+
38
npmRegistryServer: "https://registry.npmjs.org/"

DEVELOPMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This guide helps you set up the development environment for the GameCI Versionin
99
- [Firebase CLI](https://firebase.google.com/docs/cli) for local development and deployment
1010
- [Java Runtime Environment](https://www.java.com/) for Firebase emulators
1111

12-
> **Tip:** Use [nvm](https://github.com/nvm-sh/nvm), [n](https://github.com/tj/n), or [volta](https://volta.sh/) to manage Node.js versions.
12+
> **Tip:** This repo uses [mise](https://mise.jdx.dev/) (`mise.toml`) to pin the Node version. Run `mise install` in the repo root.
1313
1414
## Setup
1515

functions/package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,5 @@
4646
"jest": "^29.7.0"
4747
},
4848
"private": true,
49-
"volta": {
50-
"node": "24.12.0",
51-
"yarn": "4.12.0"
52-
},
53-
"packageManager": "yarn@4.12.0"
49+
"packageManager": "yarn@4.14.1"
5450
}

mise.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[tools]
2+
node = "24.12.0"
3+
yarn = "4.14.1"

package.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,16 @@
6161
"typescript": "^5.9.3",
6262
"vitest": "^3.2.4"
6363
},
64-
"volta": {
65-
"node": "24.12.0",
66-
"yarn": "4.12.0"
67-
},
68-
"packageManager": "yarn@4.12.0"
64+
"packageManager": "yarn@4.14.1",
65+
"dependenciesMeta": {
66+
"esbuild": {
67+
"built": true
68+
},
69+
"protobufjs": {
70+
"built": true
71+
},
72+
"re2": {
73+
"built": true
74+
}
75+
}
6976
}

yarn.lock

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Manual changes might be lost - proceed with caution!
33

44
__metadata:
5-
version: 8
5+
version: 9
66
cacheKey: 10c0
77

88
"@ampproject/remapping@npm:^2.3.0":
@@ -12124,6 +12124,13 @@ __metadata:
1212412124
shellcheck: "npm:^4.1.0"
1212512125
typescript: "npm:^5.9.3"
1212612126
vitest: "npm:^3.2.4"
12127+
dependenciesMeta:
12128+
esbuild:
12129+
built: true
12130+
protobufjs:
12131+
built: true
12132+
re2:
12133+
built: true
1212712134
languageName: unknown
1212812135
linkType: soft
1212912136

0 commit comments

Comments
 (0)