How to use @pnpm/package-bins - 1 common examples

To help you get started, we’ve selected a few @pnpm/package-bins 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 / removeDirectDependency.ts View on Github external
async function removeBins (
  uninstalledPkg: string,
  opts: {
    dryRun?: boolean,
    modulesDir: string,
    binsDir: string,
  },
) {
  const uninstalledPkgPath = path.join(opts.modulesDir, uninstalledPkg)
  const uninstalledPkgJson = await safeReadPackageFromDir(uninstalledPkgPath) as DependencyManifest

  if (!uninstalledPkgJson) return
  const cmds = await binify(uninstalledPkgJson, uninstalledPkgPath)

  if (!opts.dryRun) {
    // TODO: what about the .cmd bin files on Windows?
    await Promise.all(
      cmds
        .map((cmd) => path.join(opts.binsDir, cmd.name))
        .map(remove),
    )
  }

  return uninstalledPkgJson
}

@pnpm/package-bins

Returns bins of a package

MIT
Latest version published 27 days ago

Package Health Score

68 / 100
Full package analysis

Popular @pnpm/package-bins functions