JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 40558
  • Score
    100M100P100Q138315F
  • License MIT

Loads the package.json from the root of the user's current project.

Package Exports

  • load-pkg

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (load-pkg) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

load-pkg NPM version Build Status Build Status

Loads the package.json from the root of the user's current project.

HEADS UP!

Breaking changes in v2.0. The main export is now a function that must be called. This is so that the package.json is lazily loaded when the function is called.

Install

Install with npm

$ npm i load-pkg --save

Usage

async

var loadPkg = require('load-pkg')

// get the package.json from the cwd
loadPkg(function(err, pkg) {
  console.log(pkg.name);
  //=> 'load-pkg'
});

// get the package.json from the specified directory
loadPkg('~/foo/bar', function(err, pkg) {
  console.log(pkg.name);
  //=> 'load-pkg'
});

sync

var pkg = require('load-pkg')(process.cwd());
console.log(pkg.name);
//=> 'load-pkg'

Specify the cwd or filepath to start from:

var pkg = require('load-pkg')('a/b/c');
console.log(pkg.name);
//=> 'foo'
  • cwd: Easily get the CWD (current working directory) of a project based on package.json, optionally starting… more | homepage
  • find-pkg: Find the first directory with a package.json, recursing up, starting with the given directory. | homepage
  • look-up: Faster drop-in replacement for find-up and findup-sync. | homepage

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Author

Jon Schlinkert

License

Copyright © 2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on November 27, 2015.