From 0093214f7abdad5a0550f0824d2c20067d042d2d Mon Sep 17 00:00:00 2001 From: bluelovers Date: Thu, 17 Feb 2022 00:42:14 +0800 Subject: [PATCH] feat: add support `node` is an alias for the latest version https://github.com/nvm-sh/nvm#usage --- .github/workflows/versions.yml | 14 ++++++++++++++ src/installer.ts | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/.github/workflows/versions.yml b/.github/workflows/versions.yml index d13fe402..6b299c1f 100644 --- a/.github/workflows/versions.yml +++ b/.github/workflows/versions.yml @@ -43,6 +43,20 @@ jobs: with: node-version: ${{ matrix.node-version }} + latest-syntax: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + node-version: [node] + steps: + - uses: actions/checkout@v2 + - name: Setup Node + uses: ./ + with: + node-version: ${{ matrix.node-version }} + manifest: runs-on: ${{ matrix.os }} strategy: diff --git a/src/installer.ts b/src/installer.ts index a9baae0a..3d713ae3 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -373,6 +373,10 @@ async function queryDistForMatch( let versions: string[] = []; let nodeVersions = await getVersionsFromDist(); + if (versionSpec === 'node') { + return nodeVersions[0].version; + } + nodeVersions.forEach((nodeVersion: INodeVersion) => { // ensure this version supports your os and platform if (nodeVersion.files.indexOf(dataFileName) >= 0) {