Update to latest yarg version (#3413)
* Update to latest BT and make sure yarg-versions match * fix for changed coerce functionality * Use 12
This commit is contained in:
parent
8d66daf2d4
commit
a368dfe3a4
|
|
@ -1442,64 +1442,72 @@ module.exports.parseCommandLine = function parseCommandLine() {
|
|||
.config(config)
|
||||
.alias('version', 'V')
|
||||
.coerce('budget', function(arg) {
|
||||
if (typeof arg === 'object' && !Array.isArray(arg)) {
|
||||
if (arg.configPath) {
|
||||
arg.config = JSON.parse(fs.readFileSync(arg.configPath, 'utf8'));
|
||||
} else if (arg.config) {
|
||||
arg.config = JSON.parse(arg.config);
|
||||
if (arg) {
|
||||
if (typeof arg === 'object' && !Array.isArray(arg)) {
|
||||
if (arg.configPath) {
|
||||
arg.config = JSON.parse(fs.readFileSync(arg.configPath, 'utf8'));
|
||||
} else if (arg.config) {
|
||||
arg.config = JSON.parse(arg.config);
|
||||
}
|
||||
return arg;
|
||||
} else {
|
||||
throw new Error(
|
||||
'[ERROR] Something looks wrong with your budget configuration. Since sitespeed.io 4.4 you should pass the path to your budget file through the --budget.configPath flag instead of directly through the --budget flag.'
|
||||
);
|
||||
}
|
||||
return arg;
|
||||
} else {
|
||||
throw new Error(
|
||||
'[ERROR] Something looks wrong with your budget configuration. Since sitespeed.io 4.4 you should pass the path to your budget file through the --budget.configPath flag instead of directly through the --budget flag.'
|
||||
);
|
||||
}
|
||||
})
|
||||
.coerce('crawler', crawler => {
|
||||
if (crawler.exclude) {
|
||||
if (!Array.isArray(crawler.exclude)) {
|
||||
crawler.exclude = [crawler.exclude];
|
||||
if (crawler) {
|
||||
if (crawler.exclude) {
|
||||
if (!Array.isArray(crawler.exclude)) {
|
||||
crawler.exclude = [crawler.exclude];
|
||||
}
|
||||
crawler.exclude = crawler.exclude.map(e => new RegExp(e));
|
||||
}
|
||||
crawler.exclude = crawler.exclude.map(e => new RegExp(e));
|
||||
}
|
||||
|
||||
if (crawler.include) {
|
||||
if (!Array.isArray(crawler.include)) {
|
||||
crawler.include = [crawler.include];
|
||||
if (crawler.include) {
|
||||
if (!Array.isArray(crawler.include)) {
|
||||
crawler.include = [crawler.include];
|
||||
}
|
||||
crawler.include = crawler.include.map(e => new RegExp(e));
|
||||
}
|
||||
crawler.include = crawler.include.map(e => new RegExp(e));
|
||||
}
|
||||
|
||||
return crawler;
|
||||
return crawler;
|
||||
}
|
||||
})
|
||||
.coerce('plugins', plugins => {
|
||||
if (plugins.add && !Array.isArray(plugins.add)) {
|
||||
plugins.add = plugins.add.split(',');
|
||||
if (plugins) {
|
||||
if (plugins.add && !Array.isArray(plugins.add)) {
|
||||
plugins.add = plugins.add.split(',');
|
||||
}
|
||||
if (plugins.remove && !Array.isArray(plugins.remove)) {
|
||||
plugins.remove = plugins.remove.split(',');
|
||||
}
|
||||
return plugins;
|
||||
}
|
||||
if (plugins.remove && !Array.isArray(plugins.remove)) {
|
||||
plugins.remove = plugins.remove.split(',');
|
||||
}
|
||||
return plugins;
|
||||
})
|
||||
.coerce('webpagetest', function(arg) {
|
||||
// for backwards compatible reasons we check if the passed parameters is a path to a script, if so just us it (PR #1445)
|
||||
if (arg.script && fs.existsSync(arg.script)) {
|
||||
arg.script = fs.readFileSync(path.resolve(arg.script), 'utf8');
|
||||
/* eslint no-console: off */
|
||||
console.log(
|
||||
'[WARNING] Since sitespeed.io 4.4 you should pass the path to the script file through the --webpagetest.file flag (https://github.com/sitespeedio/sitespeed.io/pull/1445).'
|
||||
);
|
||||
if (arg) {
|
||||
// for backwards compatible reasons we check if the passed parameters is a path to a script, if so just us it (PR #1445)
|
||||
if (arg.script && fs.existsSync(arg.script)) {
|
||||
arg.script = fs.readFileSync(path.resolve(arg.script), 'utf8');
|
||||
/* eslint no-console: off */
|
||||
console.log(
|
||||
'[WARNING] Since sitespeed.io 4.4 you should pass the path to the script file through the --webpagetest.file flag (https://github.com/sitespeedio/sitespeed.io/pull/1445).'
|
||||
);
|
||||
return arg;
|
||||
}
|
||||
|
||||
if (arg.file) {
|
||||
arg.script = fs.readFileSync(path.resolve(arg.file), 'utf8');
|
||||
} else if (arg.script) {
|
||||
// because the escaped characters are passed re-escaped from the console
|
||||
arg.script = arg.script.split('\\t').join('\t');
|
||||
arg.script = arg.script.split('\\n').join('\n');
|
||||
}
|
||||
return arg;
|
||||
}
|
||||
|
||||
if (arg.file) {
|
||||
arg.script = fs.readFileSync(path.resolve(arg.file), 'utf8');
|
||||
} else if (arg.script) {
|
||||
// because the escaped characters are passed re-escaped from the console
|
||||
arg.script = arg.script.split('\\t').join('\t');
|
||||
arg.script = arg.script.split('\\n').join('\n');
|
||||
}
|
||||
return arg;
|
||||
})
|
||||
// .describe('browser', 'Specify browser')
|
||||
.wrap(yargs.terminalWidth())
|
||||
|
|
|
|||
|
|
@ -6371,9 +6371,9 @@
|
|||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
|
||||
},
|
||||
"yargs": {
|
||||
"version": "16.2.0",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
|
||||
"integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
|
||||
"version": "17.0.1",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.0.1.tgz",
|
||||
"integrity": "sha512-xBBulfCc8Y6gLFcrPvtqKz9hz8SO0l1Ni8GgDekvBX2ro0HRQImDGnikfc33cgzcYUSncapnNcZDjVFIH3f6KQ==",
|
||||
"requires": {
|
||||
"cliui": "^7.0.2",
|
||||
"escalade": "^3.1.1",
|
||||
|
|
@ -6382,92 +6382,6 @@
|
|||
"string-width": "^4.2.0",
|
||||
"y18n": "^5.0.5",
|
||||
"yargs-parser": "^20.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-regex": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
|
||||
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg=="
|
||||
},
|
||||
"ansi-styles": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"requires": {
|
||||
"color-convert": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"cliui": {
|
||||
"version": "7.0.4",
|
||||
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
|
||||
"integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
|
||||
"requires": {
|
||||
"string-width": "^4.2.0",
|
||||
"strip-ansi": "^6.0.0",
|
||||
"wrap-ansi": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"requires": {
|
||||
"color-name": "~1.1.4"
|
||||
}
|
||||
},
|
||||
"color-name": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
||||
},
|
||||
"emoji-regex": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
|
||||
},
|
||||
"is-fullwidth-code-point": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
||||
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="
|
||||
},
|
||||
"string-width": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz",
|
||||
"integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==",
|
||||
"requires": {
|
||||
"emoji-regex": "^8.0.0",
|
||||
"is-fullwidth-code-point": "^3.0.0",
|
||||
"strip-ansi": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
|
||||
"integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
|
||||
"requires": {
|
||||
"ansi-regex": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"wrap-ansi": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
|
||||
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
|
||||
"requires": {
|
||||
"ansi-styles": "^4.0.0",
|
||||
"string-width": "^4.1.0",
|
||||
"strip-ansi": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"y18n": {
|
||||
"version": "5.0.5",
|
||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz",
|
||||
"integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg=="
|
||||
},
|
||||
"yargs-parser": {
|
||||
"version": "20.2.4",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz",
|
||||
"integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"yargs-parser": {
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@
|
|||
"tape": "4.13.0",
|
||||
"text-table": "0.2.0",
|
||||
"uuid": "8.3.2",
|
||||
"yargs": "16.2.0"
|
||||
"yargs": "17.0.1"
|
||||
},
|
||||
"config": {
|
||||
"commitizen": {
|
||||
|
|
|
|||
Loading…
Reference in New Issue