Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
include: ctx.include,
lockfileDir: opts.lockfileDir,
registries: ctx.registries,
skipped: ctx.skipped,
storeController: opts.storeController,
virtualStoreDir: ctx.virtualStoreDir,
wantedLockfile: updatedCurrentLockfile,
},
)
// Linking should happen after removing orphans
// Otherwise would've been removed
for (const { alias, manifest, path } of linkedPkgs) {
// TODO: cover with test that linking reports with correct dependency types
const stu = specsToUpsert.find((s) => s.alias === manifest.name)
await symlinkDirectRootDependency(path, destModules, alias, {
fromDependenciesField: stu?.saveType ?? opts.targetDependenciesField,
linkedPackage: manifest,
prefix: opts.dir,
})
}
const linkToBin = maybeOpts?.linkToBin || path.join(destModules, '.bin')
await linkBinsOfPackages(linkedPkgs.map((p) => ({ manifest: p.manifest, location: p.path })), linkToBin, {
warn: (message: string) => logger.warn({ message, prefix: opts.dir }),
})
let newPkg!: ImporterManifest
if (opts.targetDependenciesField) {
newPkg = await save(opts.dir, opts.manifest, specsToUpsert)
for (const { alias } of specsToUpsert) {
updatedWantedLockfile.importers[importerId].specifiers[alias] = getSpecFromPackageManifest(newPkg, alias)
Promise.all(importer.linkedDependencies.map((linkedDependency) => {
const depLocation = resolvePath(importer.rootDir, linkedDependency.resolution.directory)
return symlinkDirectRootDependency(depLocation, importer.modulesDir, linkedDependency.alias, {
fromDependenciesField: linkedDependency.dev && 'devDependencies' || linkedDependency.optional && 'optionalDependencies' || 'dependencies',
linkedPackage: linkedDependency,
prefix: importer.rootDir,
})
})),
),