mirror of
https://github.com/deployphp/action.git
synced 2025-06-29 04:34:15 +00:00
Update action
This commit is contained in:
parent
c17d254b53
commit
2c2db8c641
59 changed files with 1430 additions and 4763 deletions
30
node_modules/execa/lib/command.js
generated
vendored
30
node_modules/execa/lib/command.js
generated
vendored
|
@ -1,14 +1,33 @@
|
|||
'use strict';
|
||||
const SPACES_REGEXP = / +/g;
|
||||
|
||||
const joinCommand = (file, args = []) => {
|
||||
const normalizeArgs = (file, args = []) => {
|
||||
if (!Array.isArray(args)) {
|
||||
return file;
|
||||
return [file];
|
||||
}
|
||||
|
||||
return [file, ...args].join(' ');
|
||||
return [file, ...args];
|
||||
};
|
||||
|
||||
const NO_ESCAPE_REGEXP = /^[\w.-]+$/;
|
||||
const DOUBLE_QUOTES_REGEXP = /"/g;
|
||||
|
||||
const escapeArg = arg => {
|
||||
if (typeof arg !== 'string' || NO_ESCAPE_REGEXP.test(arg)) {
|
||||
return arg;
|
||||
}
|
||||
|
||||
return `"${arg.replace(DOUBLE_QUOTES_REGEXP, '\\"')}"`;
|
||||
};
|
||||
|
||||
const joinCommand = (file, args) => {
|
||||
return normalizeArgs(file, args).join(' ');
|
||||
};
|
||||
|
||||
const getEscapedCommand = (file, args) => {
|
||||
return normalizeArgs(file, args).map(arg => escapeArg(arg)).join(' ');
|
||||
};
|
||||
|
||||
const SPACES_REGEXP = / +/g;
|
||||
|
||||
// Handle `execa.command()`
|
||||
const parseCommand = command => {
|
||||
const tokens = [];
|
||||
|
@ -28,5 +47,6 @@ const parseCommand = command => {
|
|||
|
||||
module.exports = {
|
||||
joinCommand,
|
||||
getEscapedCommand,
|
||||
parseCommand
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue