pkginfo
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Pkginfo is a highly efficient tool for Node.js, allowing developers to programmatically expose properties within a module from a package.json file. Avoiding the usual need to hard code the version string into your code or to create manual exposure, pkginfo provides an automated solution. This npm package simplifies the process of accessing and sharing vital information contained in a package.json file to your specific module with ease.
Using pkginfo is straightforward and requires a simple JavaScript call. Firstly, remember to install pkginfo using npm with the command npm install pkginfo
. Following this, you can implement this package into your code in a very direct way. Below is an example of usage:
var pkginfo = require('pkginfo')(module);
console.dir(module.exports);
By invoking the pkginfo
module, all properties in your package.json
file will be automatically exposed on the parent module of pkginfo
. If you prefer to expose only certain properties, you can do so by specifying them in the pkginfo
function call like so:
var pkginfo = require('pkginfo')(module, 'version', 'author');
console.dir(module.exports);
In this instance, only 'version' and 'author' properties will be exposed.
An extensive guide for using pkginfo, complete with code examples, is available directly from the pkginfo GitHub repository. The repository, indexed under the username indexzero
, can be found at github.com/indexzero/node-pkginfo. The repository includes detailed usage instructions, as well as more complex usage examples in the examples directory.