Compare commits

..

12 Commits

Author SHA1 Message Date
d4989cba2f string 2022-07-08 14:40:08 +00:00
c59451a53b dist 2022-07-08 13:49:31 +00:00
e7cd373485 fixing license 2022-07-08 13:13:58 +00:00
59088c2a15 fixed conflicts 2022-07-08 05:04:05 +00:00
63d5b78043 client update 2022-06-26 10:02:09 +00:00
2ad69f7464 license 2022-06-26 09:58:32 +00:00
847eaae378 revert client 2022-06-26 09:53:16 +00:00
db3ddb5ef4 dist 2022-06-26 09:39:13 +00:00
9185654d72 updated dependencies 2022-06-26 09:31:33 +00:00
60b802d0e8 adding test case 2022-06-26 07:59:55 +00:00
2b1e32b119 license update 2022-06-25 20:27:21 +00:00
60ad0741c0 Initial changes 2022-06-25 20:23:34 +00:00
13 changed files with 2343 additions and 1057 deletions

View File

@ -92,13 +92,12 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version-file: [.nvmrc, .tool-versions]
steps:
- uses: actions/checkout@v3
- name: Setup node from node version file
uses: ./
with:
node-version-file: '__tests__/data/${{ matrix.node-version-file }}'
node-version-file: '__tests__/data/.nvmrc'
- name: Verify node
run: __tests__/verify-node.sh 14

View File

@ -295,7 +295,7 @@ describe('run', () => {
expect(setFailedSpy).not.toHaveBeenCalled();
});
it('save with -1 cacheId , should not fail workflow', async () => {
it('save with -1 cacheId, should not fail workflow', async () => {
inputs['cache'] = 'npm';
getStateSpy.mockImplementation((name: string) => {
if (name === State.CacheMatchedKey) {

View File

@ -1 +0,0 @@
nodejs 14.0.0

View File

@ -8,7 +8,6 @@ import fs from 'fs';
import cp from 'child_process';
import osm = require('os');
import path from 'path';
import each from 'jest-each';
import * as main from '../src/main';
import * as auth from '../src/authutil';
@ -905,23 +904,3 @@ describe('setup-node', () => {
);
});
});
describe('helper methods', () => {
describe('parseNodeVersionFile', () => {
each`
contents | expected
${'12'} | ${'12'}
${'12.3'} | ${'12.3'}
${'12.3.4'} | ${'12.3.4'}
${'v12.3.4'} | ${'12.3.4'}
${'lts/erbium'} | ${'lts/erbium'}
${'lts/*'} | ${'lts/*'}
${'nodejs 12.3.4'} | ${'12.3.4'}
${'ruby 2.3.4\nnodejs 12.3.4\npython 3.4.5'} | ${'12.3.4'}
${''} | ${''}
${'unknown format'} | ${'unknown format'}
`.it('parses "$contents"', ({contents, expected}) => {
expect(im.parseNodeVersionFile(contents)).toBe(expected);
});
});
});

View File

@ -8,7 +8,7 @@ inputs:
node-version:
description: 'Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0.'
node-version-file:
description: 'File containing the version Spec of the version to use. Examples: .nvmrc, .node-version, .tool-versions.'
description: 'File containing the version Spec of the version to use. Examples: .nvmrc, .node-version.'
architecture:
description: 'Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default.'
check-latest:

1360
dist/cache-save/index.js vendored

File diff suppressed because it is too large Load Diff

1921
dist/setup/index.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -56,7 +56,7 @@ steps:
## Node version file
The `node-version-file` input accepts a path to a file containing the version of Node.js to be used by a project, for example `.nvmrc`, `.node-version` or `.tool-versions`. If both the `node-version` and the `node-version-file` inputs are provided then the `node-version` input is used.
The `node-version-file` input accepts a path to a file containing the version of Node.js to be used by a project, for example `.nvmrc` or `.node-version`. If both the `node-version` and the `node-version-file` inputs are provided then the `node-version` input is used.
See [supported version syntax](https://github.com/actions/setup-node#supported-version-syntax)
> The action will search for the node version file relative to the repository root.

54
package-lock.json generated
View File

@ -14,7 +14,7 @@
"@actions/exec": "^1.1.0",
"@actions/github": "^1.1.0",
"@actions/glob": "^0.2.0",
"@actions/http-client": "^1.0.11",
"@actions/http-client": "^2.0.1",
"@actions/io": "^1.0.2",
"@actions/tool-cache": "^1.5.4",
"semver": "^6.1.1"
@ -81,6 +81,14 @@
"@actions/http-client": "^1.0.11"
}
},
"node_modules/@actions/core/node_modules/@actions/http-client": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
"integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
"dependencies": {
"tunnel": "0.0.6"
}
},
"node_modules/@actions/exec": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.0.tgz",
@ -108,11 +116,11 @@
}
},
"node_modules/@actions/http-client": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
"integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
"dependencies": {
"tunnel": "0.0.6"
"tunnel": "^0.0.6"
}
},
"node_modules/@actions/io": {
@ -133,6 +141,14 @@
"uuid": "^3.3.2"
}
},
"node_modules/@actions/tool-cache/node_modules/@actions/http-client": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
"integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
"dependencies": {
"tunnel": "0.0.6"
}
},
"node_modules/@azure/abort-controller": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-1.0.4.tgz",
@ -5132,6 +5148,16 @@
"integrity": "sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==",
"requires": {
"@actions/http-client": "^1.0.11"
},
"dependencies": {
"@actions/http-client": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
"integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
"requires": {
"tunnel": "0.0.6"
}
}
}
},
"@actions/exec": {
@ -5161,11 +5187,11 @@
}
},
"@actions/http-client": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
"integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
"requires": {
"tunnel": "0.0.6"
"tunnel": "^0.0.6"
}
},
"@actions/io": {
@ -5184,6 +5210,16 @@
"@actions/io": "^1.0.1",
"semver": "^6.1.0",
"uuid": "^3.3.2"
},
"dependencies": {
"@actions/http-client": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
"integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
"requires": {
"tunnel": "0.0.6"
}
}
}
},
"@azure/abort-controller": {

View File

@ -28,7 +28,7 @@
"@actions/exec": "^1.1.0",
"@actions/github": "^1.1.0",
"@actions/glob": "^0.2.0",
"@actions/http-client": "^1.0.11",
"@actions/http-client": "^2.0.1",
"@actions/io": "^1.0.2",
"@actions/tool-cache": "^1.5.4",
"semver": "^6.1.1"

View File

@ -18,7 +18,7 @@ export const supportedPackageManagers: SupportedPackageManagers = {
},
pnpm: {
lockFilePatterns: ['pnpm-lock.yaml'],
getCacheFolderCommand: 'pnpm store path --silent'
getCacheFolderCommand: 'pnpm store path'
},
yarn1: {
lockFilePatterns: ['yarn.lock'],
@ -94,7 +94,7 @@ export const getCacheDirectoryPath = async (
core.debug(`${packageManager} path is ${stdOut}`);
return stdOut.trim();
return stdOut;
};
export function isGhes(): boolean {

View File

@ -495,16 +495,12 @@ function translateArchToDistUrl(arch: string): string {
}
export function parseNodeVersionFile(contents: string): string {
const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);
const nodeVersion = found?.groups?.version;
let nodeVersion = contents.trim();
if (nodeVersion) {
return nodeVersion;
if (/^v\d/.test(nodeVersion)) {
nodeVersion = nodeVersion.substring(1);
}
// In the case of an unknown format,
// return as is and evaluate the version separately.
return contents.trim();
return nodeVersion;
}
function isLatestSyntax(versionSpec): boolean {

View File

@ -41,16 +41,12 @@ export async function run() {
}
// Output version of node is being used
try {
const {stdout: installedVersion} = await exec.getExecOutput(
'node',
['--version'],
{ignoreReturnCode: true, silent: true}
);
core.setOutput('node-version', installedVersion.trim());
} catch (err) {
core.setOutput('node-version', '');
}
const {stdout: installedVersion} = await exec.getExecOutput(
'node',
['--version'],
{ignoreReturnCode: true}
);
core.setOutput('node-version', installedVersion);
const registryUrl: string = core.getInput('registry-url');
const alwaysAuth: string = core.getInput('always-auth');