1
0
Fork 0
mirror of https://github.com/actions/setup-node synced 2024-12-23 21:52:41 +00:00

init commit adding corepack support

This commit is contained in:
Ethan Arrowood 2022-05-02 14:40:37 -06:00
parent 0bd06765ef
commit 70c3da958b
No known key found for this signature in database
GPG key ID: ED811E6BC98E8742
3 changed files with 14 additions and 59 deletions

65
package-lock.json generated
View file

@ -17,7 +17,7 @@
"@actions/http-client": "^1.0.11", "@actions/http-client": "^1.0.11",
"@actions/io": "^1.0.2", "@actions/io": "^1.0.2",
"@actions/tool-cache": "^1.5.4", "@actions/tool-cache": "^1.5.4",
"semver": "^6.1.1" "semver": "^6.3.0"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^27.0.2", "@types/jest": "^27.0.2",
@ -410,15 +410,6 @@
"url": "https://opencollective.com/babel" "url": "https://opencollective.com/babel"
} }
}, },
"node_modules/@babel/core/node_modules/semver": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
"dev": true,
"bin": {
"semver": "bin/semver.js"
}
},
"node_modules/@babel/core/node_modules/source-map": { "node_modules/@babel/core/node_modules/source-map": {
"version": "0.5.7", "version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
@ -469,15 +460,6 @@
"@babel/core": "^7.0.0" "@babel/core": "^7.0.0"
} }
}, },
"node_modules/@babel/helper-compilation-targets/node_modules/semver": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
"dev": true,
"bin": {
"semver": "bin/semver.js"
}
},
"node_modules/@babel/helper-function-name": { "node_modules/@babel/helper-function-name": {
"version": "7.15.4", "version": "7.15.4",
"resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.15.4.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.15.4.tgz",
@ -2732,15 +2714,6 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/istanbul-lib-instrument/node_modules/semver": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
"dev": true,
"bin": {
"semver": "bin/semver.js"
}
},
"node_modules/istanbul-lib-report": { "node_modules/istanbul-lib-report": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz",
@ -4402,11 +4375,11 @@
} }
}, },
"node_modules/semver": { "node_modules/semver": {
"version": "6.1.2", "version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.1.2.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
"integrity": "sha512-z4PqiCpomGtWj8633oeAdXm1Kn1W++3T8epkZYnwiVgIYIJ0QHszhInYSJTYxebByQH7KVCEAn8R9duzZW2PhQ==", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
"bin": { "bin": {
"semver": "bin/semver" "semver": "bin/semver.js"
} }
}, },
"node_modules/shebang-command": { "node_modules/shebang-command": {
@ -5419,12 +5392,6 @@
"source-map": "^0.5.0" "source-map": "^0.5.0"
}, },
"dependencies": { "dependencies": {
"semver": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
"dev": true
},
"source-map": { "source-map": {
"version": "0.5.7", "version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
@ -5462,14 +5429,6 @@
"@babel/helper-validator-option": "^7.14.5", "@babel/helper-validator-option": "^7.14.5",
"browserslist": "^4.16.6", "browserslist": "^4.16.6",
"semver": "^6.3.0" "semver": "^6.3.0"
},
"dependencies": {
"semver": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
"dev": true
}
} }
}, },
"@babel/helper-function-name": { "@babel/helper-function-name": {
@ -7256,14 +7215,6 @@
"@istanbuljs/schema": "^0.1.2", "@istanbuljs/schema": "^0.1.2",
"istanbul-lib-coverage": "^3.0.0", "istanbul-lib-coverage": "^3.0.0",
"semver": "^6.3.0" "semver": "^6.3.0"
},
"dependencies": {
"semver": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
"dev": true
}
} }
}, },
"istanbul-lib-report": { "istanbul-lib-report": {
@ -8533,9 +8484,9 @@
} }
}, },
"semver": { "semver": {
"version": "6.1.2", "version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.1.2.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
"integrity": "sha512-z4PqiCpomGtWj8633oeAdXm1Kn1W++3T8epkZYnwiVgIYIJ0QHszhInYSJTYxebByQH7KVCEAn8R9duzZW2PhQ==" "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
}, },
"shebang-command": { "shebang-command": {
"version": "1.2.0", "version": "1.2.0",

View file

@ -31,7 +31,7 @@
"@actions/http-client": "^1.0.11", "@actions/http-client": "^1.0.11",
"@actions/io": "^1.0.2", "@actions/io": "^1.0.2",
"@actions/tool-cache": "^1.5.4", "@actions/tool-cache": "^1.5.4",
"semver": "^6.1.1" "semver": "^6.3.0"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^27.0.2", "@types/jest": "^27.0.2",

View file

@ -4,8 +4,9 @@ import fs from 'fs';
import * as auth from './authutil'; import * as auth from './authutil';
import * as path from 'path'; import * as path from 'path';
import {restoreCache} from './cache-restore'; import {restoreCache} from './cache-restore';
import {isGhes, isCacheFeatureAvailable} from './cache-utils'; import {isGhes, isCacheFeatureAvailable, getCommandOutput} from './cache-utils';
import os = require('os'); import os = require('os');
import semver from 'semver';
export async function run() { export async function run() {
try { try {
@ -46,6 +47,9 @@ export async function run() {
} }
if (cache && isCacheFeatureAvailable()) { if (cache && isCacheFeatureAvailable()) {
if (semver.gte(version, '14')) {
await getCommandOutput('corepack enable');
}
const cacheDependencyPath = core.getInput('cache-dependency-path'); const cacheDependencyPath = core.getInput('cache-dependency-path');
await restoreCache(cache, cacheDependencyPath); await restoreCache(cache, cacheDependencyPath);
} }