How to use the @pnpm/package-is-installable.checkPackage function in @pnpm/package-is-installable

To help you get started, we’ve selected a few @pnpm/package-is-installable 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 / cli-utils / src / packageIsInstallable.ts View on Github external
export function packageIsInstallable (
  pkgPath: string,
  pkg: {
    engines?: WantedEngine,
    cpu?: string[],
    os?: string[],
  },
  opts: {
    engineStrict?: boolean,
  },
) {
  const err = checkPackage(pkgPath, pkg, {
    pnpmVersion: packageManager.stableVersion,
  })
  if (err === null) return
  if (
    (err instanceof UnsupportedEngineError && err.wanted.pnpm) ||
    opts.engineStrict
  ) throw err
  logger.warn({
    message: `Unsupported ${
      err instanceof UnsupportedEngineError ? 'engine' : 'platform'
    }: wanted: ${JSON.stringify(err.wanted)} (current: ${JSON.stringify(err.current)})`,
    prefix: pkgPath,
  })
}

@pnpm/package-is-installable

Checks if a package is installable on the current system

MIT
Latest version published 8 days ago

Package Health Score

66 / 100
Full package analysis

Popular @pnpm/package-is-installable functions

Similar packages