How to use @pnpm/symlink-dependency - 5 common examples

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 / hoist / src / index.ts View on Github external
await Promise.all(pkgAliases.map(async (pkgAlias) => {
          await symlinkDependency(depNode.location, opts.modulesDir, pkgAlias)
        }))
      }
github pnpm / pnpm / packages / supi / src / install / link.ts View on Github external
.map(async ({ rootAlias, depGraphNode }) => {
          if (
            !opts.dryRun &&
            (await symlinkDependency(depGraphNode.peripheralLocation, modulesDir, rootAlias)).reused
          ) return

          const isDev = manifest.devDependencies?.[depGraphNode.name]
          const isOptional = manifest.optionalDependencies?.[depGraphNode.name]
          rootLogger.debug({
            added: {
              dependencyType: isDev && 'dev' || isOptional && 'optional' || 'prod',
              id: depGraphNode.packageId,
              latest: opts.outdatedDependencies[depGraphNode.packageId],
              name: rootAlias,
              realName: depGraphNode.name,
              version: depGraphNode.version,
            },
            prefix: rootDir,
          })
        }),
github pnpm / pnpm / packages / supi / src / install / link.ts View on Github external
              await limitLinking(() => symlinkDependency(pkg.peripheralLocation, modules, childAlias))
            }),
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 2 months ago

Package Health Score

63 / 100
Full package analysis