Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
},
): Promise<{
currentLockfile: Lockfile,
existsCurrentLockfile: boolean,
existsWantedLockfile: boolean,
wantedLockfile: Lockfile,
}> {
// ignore `pnpm-lock.yaml` on CI servers
// a latest pnpm should not break all the builds
const lockfileOpts = {
ignoreIncompatible: opts.force || isCI,
wantedVersion: LOCKFILE_VERSION,
}
const files = await Promise.all([
opts.useLockfile && readWantedLockfile(opts.lockfileDir, lockfileOpts)
|| await existsWantedLockfile(opts.lockfileDir) &&
logger.warn({
message: `A ${WANTED_LOCKFILE} file exists. The current configuration prohibits to read or write a lockfile`,
prefix: opts.lockfileDir,
}),
readCurrentLockfile(opts.virtualStoreDir, lockfileOpts),
])
const sopts = { lockfileVersion: LOCKFILE_VERSION }
const importerIds = opts.importers.map((importer) => importer.id)
const currentLockfile = files[1] || createLockfileObject(importerIds, sopts)
for (const importerId of importerIds) {
if (!currentLockfile.importers[importerId]) {
currentLockfile.importers[importerId] = {
specifiers: {},
}
}
}