mirror of
https://github.com/pnpm/pnpm.git
synced 2026-02-20 08:08:47 -05:00
* chore(scripts): typecheck-only * feat: change all configuration * feat: include pnpm/ and pnpm/test/ * chore(deps): remove unused dependency * refactor(typescript-only): use find-packages * refactor(typescript-only): refactor paths * fix: typescript-only * fix: update compile-only * fix: compile pnpm * fix: windows * fix: windows * chore: meta-updater * refactor(tsconfig): remove explicit composite * fix: path in windows * feat: don't depend on cwd --------- Co-authored-by: Zoltan Kochan <z@kochan.io>
@pnpm/lockfile.fs
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.fs
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 projectopts.ignoreIncompatible- Boolean -falseby default. Iftrue, 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.wantedLockfileopts.wantedLockfileDiropts.currentLockfileopts.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.