How to use @pnpm/package-store - 2 common examples

To help you get started, we’ve selected a few @pnpm/package-store 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 / store-connection-manager / src / createNewStoreController.ts View on Github external
locks: opts.lock ? path.join(opts.storeDir, '_locks') : undefined,
    registry: opts.registry || 'https://registry.npmjs.org/',
  })
  const resolve = createResolver(sopts)
  await makeDir(sopts.storeDir)
  const fsIsCaseSensitive = await dirIsCaseSensitive(sopts.storeDir)
  logger.debug({
    // An undefined field would cause a crash of the logger
    // so converting it to null
    isCaseSensitive: typeof fsIsCaseSensitive === 'boolean'
      ? fsIsCaseSensitive : null,
    store: sopts.storeDir,
  })
  const fetchers = createFetcher({ ...sopts, fsIsCaseSensitive })
  return {
    ctrl: await createStore(resolve, fetchers as {}, {
      locks: sopts.locks,
      lockStaleDuration: sopts.lockStaleDuration,
      networkConcurrency: sopts.networkConcurrency,
      packageImportMethod: sopts.packageImportMethod,
      storeDir: sopts.storeDir,
      verifyStoreIntegrity: typeof sopts.verifyStoreIntegrity === 'boolean' ?
        sopts.verifyStoreIntegrity : true,
    }),
    dir: sopts.storeDir,
  }
}
github pnpm / pnpm / packages / server / example / server.js View on Github external
async function main() {
  const registry = 'https://registry.npmjs.org/'
  const rawConfig = { registry }
  const store = '.store'
  const resolve = createResolver({
    rawConfig,
    store,
    metaCache: new Map(),
  })
  const fetchers = createFetcher({
    alwaysAuth: true,
    registry,
    strictSsl: true,
    rawConfig,
  })
  const storeCtrl = await createStore(resolve, fetchers, {
    networkConcurrency: 1,
    store,
  })

  const port = 5813
  const hostname = '127.0.0.1';
  const server = createServer(storeCtrl, {
    port,
    hostname,
  })

  process.on('exit', () => server.close())
}

@pnpm/package-store

A storage for packages

MIT
Latest version published 3 days ago

Package Health Score

61 / 100
Full package analysis

Popular @pnpm/package-store functions