How to use the @pnpm/symlink-dependency.symlinkDirectRootDependency function in @pnpm/symlink-dependency

To help you get started, we’ve selected a few @pnpm/symlink-dependency 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
include: ctx.include,
      lockfileDir: opts.lockfileDir,
      registries: ctx.registries,
      skipped: ctx.skipped,
      storeController: opts.storeController,
      virtualStoreDir: ctx.virtualStoreDir,
      wantedLockfile: updatedCurrentLockfile,
    },
  )

  // Linking should happen after removing orphans
  // Otherwise would've been removed
  for (const { alias, manifest, path } of linkedPkgs) {
    // TODO: cover with test that linking reports with correct dependency types
    const stu = specsToUpsert.find((s) => s.alias === manifest.name)
    await symlinkDirectRootDependency(path, destModules, alias, {
      fromDependenciesField: stu?.saveType ?? opts.targetDependenciesField,
      linkedPackage: manifest,
      prefix: opts.dir,
    })
  }

  const linkToBin = maybeOpts?.linkToBin || path.join(destModules, '.bin')
  await linkBinsOfPackages(linkedPkgs.map((p) => ({ manifest: p.manifest, location: p.path })), linkToBin, {
    warn: (message: string) => logger.warn({ message, prefix: opts.dir }),
  })

  let newPkg!: ImporterManifest
  if (opts.targetDependenciesField) {
    newPkg = await save(opts.dir, opts.manifest, specsToUpsert)
    for (const { alias } of specsToUpsert) {
      updatedWantedLockfile.importers[importerId].specifiers[alias] = getSpecFromPackageManifest(newPkg, alias)
github pnpm / pnpm / packages / supi / src / install / link.ts View on Github external
Promise.all(importer.linkedDependencies.map((linkedDependency) => {
          const depLocation = resolvePath(importer.rootDir, linkedDependency.resolution.directory)
          return symlinkDirectRootDependency(depLocation, importer.modulesDir, linkedDependency.alias, {
            fromDependenciesField: linkedDependency.dev && 'devDependencies' || linkedDependency.optional && 'optionalDependencies' || 'dependencies',
            linkedPackage: linkedDependency,
            prefix: importer.rootDir,
          })
        })),
      ),

@pnpm/symlink-dependency

Symlink a dependency to node_modules

MIT
Latest version published 6 days ago

Package Health Score

57 / 100
Full package analysis