|
|
|
@ -230,7 +230,7 @@ async function addExtensionDarwin(extension_csv, version) {
|
|
|
|
|
' ' +
|
|
|
|
|
ext_prefix;
|
|
|
|
|
return;
|
|
|
|
|
case /(5\.6|7\.[0-4]|8.0)(amqp|grpc|igbinary|imagick|imap|msgpack|^(pecl_)?http$|propro|protobuf|psr|raphf|redis|swoole|xdebug|xdebug2|zmq)/.test(version_extension):
|
|
|
|
|
case /(5\.6|7\.[0-4]|8.0)(amqp|grpc|igbinary|imagick|imap|msgpack|^(pecl_)?http$|propro|protobuf|psr|raphf|rdkafka|redis|swoole|xdebug|xdebug2|zmq)/.test(version_extension):
|
|
|
|
|
case /(7\.[1-4]|8\.0])pcov/.test(version_extension):
|
|
|
|
|
case /^(5\.6|7\.[0-3])phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
|
|
|
|
command = 'add_brew_extension ' + extension_name.replace('pecl_', '');
|
|
|
|
@ -438,15 +438,16 @@ async function build(filename, version, os_version) {
|
|
|
|
|
exports.build = build;
|
|
|
|
|
async function run() {
|
|
|
|
|
try {
|
|
|
|
|
if ((await utils.readEnv('ImageOS')) == 'ubuntu16') {
|
|
|
|
|
core.setFailed('setup-php is not supported on Ubuntu 16.04. Please upgrade to Ubuntu 18.04 or Ubuntu 20.04 - https://setup-php.com/i/452');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
core.warning('setup-php v1 is deprecated.\nPlease upgrade to v2 - https://setup-php.com/w/Switch-to-v2');
|
|
|
|
|
const version = await utils.parseVersion(await utils.getInput('php-version', true));
|
|
|
|
|
if (version == '8.1') {
|
|
|
|
|
core.setFailed('PHP 8.1 is not supported on setup-php v1.\nPlease upgrade to v2 - https://setup-php.com/w/Switch-to-v2');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if ((await utils.readEnv('ImageOS')) == 'ubuntu16') {
|
|
|
|
|
core.warning('Ubuntu 16.04 is deprecated.\nPlease upgrade to Ubuntu 18.04 or Ubuntu 20.04 - https://setup-php.com/i/452');
|
|
|
|
|
}
|
|
|
|
|
if (version) {
|
|
|
|
|
const os_version = process.platform;
|
|
|
|
|
let script_path = '';
|
|
|
|
@ -520,8 +521,8 @@ async function getCommand(os_version, suffix) {
|
|
|
|
|
exports.getCommand = getCommand;
|
|
|
|
|
async function getToolVersion(version) {
|
|
|
|
|
const semver_regex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
|
|
|
|
|
const composer_regex = /^stable$|^preview$|^snapshot$|^v?[1|2]$/;
|
|
|
|
|
version = version.replace(/[><=^]*/, '');
|
|
|
|
|
const composer_regex = /^stable$|^preview$|^snapshot$|^[1|2]$/;
|
|
|
|
|
version = version.replace(/[><=^]*/, '').replace(/^v(\d)/, '$1');
|
|
|
|
|
switch (true) {
|
|
|
|
|
case composer_regex.test(version):
|
|
|
|
|
case semver_regex.test(version):
|
|
|
|
@ -1132,7 +1133,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
|
|
|
|
|
exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
|
|
|
|
|
const command_1 = __nccwpck_require__(241);
|
|
|
|
|
const file_command_1 = __nccwpck_require__(717);
|
|
|
|
|
const utils_1 = __nccwpck_require__(278);
|
|
|
|
@ -1218,6 +1219,21 @@ function getInput(name, options) {
|
|
|
|
|
return val.trim();
|
|
|
|
|
}
|
|
|
|
|
exports.getInput = getInput;
|
|
|
|
|
/**
|
|
|
|
|
* Gets the values of an multiline input. Each value is also trimmed.
|
|
|
|
|
*
|
|
|
|
|
* @param name name of the input to get
|
|
|
|
|
* @param options optional. See InputOptions.
|
|
|
|
|
* @returns string[]
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
function getMultilineInput(name, options) {
|
|
|
|
|
const inputs = getInput(name, options)
|
|
|
|
|
.split('\n')
|
|
|
|
|
.filter(x => x !== '');
|
|
|
|
|
return inputs;
|
|
|
|
|
}
|
|
|
|
|
exports.getMultilineInput = getMultilineInput;
|
|
|
|
|
/**
|
|
|
|
|
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
|
|
|
|
|
* Support boolean input list: `true | True | TRUE | false | False | FALSE` .
|
|
|
|
@ -1462,6 +1478,25 @@ exports.toCommandValue = toCommandValue;
|
|
|
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
|
}));
|
|
|
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
|
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
|
|
|
}) : function(o, v) {
|
|
|
|
|
o["default"] = v;
|
|
|
|
|
});
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
@ -1471,14 +1506,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
|
|
|
result["default"] = mod;
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
exports.getExecOutput = exports.exec = void 0;
|
|
|
|
|
const string_decoder_1 = __nccwpck_require__(304);
|
|
|
|
|
const tr = __importStar(__nccwpck_require__(159));
|
|
|
|
|
/**
|
|
|
|
|
* Exec a command.
|
|
|
|
@ -1504,6 +1534,51 @@ function exec(commandLine, args, options) {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
exports.exec = exec;
|
|
|
|
|
/**
|
|
|
|
|
* Exec a command and get the output.
|
|
|
|
|
* Output will be streamed to the live console.
|
|
|
|
|
* Returns promise with the exit code and collected stdout and stderr
|
|
|
|
|
*
|
|
|
|
|
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
|
|
|
|
* @param args optional arguments for tool. Escaping is handled by the lib.
|
|
|
|
|
* @param options optional exec options. See ExecOptions
|
|
|
|
|
* @returns Promise<ExecOutput> exit code, stdout, and stderr
|
|
|
|
|
*/
|
|
|
|
|
function getExecOutput(commandLine, args, options) {
|
|
|
|
|
var _a, _b;
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
let stdout = '';
|
|
|
|
|
let stderr = '';
|
|
|
|
|
//Using string decoder covers the case where a mult-byte character is split
|
|
|
|
|
const stdoutDecoder = new string_decoder_1.StringDecoder('utf8');
|
|
|
|
|
const stderrDecoder = new string_decoder_1.StringDecoder('utf8');
|
|
|
|
|
const originalStdoutListener = (_a = options === null || options === void 0 ? void 0 : options.listeners) === null || _a === void 0 ? void 0 : _a.stdout;
|
|
|
|
|
const originalStdErrListener = (_b = options === null || options === void 0 ? void 0 : options.listeners) === null || _b === void 0 ? void 0 : _b.stderr;
|
|
|
|
|
const stdErrListener = (data) => {
|
|
|
|
|
stderr += stderrDecoder.write(data);
|
|
|
|
|
if (originalStdErrListener) {
|
|
|
|
|
originalStdErrListener(data);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const stdOutListener = (data) => {
|
|
|
|
|
stdout += stdoutDecoder.write(data);
|
|
|
|
|
if (originalStdoutListener) {
|
|
|
|
|
originalStdoutListener(data);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const listeners = Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.listeners), { stdout: stdOutListener, stderr: stdErrListener });
|
|
|
|
|
const exitCode = yield exec(commandLine, args, Object.assign(Object.assign({}, options), { listeners }));
|
|
|
|
|
//flush any remaining characters
|
|
|
|
|
stdout += stdoutDecoder.end();
|
|
|
|
|
stderr += stderrDecoder.end();
|
|
|
|
|
return {
|
|
|
|
|
exitCode,
|
|
|
|
|
stdout,
|
|
|
|
|
stderr
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
exports.getExecOutput = getExecOutput;
|
|
|
|
|
//# sourceMappingURL=exec.js.map
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
@ -1512,6 +1587,25 @@ exports.exec = exec;
|
|
|
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
|
}));
|
|
|
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
|
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
|
|
|
}) : function(o, v) {
|
|
|
|
|
o["default"] = v;
|
|
|
|
|
});
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
@ -1521,20 +1615,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
|
|
|
result["default"] = mod;
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
exports.argStringToArray = exports.ToolRunner = void 0;
|
|
|
|
|
const os = __importStar(__nccwpck_require__(87));
|
|
|
|
|
const events = __importStar(__nccwpck_require__(614));
|
|
|
|
|
const child = __importStar(__nccwpck_require__(129));
|
|
|
|
|
const path = __importStar(__nccwpck_require__(622));
|
|
|
|
|
const io = __importStar(__nccwpck_require__(351));
|
|
|
|
|
const ioUtil = __importStar(__nccwpck_require__(962));
|
|
|
|
|
const timers_1 = __nccwpck_require__(213);
|
|
|
|
|
/* eslint-disable @typescript-eslint/unbound-method */
|
|
|
|
|
const IS_WINDOWS = process.platform === 'win32';
|
|
|
|
|
/*
|
|
|
|
@ -1604,11 +1693,12 @@ class ToolRunner extends events.EventEmitter {
|
|
|
|
|
s = s.substring(n + os.EOL.length);
|
|
|
|
|
n = s.indexOf(os.EOL);
|
|
|
|
|
}
|
|
|
|
|
strBuffer = s;
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
catch (err) {
|
|
|
|
|
// streaming lines to console is best effort. Don't fail a build.
|
|
|
|
|
this._debug(`error processing line. Failed with error ${err}`);
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
_getSpawnFileName() {
|
|
|
|
@ -1890,7 +1980,7 @@ class ToolRunner extends events.EventEmitter {
|
|
|
|
|
// if the tool is only a file name, then resolve it from the PATH
|
|
|
|
|
// otherwise verify it exists (add extension on Windows if necessary)
|
|
|
|
|
this.toolPath = yield io.which(this.toolPath, true);
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
this._debug(`exec tool: ${this.toolPath}`);
|
|
|
|
|
this._debug('arguments:');
|
|
|
|
|
for (const arg of this.args) {
|
|
|
|
@ -1904,9 +1994,12 @@ class ToolRunner extends events.EventEmitter {
|
|
|
|
|
state.on('debug', (message) => {
|
|
|
|
|
this._debug(message);
|
|
|
|
|
});
|
|
|
|
|
if (this.options.cwd && !(yield ioUtil.exists(this.options.cwd))) {
|
|
|
|
|
return reject(new Error(`The cwd: ${this.options.cwd} does not exist!`));
|
|
|
|
|
}
|
|
|
|
|
const fileName = this._getSpawnFileName();
|
|
|
|
|
const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName));
|
|
|
|
|
const stdbuffer = '';
|
|
|
|
|
let stdbuffer = '';
|
|
|
|
|
if (cp.stdout) {
|
|
|
|
|
cp.stdout.on('data', (data) => {
|
|
|
|
|
if (this.options.listeners && this.options.listeners.stdout) {
|
|
|
|
@ -1915,14 +2008,14 @@ class ToolRunner extends events.EventEmitter {
|
|
|
|
|
if (!optionsNonNull.silent && optionsNonNull.outStream) {
|
|
|
|
|
optionsNonNull.outStream.write(data);
|
|
|
|
|
}
|
|
|
|
|
this._processLineBuffer(data, stdbuffer, (line) => {
|
|
|
|
|
stdbuffer = this._processLineBuffer(data, stdbuffer, (line) => {
|
|
|
|
|
if (this.options.listeners && this.options.listeners.stdline) {
|
|
|
|
|
this.options.listeners.stdline(line);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
const errbuffer = '';
|
|
|
|
|
let errbuffer = '';
|
|
|
|
|
if (cp.stderr) {
|
|
|
|
|
cp.stderr.on('data', (data) => {
|
|
|
|
|
state.processStderr = true;
|
|
|
|
@ -1937,7 +2030,7 @@ class ToolRunner extends events.EventEmitter {
|
|
|
|
|
: optionsNonNull.outStream;
|
|
|
|
|
s.write(data);
|
|
|
|
|
}
|
|
|
|
|
this._processLineBuffer(data, errbuffer, (line) => {
|
|
|
|
|
errbuffer = this._processLineBuffer(data, errbuffer, (line) => {
|
|
|
|
|
if (this.options.listeners && this.options.listeners.errline) {
|
|
|
|
|
this.options.listeners.errline(line);
|
|
|
|
|
}
|
|
|
|
@ -1984,7 +2077,7 @@ class ToolRunner extends events.EventEmitter {
|
|
|
|
|
}
|
|
|
|
|
cp.stdin.end(this.options.input);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -2070,7 +2163,7 @@ class ExecState extends events.EventEmitter {
|
|
|
|
|
this._setResult();
|
|
|
|
|
}
|
|
|
|
|
else if (this.processExited) {
|
|
|
|
|
this.timeout = setTimeout(ExecState.HandleTimeout, this.delay, this);
|
|
|
|
|
this.timeout = timers_1.setTimeout(ExecState.HandleTimeout, this.delay, this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
_debug(message) {
|
|
|
|
@ -2118,6 +2211,25 @@ class ExecState extends events.EventEmitter {
|
|
|
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
|
}));
|
|
|
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
|
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
|
|
|
}) : function(o, v) {
|
|
|
|
|
o["default"] = v;
|
|
|
|
|
});
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
@ -2127,16 +2239,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
|
|
|
result["default"] = mod;
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
var _a;
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
const assert_1 = __nccwpck_require__(357);
|
|
|
|
|
exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rename = exports.readlink = exports.readdir = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
|
|
|
|
|
const fs = __importStar(__nccwpck_require__(747));
|
|
|
|
|
const path = __importStar(__nccwpck_require__(622));
|
|
|
|
|
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
|
|
|
|
@ -2179,49 +2284,6 @@ function isRooted(p) {
|
|
|
|
|
return p.startsWith('/');
|
|
|
|
|
}
|
|
|
|
|
exports.isRooted = isRooted;
|
|
|
|
|
/**
|
|
|
|
|
* Recursively create a directory at `fsPath`.
|
|
|
|
|
*
|
|
|
|
|
* This implementation is optimistic, meaning it attempts to create the full
|
|
|
|
|
* path first, and backs up the path stack from there.
|
|
|
|
|
*
|
|
|
|
|
* @param fsPath The path to create
|
|
|
|
|
* @param maxDepth The maximum recursion depth
|
|
|
|
|
* @param depth The current recursion depth
|
|
|
|
|
*/
|
|
|
|
|
function mkdirP(fsPath, maxDepth = 1000, depth = 1) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
assert_1.ok(fsPath, 'a path argument must be provided');
|
|
|
|
|
fsPath = path.resolve(fsPath);
|
|
|
|
|
if (depth >= maxDepth)
|
|
|
|
|
return exports.mkdir(fsPath);
|
|
|
|
|
try {
|
|
|
|
|
yield exports.mkdir(fsPath);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
catch (err) {
|
|
|
|
|
switch (err.code) {
|
|
|
|
|
case 'ENOENT': {
|
|
|
|
|
yield mkdirP(path.dirname(fsPath), maxDepth, depth + 1);
|
|
|
|
|
yield exports.mkdir(fsPath);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
default: {
|
|
|
|
|
let stats;
|
|
|
|
|
try {
|
|
|
|
|
stats = yield exports.stat(fsPath);
|
|
|
|
|
}
|
|
|
|
|
catch (err2) {
|
|
|
|
|
throw err;
|
|
|
|
|
}
|
|
|
|
|
if (!stats.isDirectory())
|
|
|
|
|
throw err;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
exports.mkdirP = mkdirP;
|
|
|
|
|
/**
|
|
|
|
|
* Best effort attempt to determine whether a file exists and is executable.
|
|
|
|
|
* @param filePath file path to check
|
|
|
|
@ -2318,6 +2380,12 @@ function isUnixExecutable(stats) {
|
|
|
|
|
((stats.mode & 8) > 0 && stats.gid === process.getgid()) ||
|
|
|
|
|
((stats.mode & 64) > 0 && stats.uid === process.getuid()));
|
|
|
|
|
}
|
|
|
|
|
// Get the path of cmd.exe in windows
|
|
|
|
|
function getCmdPath() {
|
|
|
|
|
var _a;
|
|
|
|
|
return (_a = process.env['COMSPEC']) !== null && _a !== void 0 ? _a : `cmd.exe`;
|
|
|
|
|
}
|
|
|
|
|
exports.getCmdPath = getCmdPath;
|
|
|
|
|
//# sourceMappingURL=io-util.js.map
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
@ -2326,6 +2394,25 @@ function isUnixExecutable(stats) {
|
|
|
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
|
}));
|
|
|
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
|
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
|
|
|
}) : function(o, v) {
|
|
|
|
|
o["default"] = v;
|
|
|
|
|
});
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
@ -2335,19 +2422,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
|
|
|
result["default"] = mod;
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0;
|
|
|
|
|
const assert_1 = __nccwpck_require__(357);
|
|
|
|
|
const childProcess = __importStar(__nccwpck_require__(129));
|
|
|
|
|
const path = __importStar(__nccwpck_require__(622));
|
|
|
|
|
const util_1 = __nccwpck_require__(669);
|
|
|
|
|
const ioUtil = __importStar(__nccwpck_require__(962));
|
|
|
|
|
const exec = util_1.promisify(childProcess.exec);
|
|
|
|
|
const execFile = util_1.promisify(childProcess.execFile);
|
|
|
|
|
/**
|
|
|
|
|
* Copies a file or folder.
|
|
|
|
|
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
|
|
|
@ -2358,14 +2441,14 @@ const exec = util_1.promisify(childProcess.exec);
|
|
|
|
|
*/
|
|
|
|
|
function cp(source, dest, options = {}) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
const { force, recursive } = readCopyOptions(options);
|
|
|
|
|
const { force, recursive, copySourceDirectory } = readCopyOptions(options);
|
|
|
|
|
const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null;
|
|
|
|
|
// Dest is an existing file, but not forcing
|
|
|
|
|
if (destStat && destStat.isFile() && !force) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// If dest is an existing directory, should copy inside.
|
|
|
|
|
const newDest = destStat && destStat.isDirectory()
|
|
|
|
|
const newDest = destStat && destStat.isDirectory() && copySourceDirectory
|
|
|
|
|
? path.join(dest, path.basename(source))
|
|
|
|
|
: dest;
|
|
|
|
|
if (!(yield ioUtil.exists(source))) {
|
|
|
|
@ -2430,12 +2513,22 @@ function rmRF(inputPath) {
|
|
|
|
|
if (ioUtil.IS_WINDOWS) {
|
|
|
|
|
// Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
|
|
|
|
|
// program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
|
|
|
|
|
// Check for invalid characters
|
|
|
|
|
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
|
|
|
|
|
if (/[*"<>|]/.test(inputPath)) {
|
|
|
|
|
throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
const cmdPath = ioUtil.getCmdPath();
|
|
|
|
|
if (yield ioUtil.isDirectory(inputPath, true)) {
|
|
|
|
|
yield exec(`rd /s /q "${inputPath}"`);
|
|
|
|
|
yield exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, {
|
|
|
|
|
env: { inputPath }
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
yield exec(`del /f /a "${inputPath}"`);
|
|
|
|
|
yield exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, {
|
|
|
|
|
env: { inputPath }
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (err) {
|
|
|
|
@ -2468,7 +2561,7 @@ function rmRF(inputPath) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (isDir) {
|
|
|
|
|
yield exec(`rm -rf "${inputPath}"`);
|
|
|
|
|
yield execFile(`rm`, [`-rf`, `${inputPath}`]);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
yield ioUtil.unlink(inputPath);
|
|
|
|
@ -2486,7 +2579,8 @@ exports.rmRF = rmRF;
|
|
|
|
|
*/
|
|
|
|
|
function mkdirP(fsPath) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield ioUtil.mkdirP(fsPath);
|
|
|
|
|
assert_1.ok(fsPath, 'a path argument must be provided');
|
|
|
|
|
yield ioUtil.mkdir(fsPath, { recursive: true });
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
exports.mkdirP = mkdirP;
|
|
|
|
@ -2584,7 +2678,10 @@ exports.findInPath = findInPath;
|
|
|
|
|
function readCopyOptions(options) {
|
|
|
|
|
const force = options.force == null ? true : options.force;
|
|
|
|
|
const recursive = Boolean(options.recursive);
|
|
|
|
|
return { force, recursive };
|
|
|
|
|
const copySourceDirectory = options.copySourceDirectory == null
|
|
|
|
|
? true
|
|
|
|
|
: Boolean(options.copySourceDirectory);
|
|
|
|
|
return { force, recursive, copySourceDirectory };
|
|
|
|
|
}
|
|
|
|
|
function cpDirRecursive(sourceDir, destDir, currentDepth, force) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
@ -2689,6 +2786,20 @@ module.exports = require("path");;
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 304:
|
|
|
|
|
/***/ ((module) => {
|
|
|
|
|
|
|
|
|
|
module.exports = require("string_decoder");;
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 213:
|
|
|
|
|
/***/ ((module) => {
|
|
|
|
|
|
|
|
|
|
module.exports = require("timers");;
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 669:
|
|
|
|
|
/***/ ((module) => {
|
|
|
|
|
|
|
|
|
|