1.1.0 • Published 4 months ago

lockfile-hasher v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

lockfile-hasher

Generates a combined hash of all the lockfiles in a repo. Supports package-lock.json, pnpm-lock.yaml, and yarn.lock files.

This can be used as a cache key for CI/CD pipelines in repositories that have multiple lock files.

Installation

npm install lockfile-hasher

Usage

import { generateCombinedLockFileHash } from 'lockfile-hasher';

const combinedHash = generateCombinedLockFileHash(pathToRepositoryRoot);

Alternatively, you can use the default export. This allows for easier mocking, since hashing lockfiles is an expensive operation that you really don't want to do during unit tests:

import lockfileHasher from 'lockfile-hasher';

const combinedHash = lockfileHasher.generateCombinedLockFileHash(pathToRepositoryRoot);
1.1.0

4 months ago

1.0.2

4 months ago

1.0.1

4 months ago

1.0.0

4 months ago