Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const depsGroupsToCheck = _.filter(DEPS_GROUPS, ({name}) => !!opts[name]);
const depsGroupsToCheckStr = (depsGroupsToCheck.length === DEPS_GROUPS.length) ?
'' : `${toSentence(_.map(depsGroupsToCheck, ({name}) => strong(name)))} `;
const filteredWith = filter ? `filtered with ${strong(filter)} ` : '';
console.log(
`Checking for outdated ${depsGroupsToCheckStr}dependencies ${filteredWith}for "${strong(packageFile)}"...`
);
const ncuDepGroups = DEPS_GROUPS
.filter(({name}) => opts[name])
.map(({ncuValue}) => ncuValue)
.join(',');
const currentVersions = ncu.getCurrentDependencies(packageJson, {dep: ncuDepGroups});
const latestVersions = await ncu.queryVersions(currentVersions, {versionTarget: 'latest'});
let upgradedVersions = ncu.upgradeDependencies(currentVersions, latestVersions);
// Filtering modules that have to be updated
upgradedVersions = _.pickBy(
upgradedVersions,
(newVersion, moduleName) => filterModuleName(moduleName)
);
if (_.isEmpty(upgradedVersions)) {
return console.log(success('All dependencies are up-to-date!'));
}
// Getting the list of ignored modules
const config = new Config();
config.ignore = config.ignore || {};
// Making arrays of outdated modules