How to use the @pnpm/lockfile-file.getLockfileImporterId 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 / supi / src / link / index.ts View on Github external
maybeOpts: LinkOptions & {
    linkToBin?: string,
    dir: string,
  },
) {
  const reporter = maybeOpts?.reporter
  if (reporter) {
    streamParser.on('data', reporter)
  }
  const opts = await extendOptions(maybeOpts)
  const ctx = await getContextForSingleImporter(opts.manifest, {
    ...opts,
    extraBinPaths: [], // ctx.extraBinPaths is not needed, so this is fine
  })

  const importerId = getLockfileImporterId(ctx.lockfileDir, opts.dir)
  const currentLockfile = R.clone(ctx.currentLockfile)
  const linkedPkgs: Array<{path: string, manifest: DependencyManifest, alias: string}> = []
  const specsToUpsert = [] as PackageSpecObject[]

  for (const linkFrom of linkFromPkgs) {
    let linkFromPath: string
    let linkFromAlias: string | undefined
    if (typeof linkFrom === 'string') {
      linkFromPath = linkFrom
    } else {
      linkFromPath = linkFrom.path
      linkFromAlias = linkFrom.alias
    }
    const { manifest } = await readImporterManifest(linkFromPath) as { manifest: DependencyManifest }
    specsToUpsert.push({
      alias: manifest.name,
github pnpm / pnpm / packages / plugin-commands-outdated / src / outdated.ts View on Github external
return Promise.all(pkgs.map(async ({ dir, manifest }) => {
    let match = args.length && matcher(args) || undefined
    return {
      manifest,
      outdatedPackages: await outdated({
        currentLockfile,
        getLatestManifest,
        lockfileDir,
        manifest,
        match,
        prefix: dir,
        wantedLockfile,
      }),
      prefix: getLockfileImporterId(lockfileDir, dir),
    }
  }))
}
github pnpm / pnpm / packages / plugin-commands-recursive / src / outdated.ts View on Github external
outdatedPackages.forEach((outdatedPkg) => {
        const key = JSON.stringify([outdatedPkg.packageName, outdatedPkg.belongsTo])
        if (!outdatedByNameAndType[key]) {
          outdatedByNameAndType[key] = { ...outdatedPkg, dependentPkgs: [] }
        }
        outdatedByNameAndType[key].dependentPkgs.push({ location: getLockfileImporterId(opts.dir, dir), manifest })
      })
    }))
github pnpm / pnpm / packages / read-importers-context / src / index.ts View on Github external
importers.map(async (importer) => {
        const modulesDir = await realNodeModulesDir(importer.rootDir)
        const importerId = getLockfileImporterId(lockfileDir, importer.rootDir)

        return {
          ...importer,
          binsDir: importer.binsDir || path.join(importer.rootDir, 'node_modules', '.bin'),
          id: importerId,
          modulesDir,
        }
      })),
    include: modules?.included || { dependencies: true, devDependencies: true, optionalDependencies: true },