Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
context.output.print(`${chalk.green('✔')} ${specified} Sanity modules are at latest versions`)
return
}
// Forcefully remove non-symlinked module paths to force upgrade
await Promise.all(
needsUpdate.map(mod =>
deleteIfNotSymlink(
path.join(context.workDir, 'node_modules', mod.name.replace(/\//g, path.sep))
)
)
)
// Replace versions in `package.json`
const versionPrefix = saveExact ? '' : '^'
const oldManifest = await readLocalManifest(workDir)
const newManifest = needsUpdate.reduce((target, mod) => {
if (oldManifest.dependencies && oldManifest.dependencies[mod.name]) {
target.dependencies[mod.name] =
mod.latest === 'unknown' ? oldManifest.dependencies[mod.name] : versionPrefix + mod.latest
}
if (oldManifest.devDependencies && oldManifest.devDependencies[mod.name]) {
target.devDependencies[mod.name] =
mod.latest === 'unknown'
? oldManifest.devDependencies[mod.name]
: versionPrefix + mod.latest
}
return target
}, oldManifest)
async function removeFromSanityManifest(workDir, pluginName) {
const manifest = await readLocalManifest(workDir, 'sanity.json')
manifest.plugins = without(manifest.plugins || [], pluginName)
return fse.writeJson(path.join(workDir, 'sanity.json'), manifest, {spaces: 2})
}