From c970c3bc198dab5b7a82ad7dfb040a2d3318c1dc Mon Sep 17 00:00:00 2001 From: Koen Vlaswinkel Date: Wed, 4 Oct 2023 10:00:56 +0200 Subject: [PATCH] Use .nvmrc file for setting up Node version in Actions --- .github/workflows/cli-test.yml | 2 +- .github/workflows/main.yml | 12 ++++++------ .github/workflows/release.yml | 2 +- docs/node-version.md | 10 +++++----- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/cli-test.yml b/.github/workflows/cli-test.yml index fb8908d5c..5feeae1f8 100644 --- a/.github/workflows/cli-test.yml +++ b/.github/workflows/cli-test.yml @@ -62,7 +62,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: '18.15.0' + node-version-file: extensions/ql-vscode/.nvmrc cache: 'npm' cache-dependency-path: extensions/ql-vscode/package-lock.json diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 389d519b0..67f045b13 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: '18.15.0' + node-version-file: extensions/ql-vscode/.nvmrc cache: 'npm' cache-dependency-path: extensions/ql-vscode/package-lock.json @@ -64,7 +64,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: '18.15.0' + node-version-file: extensions/ql-vscode/.nvmrc cache: 'npm' cache-dependency-path: extensions/ql-vscode/package-lock.json @@ -110,7 +110,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: '18.15.0' + node-version-file: extensions/ql-vscode/.nvmrc cache: 'npm' cache-dependency-path: extensions/ql-vscode/package-lock.json @@ -149,7 +149,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: '18.15.0' + node-version-file: extensions/ql-vscode/.nvmrc cache: 'npm' cache-dependency-path: extensions/ql-vscode/package-lock.json @@ -183,7 +183,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: '18.15.0' + node-version-file: extensions/ql-vscode/.nvmrc cache: 'npm' cache-dependency-path: extensions/ql-vscode/package-lock.json @@ -251,7 +251,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: '18.15.0' + node-version-file: extensions/ql-vscode/.nvmrc cache: 'npm' cache-dependency-path: extensions/ql-vscode/package-lock.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 964983b18..a86a42a41 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: '18.15.0' + node-version-file: extensions/ql-vscode/.nvmrc - name: Install dependencies run: | diff --git a/docs/node-version.md b/docs/node-version.md index bdd5aafcf..1eb582da4 100644 --- a/docs/node-version.md +++ b/docs/node-version.md @@ -15,14 +15,14 @@ You can find this info by seleting "About Visual Studio Code" from the top menu. The following files will need to be updated: -- `.github/workflows/cli-test.yml` - the "node-version: '[VERSION]'" setting -- `.github/workflows/main.yml` - all the "node-version: '[VERSION]'" settings -- `.github/workflows/release.yml` - the "node-version: '[VERSION]'" setting -- `extensions/ql-vscode/.nvmrc` - this will enable nvm to automatically switch to the correct node version when you're in the project folder -- `extensions/ql-vscode/package-lock.json` - the "engines.node: '[VERSION]'" setting +- `extensions/ql-vscode/.nvmrc` - this will enable nvm to automatically switch to the correct Node + version when you're in the project folder. It will also change the Node version the GitHub Actions + workflows use. - `extensions/ql-vscode/package.json` - the "engines.node: '[VERSION]'" setting - `extensions/ql-vscode/package.json` - the "@types/node: '[VERSION]'" dependency +Then run `npm install` to update the `extensions/ql-vscode/package-lock.json` file. + ## Node.js version used in tests Unit tests will use whatever version of Node.js is installed locally. In CI this will be the version specified in the workflow.