package.json
Get the package.json content either from npm or from a git repository.
Installation
$ npm i --save package.json
Example
const packageJson = require("package.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);
});
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.
How to contribute
Have an idea? Found a bug? See how to contribute.
Where is this library used?
If you are using this library in one of your projects, add it in this list. :sparkles:
License
MIT © Ionică Bizău