How to use the @pnpm/core-loggers.installCheckLogger.warn 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 / resolve-dependencies / src / getIsInstallable.ts View on Github external
const warn = await installChecks.checkPlatform({
    _id: pkgId,
    cpu: pkg.cpu,
    os: pkg.os,
  }) ||
    await installChecks.checkEngine({
      _id: pkgId,
      engines: pkg.engines,
    }, {
      nodeVersion: options.nodeVersion,
      pnpmVersion: options.pnpmVersion,
    })

  if (!warn) return true

  installCheckLogger.warn(warn)

  if (options.optional) {
    skippedOptionalDependencyLogger.debug({
      details: warn.toString(),
      package: {
        id: pkgId,
        name: pkg.name,
        version: pkg.version,
      },
      parents: nodeIdToParents(options.nodeId, options.resolvedPackagesByPackageId),
      prefix: options.prefix,
      reason: warn.code === 'ENOTSUP' ? 'unsupported_engine' : 'unsupported_platform',
    })

    return false
  }
github pnpm / pnpm / packages / package-is-installable / src / index.ts View on Github external
cpu?: string[],
    os?: string[],
  },
  options: {
    engineStrict?: boolean,
    nodeVersion?: string,
    optional: boolean,
    pnpmVersion: string,
    lockfileDir: string,
  },
): boolean | null {
  const warn = checkPackage(pkgId, pkg, options)

  if (!warn) return true

  installCheckLogger.warn({
    message: warn.message,
    prefix: options.lockfileDir,
  })

  if (options.optional) {
    skippedOptionalDependencyLogger.debug({
      details: warn.toString(),
      package: {
        id: pkgId,
        name: pkg.name,
        version: pkg.version,
      },
      prefix: options.lockfileDir,
      reason: warn.code === 'ERR_PNPM_UNSUPPORTED_ENGINE' ? 'unsupported_engine' : 'unsupported_platform',
    })