get-pkg-json

1.0.0 • Public • Published

get-package-json

Get a package.json, from either a npm registry or github

Installation

Download node at nodejs.org and install it, if you haven't already.

npm install get-package-json --save

Usage

import getPackageJson from 'get-package-json';
 
// can be a git url
getPackageJson('git+https://github.com/kesla/get-package-json.git')
  .then(packageJson => {
    console.log('packageJson', packageJson);
  });
 
// can be a npm arg
getPackageJson('get-package-json@latest')
  .then(packageJson => {
    console.log('packageJson', packageJson);
  });
 
// can also load a cached version
const cached = getPackageJson.cached();
cached('git+https://github.com/kesla/get-package-json.git')
  .then(packageJson => {
    console.log('packageJson', packageJson);
    cached('git+https://github.com/kesla/get-package-json.git')
      .then(packageJson => {
        console.log('cached package.json', packageJson);
      });
  });
 

Tests

npm install
npm test

Dependencies

Dev Dependencies

License

MIT

Generated by package-json-to-readme

Readme

Keywords

none

Package Sidebar

Install

npm i get-pkg-json

Weekly Downloads

3

Version

1.0.0

License

MIT

Last publish

Collaborators

  • kesla