Skip to content

Commit 1d16fd3

Browse files
smessmerclaude
andauthored
Unify Node.js version configuration (#87)
Use package.json engines field as the single source of truth for CI and Babel, reducing the number of places where Node version is hardcoded. Changes: - Add engines.node to backend and frontend package.json - Update CI workflows to use node-version-file instead of hardcoded version - Convert .babelrc to babel.config.js that reads version from package.json - Add engineComment to remind about serverless.yml sync Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 7ad0a10 commit 1d16fd3

File tree

6 files changed

+27
-34
lines changed

6 files changed

+27
-34
lines changed

.github/workflows/backend.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Use Node.js
2323
uses: actions/setup-node@v4
2424
with:
25-
node-version: 20.x
25+
node-version-file: 'backend/package.json'
2626
cache: npm
2727
cache-dependency-path: backend/package.json
2828
- name: Install Dependencies
@@ -54,7 +54,7 @@ jobs:
5454
- name: Use Node.js
5555
uses: actions/setup-node@v4
5656
with:
57-
node-version: 20.x
57+
node-version-file: 'backend/package.json'
5858
cache: npm
5959
cache-dependency-path: backend/package.json
6060
- name: Install Dependencies

.github/workflows/frontend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Use Node.js
2323
uses: actions/setup-node@v4
2424
with:
25-
node-version: 20.x
25+
node-version-file: 'frontend/package.json'
2626
cache: npm
2727
cache-dependency-path: frontend/package.json
2828
- name: Setup Pages

backend/.babelrc

Lines changed: 0 additions & 31 deletions
This file was deleted.

backend/babel.config.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const pkg = require('./package.json');
2+
const nodeVersion = pkg.engines.node.replace('.x', '');
3+
4+
module.exports = {
5+
comments: false,
6+
presets: [
7+
['@babel/preset-env', { modules: false, targets: { node: nodeVersion } }]
8+
],
9+
plugins: ['@babel/plugin-transform-class-properties'],
10+
env: {
11+
test: {
12+
presets: [
13+
['@babel/preset-env', { targets: { node: 'current' } }]
14+
]
15+
}
16+
}
17+
};

backend/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
"author": "Sebastian Messmer",
77
"license": "UNLICENSED",
88
"private": true,
9+
"engineComment": "When updating node version, also update runtime in serverless.yml",
10+
"engines": {
11+
"node": "20.x"
12+
},
913
"scripts": {
1014
"test": "jest",
1115
"test:watch": "jest --watch",

frontend/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"name": "cryfs-web-frontend",
33
"version": "0.0.1",
44
"description": "",
5+
"engines": {
6+
"node": "20.x"
7+
},
58
"scripts": {
69
"dev": "next",
710
"build": "next build",

0 commit comments

Comments
 (0)