Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// skipped packages might have not been reanalized on a repeat install
// so lets just ignore those by excluding nulls
.filter(Boolean)
.map(({ fetchingFiles }) => fetchingFiles()),
)
// waiting till package requests are finished
await Promise.all(R.values(resolvedPackagesByPackageId).map(({ finishing }) => finishing()))
const lockfileOpts = { forceSharedFormat: opts.forceSharedLockfile }
if (opts.lockfileOnly) {
await writeWantedLockfile(ctx.lockfileDir, result.wantedLockfile, lockfileOpts)
} else {
await Promise.all([
opts.useLockfile
? writeLockfiles({
currentLockfile: result.currentLockfile,
currentLockfileDir: ctx.virtualStoreDir,
wantedLockfile: result.wantedLockfile,
wantedLockfileDir: ctx.lockfileDir,
...lockfileOpts,
})
: writeCurrentLockfile(ctx.virtualStoreDir, result.currentLockfile, lockfileOpts),
(() => {
if (result.currentLockfile.packages === undefined && result.removedDepPaths.size === 0) {
return Promise.resolve()
}
return writeModulesYaml(ctx.rootModulesDir, {
...ctx.modulesFile,
hoistedAliases: result.newHoistedAliases,
hoistPattern: ctx.hoistPattern,
included: ctx.include,
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)
}
} else {
newPkg = opts.manifest
}
const lockfileOpts = { forceSharedFormat: opts.forceSharedLockfile }
if (opts.useLockfile) {
await writeLockfiles({
currentLockfile: updatedCurrentLockfile,
currentLockfileDir: ctx.virtualStoreDir,
wantedLockfile: updatedWantedLockfile,
wantedLockfileDir: ctx.lockfileDir,
...lockfileOpts,
})
} else {
await writeCurrentLockfile(ctx.virtualStoreDir, updatedCurrentLockfile, lockfileOpts)
}
summaryLogger.debug({ prefix: opts.dir })
if (reporter) {
streamParser.removeListener('data', reporter)
}
],
lockfileDirectory: opts.lockfileDirectory,
newLockfile,
oldLockfile: ctx.currentLockfile,
registries: ctx.registries,
storeController: opts.storeController,
virtualStoreDir: ctx.virtualStoreDir,
})
ctx.pendingBuilds = ctx.pendingBuilds.filter((pkgId) => !removedPkgIds.has(dp.resolve(ctx.registries, pkgId)))
await opts.storeController.close()
const currentLockfile = makePartialCurrentLockfile
? pruneLockfile(ctx.currentLockfile, pkg, ctx.importerId, { defaultRegistry: ctx.registries.default })
: newLockfile
const lockfileOpts = { forceSharedFormat: opts.forceSharedLockfile }
if (opts.useLockfile) {
await writeLockfiles(ctx.lockfileDirectory, newLockfile, currentLockfile, lockfileOpts)
} else {
await writeCurrentLockfile(ctx.lockfileDirectory, currentLockfile, lockfileOpts)
}
if (opts.shamefullyFlatten) {
ctx.hoistedAliases = await shamefullyFlattenByLockfile(currentLockfile, ctx.importerId, {
getIndependentPackageLocation: opts.independentLeaves
? async (packageId: string, packageName: string) => {
const { directory } = await opts.storeController.getPackageLocation(packageId, packageName, {
lockfileDirectory: ctx.lockfileDirectory,
targetEngine: opts.sideEffectsCacheRead && ENGINE_NAME || undefined,
})
return directory
}
: undefined,
lockfileDirectory: opts.lockfileDirectory,