Package detail

which-pm-lockfile

bconnorwhite75MIT2.1.0

Check if a project uses yarn, npm, or pnpm

package, manager, yarn, npm

readme

which-pm-lockfile

npm typescript Coveralls Status


Get the path to a project's npm, yarn, pnpm, or bun lockfile.


If I should maintain this repo, please ⭐️ GitHub stars

DM me on Twitter if you have questions or suggestions. Twitter Follow


Installation

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

Usage

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

const pmName = await getPackageManagerName(); // "npm" | "yarn" | "pnpm" | "bun"

const lockfile = await getLockfile(); // "package-lock.json" | "yarn.lock" | "shrinkwrap.yaml" | "bun.lockb"

const npm = await hasNPM(); // true | false
const yarn = await hasYarn(); // true | false
const pnpm = await hasPNPM(); // true | false
const bun = await hasBun(); // true | false


Dependenciesdependencies

  • file-structure: Define and manage file structures
  • root-pkg-dir: Find the highest directory with a package.json, starting from from the current working directory.


Dev Dependencies

  • @types/mock-fs: TypeScript definitions for mock-fs
  • autorepo: Autorepo abstracts away your dev dependencies, providing a single command to run all of your scripts.
  • mock-fs: A configurable mock file system. You know, for testing.


License license

MIT - The MIT License

changelog

2.1.0 (2023-07-24)

Features

  • add support for bun, and full lockfile paths (6c9d3e0)

2.0.1 (2023-01-07)

Bug Fixes

2.0.0 (2023-01-06)

  • Migrate to ESM

1.1.2 (2021-04-17)

1.1.1 (2021-04-17)

1.1.0 (2020-08-28)

1.0.1 (2020-08-17)