mos-read-pkg-up

2018-10-11 admin

mos-read-pkg-up是什么

什么是mos-read-pkg-up,Read the closest package.json file

mos-read-pkg-up使用教程帮助文档

read-pkg-up Build Status

Read the closest package.json file

Why

Install

$ npm install --save read-pkg-up

Usage

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

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

API

readPkgUp([options])

Returns a promise for the 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.

Related

  • read-pkg - Read a package.json file
  • pkg-up - Find the closest 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

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-42393.html

文章标题:mos-read-pkg-up

回到顶部