Skip to content

alexstevovich/pkgplz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

npm npm downloads license

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.

About

[Node.js] Get the root package.json of the current process.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors