How to use the @pnpm/core-loggers.scopeLogger.debug function in @pnpm/core-loggers

To help you get started, we’ve selected a few @pnpm/core-loggers 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-recursive / src / recursive.ts View on Github external
// It might make sense to throw an exception in this case
    return false
  }

  const pkgs = Object.values(opts.selectedWsPkgsGraph).map((wsPkg) => wsPkg.package)
  const allPackagesAreSelected = pkgs.length === allWsPkgs.length

  if (pkgs.length === 0) {
    return false
  }
  const manifestsByPath: { [dir: string]: { manifest: ImporterManifest, writeImporterManifest: (manifest: ImporterManifest) => Promise } } = {}
  for (const { dir, manifest, writeImporterManifest } of pkgs) {
    manifestsByPath[dir] = { manifest, writeImporterManifest }
  }

  scopeLogger.debug({
    selected: pkgs.length,
    total: allWsPkgs.length,
    workspacePrefix: opts.workspaceDir,
  })

  const throwOnFail = throwOnCommandFail.bind(null, `pnpm recursive ${cmd}`)

  switch (cmdFullName) {
    case 'why':
    case 'list':
      return list(pkgs, input, cmd, opts as any) // tslint:disable-line:no-any
    case 'outdated':
      return outdated(pkgs, input, cmd, opts as any) // tslint:disable-line:no-any
    case 'add':
      if (!input || !input.length) {
        throw new PnpmError('MISSING_PACKAGE_NAME', '`pnpm recursive add` requires the package name')
github pnpm / pnpm / packages / plugin-commands-installation / src / recursive.ts View on Github external
if (allWsPkgs.length === 0) {
    // It might make sense to throw an exception in this case
    return false
  }

  const pkgs = Object.values(opts.selectedWsPkgsGraph).map((wsPkg) => wsPkg.package)

  if (pkgs.length === 0) {
    return false
  }
  const manifestsByPath: { [dir: string]: Omit } = {}
  for (const { dir, manifest, writeImporterManifest } of pkgs) {
    manifestsByPath[dir] = { manifest, writeImporterManifest }
  }

  scopeLogger.debug({
    selected: pkgs.length,
    total: allWsPkgs.length,
    workspacePrefix: opts.workspaceDir,
  })

  const throwOnFail = throwOnCommandFail.bind(null, `pnpm recursive ${cmdFullName}`)

  const chunks = opts.sort !== false
    ? sortPackages(opts.selectedWsPkgsGraph)
    : [Object.keys(opts.selectedWsPkgsGraph).sort()]

  const store = await createOrConnectStoreController(opts)

  // It is enough to save the store.json file once,
  // once all installations are done.
  // That's why saveState that is passed to the install engine
github pnpm / pnpm / packages / plugin-commands-rebuild / src / recursive.ts View on Github external
if (allWsPkgs.length === 0) {
    // It might make sense to throw an exception in this case
    return
  }

  const pkgs = Object.values(opts.selectedWsPkgsGraph).map((wsPkg) => wsPkg.package)

  if (pkgs.length === 0) {
    return
  }
  const manifestsByPath: { [dir: string]: Omit } = {}
  for (const { dir, manifest, writeImporterManifest } of pkgs) {
    manifestsByPath[dir] = { manifest, writeImporterManifest }
  }

  scopeLogger.debug({
    selected: pkgs.length,
    total: allWsPkgs.length,
    workspacePrefix: opts.workspaceDir,
  })

  const throwOnFail = throwOnCommandFail.bind(null, `pnpm recursive rebuild`)

  const chunks = opts.sort !== false
    ? sortPackages(opts.selectedWsPkgsGraph)
    : [Object.keys(opts.selectedWsPkgsGraph).sort()]

  const store = await createOrConnectStoreController(opts)

  const workspacePackages = arrayOfWorkspacePackagesToMap(allWsPkgs)
  const rebuildOpts = Object.assign(opts, {
    ownLifecycleHooksStdio: 'pipe',
github pnpm / pnpm / packages / pnpm / src / main.ts View on Github external
setTimeout(() => {
      if (config.force === true) {
        logger.warn({
          message: 'using --force I sure hope you know what you are doing',
          prefix: config.dir,
        })
      }

      if (cmd !== 'recursive') {
        scopeLogger.debug(workspaceDir
          ? { selected: 1, workspacePrefix: workspaceDir }
          : { selected: 1 })
      }

      try {
        const result = pnpmCmds[cmd](
          cliArgs,
          // TypeScript doesn't currently infer that the type of config
          // is `Omit` after the `delete config.reporter` statement
          config as Omit,
          argv.remain[0]
        )
        if (result instanceof Promise) {
          result
            .then((output) => {
              if (typeof output === 'string') {