How to use the @pnpm/store-connection-manager.createOrConnectStoreControllerCached function in @pnpm/store-connection-manager

To help you get started, we’ve selected a few @pnpm/store-connection-manager 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 / plugin-commands-installation / src / link.ts View on Github external
'workspaceDir'
  > & Partial>,
) {
  const cwd = opts?.dir ?? process.cwd()

  const storeControllerCache = new Map>()
  let workspacePackagesArr
  let workspacePackages!: WorkspacePackages
  if (opts.workspaceDir) {
    workspacePackagesArr = await findWorkspacePackages(opts.workspaceDir, opts)
    workspacePackages = arrayOfWorkspacePackagesToMap(workspacePackagesArr)
  } else {
    workspacePackages = {}
  }

  const store = await createOrConnectStoreControllerCached(storeControllerCache, opts)
  const linkOpts = Object.assign(opts, {
    storeController: store.ctrl,
    storeDir: store.dir,
    targetDependenciesField: getSaveType(opts),
    workspacePackages,
  })

  // pnpm link
  if (!input || !input.length) {
    const { manifest, writeImporterManifest } = await tryReadImporterManifest(opts.globalDir!, opts)
    const newManifest = await linkToGlobal(cwd, {
      ...linkOpts,
      // A temporary workaround. global bin/prefix are always defined when --global is set
      globalBin: linkOpts.globalBin!,
      globalDir: linkOpts.globalDir!,
      manifest: manifest || {},
github pnpm / pnpm / packages / plugin-commands-installation / src / link.ts View on Github external
pkgPaths.map((dir) => installLimit(async () => {
      const s = await createOrConnectStoreControllerCached(storeControllerCache, opts)
      await install(
        await readImporterManifestOnly(dir, opts), {
          ...await getConfig(
            { ...opts.cliOptions, 'dir': dir },
            {
              command: ['link'],
              excludeReporter: true,
              rcOptionsTypes: installCommand.rcOptionsTypes(),
              workspaceDir: await findWorkspaceDir(dir),
            },
          ),
          storeController: s.ctrl,
          storeDir: s.dir,
          workspacePackages,
        } as InstallOptions,
      )

@pnpm/store-connection-manager

Create a direct pnpm store controller or connect to a running store server

MIT
Latest version published 7 days ago

Package Health Score

55 / 100
Full package analysis