r3-v2/node_modules/read-pkg-up
Theunis J. Botha 5f5bbac56e initial comit 2020-02-27 15:24:35 +01:00
..
node_modules initial comit 2020-02-27 15:24:35 +01:00
index.js initial comit 2020-02-27 15:24:35 +01:00
license initial comit 2020-02-27 15:24:35 +01:00
package.json initial comit 2020-02-27 15:24:35 +01:00
readme.md initial comit 2020-02-27 15:24:35 +01:00

readme.md

read-pkg-up Build Status

Read the closest package.json file

Why

Install

$ npm install --save read-pkg-up

Usage

var readPkgUp = require('read-pkg-up');

readPkgUp().then(function (result) {
	console.log(result);
	/*
	{
		pkg: {
			name: 'awesome-package',
			version: '1.0.0',
			...
		},
		path: '/Users/sindresorhus/dev/awesome-package'
	}
	*/
});

API

readPkgUp([options])

Returns a promise that resolves to a result object.

readPkgUp.sync([options])

Returns a result object.

options

cwd

Type: string
Default: .

Directory to start looking for a package.json file.

normalize

Type: boolean
Default: true

Normalize the package data.

  • read-pkg - Read a package.json file
  • find-up - Find a file by walking up parent directories
  • pkg-conf - Get namespaced config from the closest package.json

License

MIT © Sindre Sorhus