Skip to content

PieLabs/read-remote-pkg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

read-remote-pkg

Read the package.json of an npm module without installing it. Supports reading it from npmjs.com, github, and from the local file-system.

/**
 * 
 */
import readRemotePkg from 'read-remote-pkg';

Promise.all([
  //with a semver
  readRemotePkg('my-pkg', '^1.0.0');
  //with a github name 
  readRemotePkg('my-pkg', 'my-org/my-pkg');
  //with a local name 
  readRemotePkg('my-pkg', path.resolve('../..'));
])
.then((packages) => {
  console.log(packages.map(p => p.name).join(', ')); //my-pkg, my-pkg, my-pkg
});

test

npm test

build

npm run main

About

read a remote package.json without installing it

Resources

Stars

Watchers

Forks

Packages

No packages published