mirror of https://github.com/actions/setup-node
Use actions/exec for getting version
This commit is contained in:
parent
1e163ded31
commit
2d53d29868
|
@ -15199,16 +15199,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
result["default"] = mod;
|
result["default"] = mod;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = __importStar(__webpack_require__(470));
|
const core = __importStar(__webpack_require__(470));
|
||||||
const io = __importStar(__webpack_require__(1));
|
const exec = __importStar(__webpack_require__(986));
|
||||||
const installer = __importStar(__webpack_require__(749));
|
const installer = __importStar(__webpack_require__(749));
|
||||||
const auth = __importStar(__webpack_require__(202));
|
const auth = __importStar(__webpack_require__(202));
|
||||||
const path = __importStar(__webpack_require__(622));
|
const path = __importStar(__webpack_require__(622));
|
||||||
const child_process_1 = __importDefault(__webpack_require__(129));
|
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
|
@ -15224,15 +15220,11 @@ function run() {
|
||||||
yield installer.getNode(version);
|
yield installer.getNode(version);
|
||||||
}
|
}
|
||||||
// Output version of node and npm that are being used
|
// Output version of node and npm that are being used
|
||||||
const nodePath = yield io.which('node');
|
const nodeVersion = exec.exec(`"$ --version`);
|
||||||
const nodeVersion = child_process_1.default.execSync(`"${nodePath}" --version`);
|
// Older versions of Node don't include npm, so don't let this call fail
|
||||||
console.log(`Node Version: ${nodeVersion}`);
|
const npmVersion = exec.exec(`npm --version`, undefined, {
|
||||||
const npmPath = yield io.which('npm');
|
ignoreReturnCode: true
|
||||||
// Older versions of Node don't include npm
|
});
|
||||||
if (npmPath) {
|
|
||||||
const npmVersion = child_process_1.default.execSync(`"${npmPath}" --version`);
|
|
||||||
console.log(`npm Version: ${npmVersion}`);
|
|
||||||
}
|
|
||||||
const registryUrl = core.getInput('registry-url');
|
const registryUrl = core.getInput('registry-url');
|
||||||
const alwaysAuth = core.getInput('always-auth');
|
const alwaysAuth = core.getInput('always-auth');
|
||||||
if (registryUrl) {
|
if (registryUrl) {
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.2",
|
"@actions/core": "^1.2.2",
|
||||||
|
"@actions/exec": "^1.0.3",
|
||||||
"@actions/github": "^1.1.0",
|
"@actions/github": "^1.1.0",
|
||||||
"@actions/http-client": "^1.0.6",
|
"@actions/http-client": "^1.0.6",
|
||||||
"@actions/io": "^1.0.2",
|
"@actions/io": "^1.0.2",
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
import * as exec from '@actions/exec';
|
||||||
import * as io from '@actions/io';
|
import * as io from '@actions/io';
|
||||||
import * as installer from './installer';
|
import * as installer from './installer';
|
||||||
import * as auth from './authutil';
|
import * as auth from './authutil';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import cp from 'child_process';
|
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
|
@ -20,16 +20,12 @@ async function run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output version of node and npm that are being used
|
// Output version of node and npm that are being used
|
||||||
const nodePath = await io.which('node');
|
const nodeVersion = exec.exec(`"$ --version`);
|
||||||
const nodeVersion = cp.execSync(`"${nodePath}" --version`);
|
|
||||||
console.log(`Node Version: ${nodeVersion}`);
|
|
||||||
|
|
||||||
const npmPath = await io.which('npm');
|
// Older versions of Node don't include npm, so don't let this call fail
|
||||||
// Older versions of Node don't include npm
|
const npmVersion = exec.exec(`npm --version`, undefined, {
|
||||||
if (npmPath) {
|
ignoreReturnCode: true
|
||||||
const npmVersion = cp.execSync(`"${npmPath}" --version`);
|
});
|
||||||
console.log(`npm Version: ${npmVersion}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const registryUrl: string = core.getInput('registry-url');
|
const registryUrl: string = core.getInput('registry-url');
|
||||||
const alwaysAuth: string = core.getInput('always-auth');
|
const alwaysAuth: string = core.getInput('always-auth');
|
||||||
|
|
Loading…
Reference in New Issue