pkg.json
Get the package.json content either from npm or from a git repository.
:cloud: Installation
$ npm i --save pkg.json
:clipboard: Example
const packageJson = require("pkg.json");
packageJson("git-stats", function (err, data) {
console.log(err || data);
});
packageJson("IonicaBizau/git-stats", function (err, data) {
console.log(err || data);
});
packageJson("git@github.com:IonicaBizau/git-stats.git", function (err, data) {
console.log(err || data);
});
packageJson("git@github.com:IonicaBizau/git-stats.git", "2.7.0", function (err, data) {
console.log(err || data.version);
});
:memo: Documentation
packageJson(input, version, callback)
Fetches the package.json
file contents from npm
or a git repository.
Params
- String
input
: The package npm
name or git url. The git urls are friendly, being parsed by git-source
. - String
version
: The npm
package version or a git sha/tag/branch/etc. - Function
callback
: The callback function.
:yum: How to contribute
Have an idea? Found a bug? See how to contribute.
:scroll: License
MIT © Ionică Bizău