How to use the @pnpm/lockfile-file.createLockfileObject function in @pnpm/lockfile-file

To help you get started, we’ve selected a few @pnpm/lockfile-file examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pnpm / pnpm / packages / get-context / src / readLockfiles.ts View on Github external
}),
    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: {},
      }
    }
  }
  const wantedLockfile = files[0] ||
    currentLockfile && R.clone(currentLockfile) ||
    createLockfileObject(importerIds, sopts)
  for (const importerId of importerIds) {
    if (!wantedLockfile.importers[importerId]) {
      wantedLockfile.importers[importerId] = {
        specifiers: {},
      }
    }
  }
  return {
    currentLockfile,
    existsCurrentLockfile: !!files[1],
    existsWantedLockfile: !!files[0],
    wantedLockfile,
  }
}
github pnpm / pnpm / packages / get-context / src / readLockfiles.ts View on Github external
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: {},
      }
    }
  }
  const wantedLockfile = files[0] ||
    currentLockfile && R.clone(currentLockfile) ||
    createLockfileObject(importerIds, sopts)
  for (const importerId of importerIds) {
    if (!wantedLockfile.importers[importerId]) {
      wantedLockfile.importers[importerId] = {
        specifiers: {},
      }
    }