Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return async function outdated() {
logger.info(`Fetching Outdated Dependency Versions`);
if (options.versionSpec) {
const versionInfo = await fetchVersions(options.versionSpec);
const updateVersions = getUpdateVersions(options.versionSpec, versionInfo);
const packageJsonFile = resolveCwd('./package.json', path.dirname(resolve('./just-task.js')!));
console.log(packageJsonFile);
if (packageJsonFile) {
const packageJson = JSON.parse(fs.readFileSync(packageJsonFile).toString());
if (Object.keys(updateVersions).length > 0) {
Object.keys(updateVersions).forEach(name => {
if (packageJson.devDependencies && packageJson.devDependencies[name]) {
packageJson.devDependencies[name] = getPackageVersionSpec(packageJson.devDependencies[name], updateVersions[name]);
logger.info(` ${chalk.cyan(name)} updated to '${chalk.yellow(updateVersions[name])}' (devDependencies)`);
const eslintIgnorePath = ignorePath || resolveCwd('.eslintignore');
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();
}
};
}
fs.writeFileSync(statsFile, JSON.stringify(stats.toJson(), null, 2));
}
if (err || stats.hasErrors()) {
const errorStats = stats.toJson('errors-only');
errorStats.errors.forEach((error: any) => {
logger.error(error);
});
reject(`Webpack failed with ${errorStats.errors.length} error(s).`);
} else {
resolve();
}
});
});
} else {
logger.info('webpack.config.js not found, skipping webpack');
}
return;
};
}
return function tslint() {
const tslintCmd = resolve('tslint/lib/tslintCli.js');
if (projectFile && tslintCmd && fs.existsSync(projectFile)) {
logger.info(`Running tslint`);
const args = [
'--project',
projectFile,
'-t',
'stylish',
'-r',
path.dirname(resolve('tslint-microsoft-contrib') || '')
];
if (options.fix) {
args.push('--fix');
}
const cmd = encodeArgs([process.execPath, tslintCmd, ...args]).join(' ');
logger.info(cmd);
}).then(() => {
logger.info("Success", "Unzip finished");
if(os === "mac") {
return globPromise(path.join(__dirname, '../tmp/Agora_Native_SDK_for_Mac_FULL/libs/AgoraRtcEngineKit.framework/'))
} else {
return globPromise(path.join(__dirname, '../tmp/Agora_Native_SDK_for_Windows*/'))
}
}).then(folder => {
if(os === "mac") {
const cmd = process.execPath;
const args = [
...(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();
}
};
}
? () => {
logger.info(`${name} task is disabled in package.json`);
}
: taskFunction
}).then(() => {
logger.info("Success", "Prepare finished");
resolve()
}).catch(err => {
logger.error("Failed: ", err);
return function jest() {
const jestCmd = resolve('jest/bin/jest.js');
const configFile = options.config || jestConfigFile;
if (configFile && jestCmd && existsSync(configFile)) {
logger.info(`Running Jest`);
const cmd = process.execPath;
const args = [
...(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(' '));
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 = encodeArgs([process.execPath, ...args]).join(' ');
logger.info(`Executing: ${cmd}`);
return exec(cmd);
} else {
Promise.resolve();
}
};
}