How to use the @pnpm/link-bins function in @pnpm/link-bins

To help you get started, we’ve selected a few @pnpm/link-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 microsoft / rushstack / apps / rush-lib / src / logic / pnpm / PnpmLinkManager.ts View on Github external
}

    PnpmLinkManager._createSymlinksForTopLevelProject(localPackage);

    if (!this._rushConfiguration.experimentsConfiguration.configuration.legacyIncrementalBuildDependencyDetection) {
      pnpmProjectDependencyManifest.save();
    } else {
      pnpmProjectDependencyManifest.deleteIfExists();
    }

    // Also symlink the ".bin" folder
    const projectFolder: string = path.join(localPackage.folderPath, 'node_modules');
    const projectBinFolder: string = path.join(localPackage.folderPath, 'node_modules', '.bin');

    // Return type is Promise because the API returns Promise.all()
    return pnpmLinkBins(projectFolder, projectBinFolder)
      .then(() => { /* empty block */ });
  }
github pnpm / pnpm / packages / build-modules / src / index.ts View on Github external
})
      .map(async (alias) => {
        const dep = depGraph[childrenToLink[alias]]
        return {
          location: dep.peripheralLocation,
          manifest: await dep.fetchingBundledManifest?.() || (await readPackageFromDir(dep.peripheralLocation) as DependencyManifest),
        }
      }),
  )

  await linkBinsOfPackages(pkgs, binPath, { warn: opts.warn })

  // link also the bundled dependencies` bins
  if (depNode.hasBundledDependencies) {
    const bundledModules = path.join(depNode.peripheralLocation, 'node_modules')
    await linkBins(bundledModules, binPath, { warn: opts.warn })
  }
}
github pnpm / pnpm / packages / hoist / src / index.ts View on Github external
lockfileDir: opts.lockfileDir,
      registries: opts.registries,
      virtualStoreDir: opts.virtualStoreDir,
    },
  )

  const aliasesByDependencyPath = await hoistGraph(deps, opts.lockfile.importers['.'].specifiers, {
    dryRun: false,
    match,
    modulesDir: opts.modulesDir,
  })

  const bin = path.join(opts.modulesDir, '.bin')
  const warn = (message: string) => logger.warn({ message, prefix: path.join(opts.modulesDir, '../..') })
  try {
    await linkBins(opts.modulesDir, bin, { allowExoticManifests: true, warn })
  } catch (err) {
    // Some packages generate their commands with lifecycle hooks.
    // At this stage, such commands are not generated yet.
    // For now, we don't hoist such generated commands.
    // Related issue: https://github.com/pnpm/pnpm/issues/2071
  }

  return aliasesByDependencyPath
}
github pnpm / pnpm / packages / plugin-commands-rebuild / src / implementation / index.ts View on Github external
const pkgRoot = !independent
        ? path.join(ctx.virtualStoreDir, pkgIdToFilename(depPath, opts.lockfileDir), 'node_modules', pkgInfo.name)
        : await (
          async () => {
            const { dir } = await opts.storeController.getPackageLocation(pkgSnapshot.id || depPath, pkgInfo.name, {
              lockfileDir: opts.lockfileDir,
              targetEngine: opts.sideEffectsCacheRead && !opts.force && ENGINE_NAME || undefined,
            })
            return dir
          }
        )()
      try {
        if (!independent) {
          const modules = path.join(ctx.virtualStoreDir, pkgIdToFilename(depPath, opts.lockfileDir), 'node_modules')
          const binPath = path.join(pkgRoot, 'node_modules', '.bin')
          await linkBins(modules, binPath, { warn })
        }
        await runPostinstallHooks({
          depPath,
          extraBinPaths: ctx.extraBinPaths,
          optional: pkgSnapshot.optional === true,
          pkgRoot,
          prepare: pkgSnapshot.prepare,
          rawConfig: opts.rawConfig,
          rootNodeModulesDir: ctx.rootModulesDir,
          unsafePerm: opts.unsafePerm || false,
        })
        pkgsThatWereRebuilt.add(relDepPath)
      } catch (err) {
        if (pkgSnapshot.optional) {
          // TODO: add parents field to the log
          skippedOptionalDependencyLogger.debug({
github pnpm / pnpm / packages / supi / src / install / index.ts View on Github external
function linkBinsOfImporter ({ modulesDir, binsDir, rootDir }: ImporterToLink) {
  const warn = (message: string) => logger.warn({ message, prefix: rootDir })
  return linkBins(modulesDir, binsDir, { allowExoticManifests: true, warn })
}

@pnpm/link-bins

Link bins to node_modules/.bin

MIT
Latest version published 1 month ago

Package Health Score

68 / 100
Full package analysis

Popular @pnpm/link-bins functions