pkgplz
v1.0.0
Published
Get the root package.json of the current process.
Downloads
10
Maintainers
Readme
pkgplz
Enterprise-level package getter.
All journeys begin at the root—so does this one—
pkgplz
asynchronously retrieves the package.json
at root and returns null if none is found.
Installation
npm install pkgplz
yarn add pkgplz
Usage
The default import is asynchronous
ESM Module (Async)
import pkgplz from 'pkgplz';
const pkg = await pkgplz();
console.log(pkg?.name);
CommonJS (Async)
const pkgplz = require('pkgplz');
pkgplz().then(pkg => {
console.log(pkg?.name);
});
Sync is also supported
ESM Module (Sync)
import pkgplz from 'pkgplz/sync';
const pkg = pkgplz();
console.log(pkg?.name);
CommonJS (Sync)
const pkgplz = require('pkgplz/sync');
const pkg = pkgplz();
console.log(pkg?.name);
Silence the unknown. Know your package—
License
Licensed under the Apache License 2.0.