Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const eslintArgs = [
eslintCmd,
...(files ? files : ['.']),
...['--ext', extensions ? extensions : '.js,.jsx,.ts,.tsx'],
...(noEslintRc ? '--no-eslintrc' : []),
...(eslintConfigPath ? ['--config', eslintConfigPath] : []),
...(eslintIgnorePath ? ['--ignore-path', eslintIgnorePath] : []),
...(resolvePluginsPath ? ['--resolve-plugins-relative-to', resolvePluginsPath] : []),
...(fix ? ['--fix'] : []),
...(maxWarnings !== undefined ? ['--max-warnings', `${maxWarnings}`] : []),
'--color'
];
logger.info(encodeArgs(eslintArgs).join(' '));
return spawn(process.execPath, eslintArgs, { stdio: 'inherit' });
} else {
return Promise.resolve();
}
};
}
return function webpackDevServer() {
if (devServerCmd && configPath && fs.existsSync(configPath)) {
const mode = options.mode || 'development';
const args = [...(options.nodeArgs || []), devServerCmd, '--config', configPath, '--open', '--mode', mode];
logger.info(devServerCmd, encodeArgs(args).join(' '));
return spawn(process.execPath, args, { stdio: 'inherit' });
} else {
logger.warn('no webpack.serve.config.js configuration found, skipping');
return Promise.resolve();
}
};
}
...(options.nodeArgs || []),
jestCmd,
'--config',
configFile,
...(options.passWithNoTests ? ['--passWithNoTests'] : []),
...(options.colors !== false && supportsColor.stdout ? ['--colors'] : []),
...(options.runInBand ? ['--runInBand'] : []),
...(options.coverage ? ['--coverage'] : []),
...(options.watch ? ['--watch'] : []),
...(options.u || options.updateSnapshot ? ['--updateSnapshot'] : ['']),
...(options._ || [])
].filter(arg => !!arg) as Array;
logger.info(cmd, encodeArgs(args).join(' '));
return spawn(cmd, args, { stdio: 'inherit', env: options.env });
} else {
logger.warn('no jest configuration found, skipping jest');
return Promise.resolve();
}
};
}
const args = Object.keys(options).reduce(
(args, option) => {
if (typeof options[option] === 'string') {
return args.concat(['--' + option, options[option] as string]);
} else if (typeof options[option] === 'boolean') {
return args.concat(['--' + option]);
}
return args;
},
[tscCmd]
);
const cmd = [...args, '--watch'];
logger.info(encodeArgs(cmd).join(' '));
return spawn(process.execPath, cmd, { stdio: 'inherit' });
} else {
Promise.resolve();
}
};
}