lockfile-info
Version:
Info about an npm project - which lockfile version, which lockfile(s) are present, etc.
52 lines (43 loc) • 2.1 kB
Markdown
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][npm-badge-png]][package-url]
Info about an npm project - which lockfile version, which lockfile(s) are present, etc.
## Example
```js
const lockfileInfo = require('lockfile-info');
const assert = require('assert');
lockfileInfo().then((results) => {
assert.deepEqual(Object.keys(results), [
'hasPackageJSON',
'hasNodeModulesDir',
'hasLockfile',
'hasPackageLock',
'hasShrinkwrap',
'lockfileVersion',
]);
assert.equal(typeof results.hasPackageJSON, 'boolean');
assert.equal(typeof results.hasNodeModulesDir, 'boolean');
assert.equal(typeof results.hasLockfile, 'boolean');
assert.equal(typeof results.hasPackageLock, 'boolean');
assert.equal(typeof results.hasShrinkwrap, 'boolean');
assert.equal(typeof results.lockfileVersion, 'number'); // `NaN`, `1`, `2`, or `3`
});
```
[]: https://npmjs.org/package/lockfile-info
[]: https://versionbadg.es/ljharb/lockfile-info.svg
[]: https://david-dm.org/ljharb/lockfile-info.svg
[]: https://david-dm.org/ljharb/lockfile-info
[]: https://david-dm.org/ljharb/lockfile-info/dev-status.svg
[]: https://david-dm.org/ljharb/lockfile-info#info=devDependencies
[]: https://nodei.co/npm/lockfile-info.png?downloads=true&stars=true
[]: https://img.shields.io/npm/l/lockfile-info.svg
[]: LICENSE
[]: https://img.shields.io/npm/dm/lockfile-info.svg
[]: https://npm-stat.com/charts.html?package=lockfile-info
[]: https://codecov.io/gh/ljharb/lockfile-info/branch/main/graphs/badge.svg
[]: https://app.codecov.io/gh/ljharb/lockfile-info/
[]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/lockfile-info
[]: https://github.com/ljharb/lockfile-info/actions