How to use the @pnpm/store-connection-manager.createNewStoreController 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-server / src / start.ts View on Github external
if (fd !== null) {
      try {
        fs.closeSync(fd)
      } catch (error) {
        storeServerLogger.error(error, `Got error while closing file descriptor of server.json, but the process is already exiting`)
      }
    }
    try {
      fs.unlinkSync(serverJsonPath)
    } catch (error) {
      if (error.code !== 'ENOENT') {
        storeServerLogger.error(error, `Got error unlinking server.json, but the process is already exiting`)
      }
    }
  })
  const store = await createNewStoreController(Object.assign(opts, {
    storeDir,
  }))
  const protocol = opts.protocol ?? (opts.port ? 'tcp' : 'auto')
  const serverOptions = await getServerOptions(connectionInfoDir, { protocol, port: opts.port })
  const connectionOptions = {
    remotePrefix: serverOptions.path
      ? `http://unix:${serverOptions.path}:`
      : `http://${serverOptions.hostname}:${serverOptions.port}`,
  }
  server = createServer(store.ctrl, {
    ...serverOptions,
    ignoreStopRequests: opts.ignoreStopRequests,
    ignoreUploadRequests: opts.ignoreUploadRequests,
  })
  // Make sure to populate server.json after the server has started, so clients know that the server is
  // listening if a server.json with valid JSON content exists.

@pnpm/store-connection-manager

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

MIT
Latest version published 11 days ago

Package Health Score

55 / 100
Full package analysis