From 6c27665e737ecba91fbd9ddd1445ec2c93a1fb17 Mon Sep 17 00:00:00 2001 From: Ari Palo Date: Wed, 20 Nov 2024 14:19:34 +0200 Subject: [PATCH] build: configure min/max nodejs versions --- .github/workflows/build.yml | 8 ++++---- .github/workflows/release-beta.yml | 10 +++++----- .github/workflows/release.yml | 10 +++++----- .github/workflows/sonarcloud-report.yml | 2 +- .github/workflows/upgrade-beta.yml | 2 +- .github/workflows/upgrade-main.yml | 2 +- .nvmrc | 2 +- .projen/deps.json | 1 + .projen/tasks.json | 2 +- .projenrc.ts | 16 +++++++++++++++- package-lock.json | 3 +++ package.json | 3 +++ 12 files changed, 41 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c11dca1..0f1f583 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: lts/* + node-version: "18" - name: Install dependencies run: npm install - name: build @@ -95,7 +95,7 @@ jobs: steps: - uses: actions/setup-node@v4 with: - node-version: lts/* + node-version: "18" - name: Download build artifacts uses: actions/download-artifact@v4 with: @@ -129,7 +129,7 @@ jobs: steps: - uses: actions/setup-node@v4 with: - node-version: lts/* + node-version: "18" - uses: actions/setup-python@v5 with: python-version: 3.x @@ -166,7 +166,7 @@ jobs: steps: - uses: actions/setup-node@v4 with: - node-version: lts/* + node-version: "18" - uses: actions/setup-go@v5 with: go-version: ^1.18.0 diff --git a/.github/workflows/release-beta.yml b/.github/workflows/release-beta.yml index 8608574..044e881 100644 --- a/.github/workflows/release-beta.yml +++ b/.github/workflows/release-beta.yml @@ -31,7 +31,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: lts/* + node-version: "18" - name: Install dependencies run: npm ci - name: release:beta @@ -72,7 +72,7 @@ jobs: steps: - uses: actions/setup-node@v4 with: - node-version: lts/* + node-version: "18" - name: Download build artifacts uses: actions/download-artifact@v4 with: @@ -98,7 +98,7 @@ jobs: steps: - uses: actions/setup-node@v4 with: - node-version: lts/* + node-version: "18" - name: Download build artifacts uses: actions/download-artifact@v4 with: @@ -138,7 +138,7 @@ jobs: steps: - uses: actions/setup-node@v4 with: - node-version: lts/* + node-version: "18" - uses: actions/setup-python@v5 with: python-version: 3.x @@ -179,7 +179,7 @@ jobs: steps: - uses: actions/setup-node@v4 with: - node-version: lts/* + node-version: "18" - uses: actions/setup-go@v5 with: go-version: ^1.18.0 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bc1abef..8ca4319 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,7 +31,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: lts/* + node-version: "18" - name: Install dependencies run: npm ci - name: release @@ -72,7 +72,7 @@ jobs: steps: - uses: actions/setup-node@v4 with: - node-version: lts/* + node-version: "18" - name: Download build artifacts uses: actions/download-artifact@v4 with: @@ -98,7 +98,7 @@ jobs: steps: - uses: actions/setup-node@v4 with: - node-version: lts/* + node-version: "18" - name: Download build artifacts uses: actions/download-artifact@v4 with: @@ -138,7 +138,7 @@ jobs: steps: - uses: actions/setup-node@v4 with: - node-version: lts/* + node-version: "18" - uses: actions/setup-python@v5 with: python-version: 3.x @@ -179,7 +179,7 @@ jobs: steps: - uses: actions/setup-node@v4 with: - node-version: lts/* + node-version: "18" - uses: actions/setup-go@v5 with: go-version: ^1.18.0 diff --git a/.github/workflows/sonarcloud-report.yml b/.github/workflows/sonarcloud-report.yml index 6999666..f2d9e89 100644 --- a/.github/workflows/sonarcloud-report.yml +++ b/.github/workflows/sonarcloud-report.yml @@ -24,7 +24,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: lts/* + node-version: "18" - name: Install dependencies run: npm ci - name: Run tests diff --git a/.github/workflows/upgrade-beta.yml b/.github/workflows/upgrade-beta.yml index b5fe7e5..0c73e83 100644 --- a/.github/workflows/upgrade-beta.yml +++ b/.github/workflows/upgrade-beta.yml @@ -21,7 +21,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: lts/* + node-version: "18" - name: Install dependencies run: npm ci - name: Upgrade dependencies diff --git a/.github/workflows/upgrade-main.yml b/.github/workflows/upgrade-main.yml index be039a2..12d041b 100644 --- a/.github/workflows/upgrade-main.yml +++ b/.github/workflows/upgrade-main.yml @@ -21,7 +21,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: lts/* + node-version: "18" - name: Install dependencies run: npm ci - name: Upgrade dependencies diff --git a/.nvmrc b/.nvmrc index 726a201..25bf17f 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -20.11.1 \ No newline at end of file +18 \ No newline at end of file diff --git a/.projen/deps.json b/.projen/deps.json index dc42ec5..4ff851a 100644 --- a/.projen/deps.json +++ b/.projen/deps.json @@ -11,6 +11,7 @@ }, { "name": "@types/node", + "version": "^18", "type": "build" }, { diff --git a/.projen/tasks.json b/.projen/tasks.json index 91d9553..bb51cbe 100644 --- a/.projen/tasks.json +++ b/.projen/tasks.json @@ -324,7 +324,7 @@ }, "steps": [ { - "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --no-deprecated --dep=dev,peer,prod,optional --filter=@types/jest,@types/node,@types/nunjucks,eslint-import-resolver-typescript,eslint-plugin-import,jest,jsii-diff,jsii-pacmak,projen,ts-jest,ts-node,typescript,change-case,nunjucks" + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --no-deprecated --dep=dev,peer,prod,optional --filter=@types/jest,@types/nunjucks,eslint-import-resolver-typescript,eslint-plugin-import,jest,jsii-diff,jsii-pacmak,projen,ts-jest,ts-node,typescript,change-case,nunjucks" }, { "exec": "npm install" diff --git a/.projenrc.ts b/.projenrc.ts index 8a391ae..eb3a7d6 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -2,7 +2,20 @@ import { awscdk, javascript, TextFile } from 'projen'; import { WorkflowSteps } from 'projen/lib/github'; import { JobPermission } from 'projen/lib/github/workflows-model'; +const nodejsVersion = { + /** + * Minimum supported version. + */ + MIN: '18', + /** + * Maximum supported version. + */ + MAX: '23', +} as const; + const project = new awscdk.AwsCdkConstructLibrary({ + minNodeVersion: nodejsVersion.MIN, + maxNodeVersion: nodejsVersion.MAX, projenrcTs: true, jsiiVersion: '~5.3.24', // Metadata @@ -39,6 +52,7 @@ const project = new awscdk.AwsCdkConstructLibrary({ constructsVersion: '10.3.0', devDeps: [ '@types/nunjucks', + `@types/node@^${nodejsVersion.MIN}`, ], bundledDeps: [ 'change-case', @@ -117,7 +131,7 @@ new TextFile(project, 'sonar-project.properties', { * .nvmrc file */ new TextFile(project, '.nvmrc', { - lines: ['20.11.1'], + lines: [nodejsVersion.MIN], }); project.synth(); diff --git a/package-lock.json b/package-lock.json index efa87e0..afe36e4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,6 +41,9 @@ "ts-node": "^10.9.2", "typescript": "^4.9.5" }, + "engines": { + "node": ">= 18 <= 23" + }, "peerDependencies": { "aws-cdk-lib": "^2.133.0", "constructs": "^10.3.0" diff --git a/package.json b/package.json index f744b16..74e14cb 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,9 @@ "awscdk", "cdk" ], + "engines": { + "node": ">= 18 <= 23" + }, "main": "lib/index.js", "license": "Apache-2.0", "publishConfig": {