# @pnpm/lockfile-file

> Read/write pnpm-lock.yaml files

Latest version **9.1.3** (published 2024-07-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @pnpm/lockfile-file
pnpm add @pnpm/lockfile-file
yarn add @pnpm/lockfile-file
bun add @pnpm/lockfile-file
```

## Health

**Score 50/100 (C)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score; popular repo.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 9.1.3 |
| Published | 2024-07-21 |
| First published | 2019-03-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18.12 |
| Dependencies | 19 |
| Unpacked size | 76.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 36535 |
| Maintainers | pnpmuser, zkochan |
| Keywords | pnpm9, pnpm, shrinkwrap, lockfile |

## Links

- npm: https://www.npmjs.com/package/@pnpm/lockfile-file
- Repository: https://github.com/pnpm/pnpm/blob/main/lockfile/lockfile-file
- Homepage: https://github.com/pnpm/pnpm/blob/main/lockfile/lockfile-file#readme
- Issues: https://github.com/pnpm/pnpm/issues
- Funding: https://opencollective.com/pnpm
- npm.io page: https://npm.io/package/@pnpm/lockfile-file

## Dependencies (19)

- [ramda](https://npm.io/package/ramda.md) npm:@pnpm/ramda@0.28.1
- [semver](https://npm.io/package/semver.md) ^7.6.2
- [js-yaml](https://npm.io/package/js-yaml.md) npm:@zkochan/js-yaml@0.0.7
- [sort-keys](https://npm.io/package/sort-keys.md) ^4.2.0
- [strip-bom](https://npm.io/package/strip-bom.md) ^4.0.0
- [@pnpm/error](https://npm.io/package/@pnpm/error.md) 6.0.1
- [@pnpm/types](https://npm.io/package/@pnpm/types.md) 11.1.0
- [normalize-path](https://npm.io/package/normalize-path.md) ^3.0.0
- [@pnpm/constants](https://npm.io/package/@pnpm/constants.md) 8.0.0
- [@pnpm/git-utils](https://npm.io/package/@pnpm/git-utils.md) 2.0.0
- [@zkochan/rimraf](https://npm.io/package/@zkochan/rimraf.md) ^3.0.2
- [comver-to-semver](https://npm.io/package/comver-to-semver.md) ^1.0.0
- [write-file-atomic](https://npm.io/package/write-file-atomic.md) ^5.0.1
- [@pnpm/git-resolver](https://npm.io/package/@pnpm/git-resolver.md) 9.0.5
- [@pnpm/lockfile-types](https://npm.io/package/@pnpm/lockfile-types.md) 7.1.3
- [@pnpm/lockfile-utils](https://npm.io/package/@pnpm/lockfile-utils.md) 11.0.4
- [@pnpm/dependency-path](https://npm.io/package/@pnpm/dependency-path.md) 5.1.3
- [@pnpm/util.lex-comparator](https://npm.io/package/@pnpm/util.lex-comparator.md) 3.0.0
- [@pnpm/merge-lockfile-changes](https://npm.io/package/@pnpm/merge-lockfile-changes.md) 6.0.5

## Recent versions

- 9.1.3 (latest) — 2024-07-21
- 0.0.0-20230605-20230605142810 (dev) — 2023-06-05
- 4.3.2 (latest-6) — 2022-07-05
- 3.0.12 (pnpm-temp) — 2020-08-16
- 2.0.0-0 (next) — 2019-09-21
- 9.1.2 — 2024-07-04
- 9.1.1 — 2024-06-17
- 9.1.0 — 2024-06-10
- 9.0.6 — 2024-05-21
- 9.0.5 — 2024-05-12
- 9.0.4 — 2024-05-06
- 9.0.3 — 2024-04-29
- 9.0.2 — 2024-04-24
- 9.0.1 — 2024-04-21
- 9.0.0 — 2024-04-09
- … 104 more at https://npm.io/package/@pnpm/lockfile-file/versions

## README

# @pnpm/lockfile-file

> Read/write pnpm-lock.yaml files

Reads and writes the wanted (`pnpm-lock.yaml`) and current (`node_modules/.pnpm-lock.yaml`) lockfile files of pnpm.
Lockfile files are the state files of the `node_modules` installed via pnpm. They are like
the `package-lock.json` of npm or the `yarn.lock` of Yarn.

## Install

```
pnpm add @pnpm/lockfile-file
```

## API

### `readWantedLockfile(pkgPath, opts) => Promise<Lockfile>`

Reads the `pnpm-lock.yaml` file from the root of the package.

#### Arguments

* `pkgPath` - *Path* - the path to the project
* `opts.ignoreIncompatible` - *Boolean* - `false` by default. If `true`, throws an error
if the lockfile file format is not compatible with the current library.

### `readCurrentLockfile(virtualStoreDir, opts) => Promise<Lockfile>`

Reads the lockfile file from `<virtualStoreDir>/lock.yaml`.

### `existsNonEmptyWantedLockfile(pkgPath) => Promise<Boolean>`

Returns `true` if a `pnpm-lock.yaml` exists in the root of the package.

### `writeLockfiles(opts) => Promise<void>`

Writes the wanted/current lockfile files. When they are empty, removes them.

#### Arguments

* `opts.wantedLockfile`
* `opts.wantedLockfileDir`
* `opts.currentLockfile`
* `opts.currentLockfileDir`
* `[opts.forceSharedFormat]`

### `writeWantedLockfile(pkgPath, wantedLockfile) => Promise<void>`

Writes the wanted lockfile file only. Sometimes it is needed just to update the wanted lockfile
without touching `node_modules`.

### `writeCurrentLockfile(virtualStoreDir, currentLockfile) => Promise<void>`

Writes the current lockfile file only.

## License

[MIT](LICENSE)

---
_Source: https://npm.io/package/@pnpm/lockfile-file · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
