Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let bin;
if (process.env.STAGE === Stage.dev) {
bin = join(__dirname, '../../../../node_modules/.bin/npm-check');
} else {
const npmCheckPathOne = join(__dirname, '../../../npm-check-support-yarn/bin/cli.js');
const npmCheckPathTwo = join(__dirname, '../../node_modules/npm-check-support-yarn/bin/cli.js');
if (existsSync(npmCheckPathOne)) {
bin = npmCheckPathOne;
} else if (existsSync(npmCheckPathTwo)) {
bin = npmCheckPathTwo;
} else {
throw new Error('No npm-check package found globally');
}
}
preferredPm(process.cwd())
.then((pm) => {
const pmName = pm.name;
const env = Object.create( process.env );
env.UPDATE_INSTALLER = pmName;
const child = spawn(
bin,
[
'--update',
'--ignore', notArtPkgGlob,
'--skip-unused'
],
{
stdio: 'inherit',
env
}
);