How to use the @pnpm/filter-lockfile function in @pnpm/filter-lockfile

To help you get started, we’ve selected a few @pnpm/filter-lockfile 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 / modules-cleaner / src / prune.ts View on Github external
opts: {
    dryRun?: boolean,
    include: { [dependenciesField in DependenciesField]: boolean },
    hoistedAliases: {[depPath: string]: string[]},
    hoistedModulesDir?: string,
    wantedLockfile: Lockfile,
    currentLockfile: Lockfile,
    pruneStore?: boolean,
    registries: Registries,
    skipped: Set,
    virtualStoreDir: string,
    lockfileDir: string,
    storeController: StoreController,
  },
): Promise> {
  const wantedLockfile = filterLockfile(opts.wantedLockfile, {
    include: opts.include,
    registries: opts.registries,
    skipped: opts.skipped,
  })
  await Promise.all(importers.map(async ({ binsDir, id, modulesDir, pruneDirectDependencies, removePackages, rootDir }) => {
    const currentImporter = opts.currentLockfile.importers[id] || {} as LockfileImporter
    const currentPkgs = R.toPairs(mergeDependencies(currentImporter))
    const wantedPkgs = R.toPairs(mergeDependencies(wantedLockfile.importers[id]))

    const allCurrentPackages = new Set(
      (pruneDirectDependencies || removePackages?.length)
        ? (await readModulesDir(modulesDir) || [])
        : [],
    )
    const depsToRemove = new Set([
      ...(removePackages || []).filter((removePackage) => allCurrentPackages.has(removePackage)),

@pnpm/filter-lockfile

Filters a lockfile

MIT
Latest version published 5 months ago

Package Health Score

62 / 100
Full package analysis