which-pm-lockfile

Check if a project uses yarn, npm, or pnpm

Usage no npm install needed!

<script type="module">
  import whichPmLockfile from 'https://cdn.skypack.dev/which-pm-lockfile';
</script>

README

which-pm-lockfile

NPM TypeScript Coverage Status GitHub Stars Twitter Follow

Check if a project uses yarn, npm, or pnpm.

Installation

yarn add which-pm-lockfile
npm install which-pm-lockfile

Example usage:

import {
  getPackageManagerName,
  getLockfile,
  hasYarn,
  hasNPM,
  hasPNPM,
  PackageManagerName,
  PackageManagerLockfile
} from "which-pm-lockfile";

getPackageManagerName() => Promise<PackageManagerName | undefined>;

getLockfile() => Promise<PackageManagerLockfile | undefined>;

hasYarn() => Promise<boolean>;

hasNPM() => Promise<boolean>;

hasPNPM() => Promise<boolean>;

type PackageManagerName = "yarn" | "npm" | "pnpm";

type PackageManagerLockfile = "yarn.lock" | "package-lock.json" | "shrinkwrap.yaml";

Dependenciesdependencies

  • @bconnorwhite/package: A utility for reading package.json of a project, and forming paths relative to it.

Dev DependenciesDavid


License license

MIT