How to use @pnpm/config - 1 common examples

To help you get started, we’ve selected a few @pnpm/config 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 / lockfile-to-pnp / src / index.ts View on Github external
export async function lockfileToPnp (lockfileDirectory: string) {
  const lockfile = await readWantedLockfile(lockfileDirectory, { ignoreIncompatible: true })
  if (!lockfile) throw new Error('Cannot generate a .pnp.js without a lockfile')
  const importerNames = {} as { [importerId: string]: string }
  await Promise.all(
    Object.keys(lockfile.importers)
      .map(async (importerId) => {
        const importerDirectory = path.join(lockfileDirectory, importerId)
        const { manifest } = await readImporterManifest(importerDirectory)
        importerNames[importerId] = manifest.name as string
      }),
  )
  const { registries, store } = await getConfigs({ cliArgs: {}, packageManager: { name: 'pnpm', version: '*' } })
  const storeDirectory = await resolveStoreDir(lockfileDirectory, store)
  const packageRegistry = lockfileToPackageRegistry(lockfile, {
    importerNames,
    lockfileDirectory,
    registries,
    storeDirectory,
  })

  const loaderFile = pnp.generateInlinedScript({
    blacklistedLocations: undefined,
    ignorePattern: undefined,
    packageRegistry,
    shebang: undefined,
  })
  await fs.writeFile(path.join(lockfileDirectory, '.pnp.js'), loaderFile, 'utf8')
}

@pnpm/config

Gets configuration options for pnpm

MIT
Latest version published 5 days ago

Package Health Score

68 / 100
Full package analysis

Popular @pnpm/config functions