A better fix

This commit is contained in:
Peter Hedenskog 2025-01-31 14:30:12 +01:00
parent 88f12b0b19
commit b70dd79536
1 changed files with 5 additions and 17 deletions

View File

@ -25,20 +25,8 @@ const version = require('../../package.json').version;
const configFiles = ['.sitespeed.io.json'];
function fixAndroidArgs() {
const original = hideBin(process.argv);
// We need to replave --android, else
// we end up with the android object becoming
// an array
const fixed = [];
for (const arg of original) {
if (arg === '--android') {
fixed.push('--android.enabled', 'true');
} else {
fixed.push(arg);
}
}
return fixed;
function fixAndroidArgs(args) {
return args.map(arg => (arg === '--android' ? '--android.enabled' : arg));
}
if (process.argv.includes('--config')) {
@ -230,8 +218,8 @@ function validateInput(argv) {
}
export async function parseCommandLine() {
const argvFix = fixAndroidArgs();
let yargsInstance = yargs(hideBin(argvFix));
const fixedArgs = fixAndroidArgs(hideBin(process.argv));
const yargsInstance = yargs(fixedArgs);
let parsed = yargsInstance
.parserConfiguration({
'camel-case-expansion': false,
@ -2207,7 +2195,7 @@ export async function parseCommandLine() {
if (argv.ios) {
set(argv, 'safari.ios', true);
} else if (argv.android && argv.browser === 'chrome') {
} else if (argv.android.enabled === true && argv.browser === 'chrome') {
// Default to Chrome Android.
set(
argv,