Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return this.asyncAction(async (projectDir: string, ...args: any[]) => {
const opts = args[0];
if (!projectDir) {
projectDir = process.cwd();
} else {
projectDir = path.resolve(process.cwd(), projectDir);
}
if (opts.config) {
const pathToConfig = path.resolve(process.cwd(), opts.config);
if (!fs.existsSync(pathToConfig)) {
throw new Error(`File at provide config path does not exist: ${pathToConfig}`);
}
ConfigUtils.setCustomConfigPath(projectDir, pathToConfig);
}
const logLines = (msg: any, logFn: (...args: any[]) => void) => {
if (typeof msg === 'string') {
for (let line of msg.split('\n')) {
logFn(line);
}
} else {
logFn(msg);
}
};
const logStackTrace = (
chunk: LogRecord,
logFn: (...args: any[]) => void,
nestedLogFn: (...args: any[]) => void