Upgrade Ava to v4
This commit is contained in:
parent
9a40cc5274
commit
ce89f1b611
1153 changed files with 27264 additions and 95308 deletions
165
node_modules/pkg-conf/index.d.ts
generated
vendored
165
node_modules/pkg-conf/index.d.ts
generated
vendored
|
|
@ -1,92 +1,99 @@
|
|||
declare namespace pkgConf {
|
||||
type Config = {[key: string]: unknown};
|
||||
export type Config = Record<string, unknown>;
|
||||
|
||||
interface Options<ConfigType extends Config> {
|
||||
/**
|
||||
Directory to start looking up for a `package.json` file.
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
cwd?: string;
|
||||
|
||||
/**
|
||||
Default config.
|
||||
|
||||
@default {}
|
||||
*/
|
||||
defaults?: ConfigType;
|
||||
|
||||
/**
|
||||
Skip `package.json` files that have the namespaced config explicitly set to `false`.
|
||||
|
||||
Continues searching upwards until the next `package.json` file is reached. This can be useful when you need to support the ability for users to have nested `package.json` files, but only read from the root one, like in the case of [`electron-builder`](https://github.com/electron-userland/electron-builder/wiki/Options#AppMetadata) where you have one `package.json` file for the app and one top-level for development.
|
||||
|
||||
@default false
|
||||
|
||||
@example
|
||||
```
|
||||
{
|
||||
"name": "some-package",
|
||||
"version": "1.0.0",
|
||||
"unicorn": false
|
||||
}
|
||||
```
|
||||
*/
|
||||
skipOnFalse?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare const pkgConf: {
|
||||
export interface Options<ConfigType extends Config> {
|
||||
/**
|
||||
It [walks up](https://github.com/sindresorhus/find-up) parent directories until a `package.json` can be found, reads it, and returns the user specified namespace or an empty object if not found.
|
||||
The directory to start looking up for a `package.json` file.
|
||||
|
||||
@param namespace - The `package.json` namespace you want.
|
||||
@returns A `Promise` for the config.
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly cwd?: string;
|
||||
|
||||
/**
|
||||
The default config.
|
||||
|
||||
@default {}
|
||||
*/
|
||||
readonly defaults?: ConfigType;
|
||||
|
||||
/**
|
||||
Skip `package.json` files that have the namespaced config explicitly set to `false`.
|
||||
|
||||
Continues searching upwards until the next `package.json` file is reached. This can be useful when you need to support the ability for users to have nested `package.json` files, but only read from the root one, like in the case of [`electron-builder`](https://github.com/electron-userland/electron-builder/wiki/Options#AppMetadata) where you have one `package.json` file for the app and one top-level for development.
|
||||
|
||||
@default false
|
||||
|
||||
@example
|
||||
```
|
||||
// {
|
||||
// "name": "some-package",
|
||||
// "version": "1.0.0",
|
||||
// "unicorn": {
|
||||
// "rainbow": true
|
||||
// }
|
||||
// }
|
||||
|
||||
import pkgConf = require('pkg-conf');
|
||||
|
||||
(async () => {
|
||||
const config = await pkgConf('unicorn');
|
||||
|
||||
console.log(config.rainbow);
|
||||
//=> true
|
||||
})();
|
||||
{
|
||||
"name": "some-package",
|
||||
"version": "1.0.0",
|
||||
"unicorn": false
|
||||
}
|
||||
```
|
||||
*/
|
||||
<ConfigType extends pkgConf.Config = pkgConf.Config>(
|
||||
namespace: string,
|
||||
options?: pkgConf.Options<ConfigType>
|
||||
): Promise<ConfigType & pkgConf.Config>;
|
||||
readonly skipOnFalse?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
Same as `pkgConf()`, but runs synchronously.
|
||||
/**
|
||||
It [walks up](https://github.com/sindresorhus/find-up) parent directories until a `package.json` can be found, reads it, and returns the user specified namespace or an empty object if not found.
|
||||
|
||||
@param namespace - The `package.json` namespace you want.
|
||||
@returns Returns the config.
|
||||
*/
|
||||
sync<ConfigType extends pkgConf.Config = pkgConf.Config>(
|
||||
namespace: string,
|
||||
options?: pkgConf.Options<ConfigType>
|
||||
): ConfigType & pkgConf.Config;
|
||||
@param namespace - The `package.json` namespace you want.
|
||||
@returns A `Promise` for the config.
|
||||
|
||||
/**
|
||||
@param config - The `config` returned from any of the above methods.
|
||||
@returns The filepath to the `package.json` file or `null` when not found.
|
||||
*/
|
||||
filepath(config: pkgConf.Config): string | null;
|
||||
@example
|
||||
```
|
||||
// {
|
||||
// "name": "some-package",
|
||||
// "version": "1.0.0",
|
||||
// "unicorn": {
|
||||
// "rainbow": true
|
||||
// }
|
||||
// }
|
||||
|
||||
// TODO: Remove this for the next major release
|
||||
default: typeof pkgConf;
|
||||
};
|
||||
import {packageConfig} from 'pkg-conf';
|
||||
|
||||
export = pkgConf;
|
||||
const config = await packageConfig('unicorn');
|
||||
|
||||
console.log(config.rainbow);
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
export function packageConfig<ConfigType extends Config = Config>(
|
||||
namespace: string,
|
||||
options?: Options<ConfigType>
|
||||
): Promise<ConfigType & Config>;
|
||||
|
||||
/**
|
||||
It [walks up](https://github.com/sindresorhus/find-up) parent directories until a `package.json` can be found, reads it, and returns the user specified namespace or an empty object if not found.
|
||||
|
||||
@param namespace - The `package.json` namespace you want.
|
||||
@returns Returns the config.
|
||||
|
||||
@example
|
||||
```
|
||||
// {
|
||||
// "name": "some-package",
|
||||
// "version": "1.0.0",
|
||||
// "unicorn": {
|
||||
// "rainbow": true
|
||||
// }
|
||||
// }
|
||||
|
||||
import {packageConfigSync} from 'pkg-conf';
|
||||
|
||||
const config = packageConfigSync('unicorn');
|
||||
|
||||
console.log(config.rainbow);
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
export function packageConfigSync<ConfigType extends Config = Config>(
|
||||
namespace: string,
|
||||
options?: Options<ConfigType>
|
||||
): ConfigType & Config;
|
||||
|
||||
/**
|
||||
@param config - The config returned from any of the above methods.
|
||||
@returns The file path to the `package.json` file or `undefined` if not found.
|
||||
*/
|
||||
export function packageJsonPath(config: Config): string | undefined;
|
||||
|
|
|
|||
79
node_modules/pkg-conf/index.js
generated
vendored
79
node_modules/pkg-conf/index.js
generated
vendored
|
|
@ -1,62 +1,55 @@
|
|||
'use strict';
|
||||
const path = require('path');
|
||||
const findUp = require('find-up');
|
||||
const loadJsonFile = require('load-json-file');
|
||||
import path from 'node:path';
|
||||
import {findUp, findUpSync} from 'find-up';
|
||||
import {loadJsonFile, loadJsonFileSync} from 'load-json-file';
|
||||
|
||||
const filepaths = new WeakMap();
|
||||
const filepath = conf => filepaths.get(conf);
|
||||
const filePaths = new WeakMap();
|
||||
const findNextCwd = pkgPath => path.resolve(path.dirname(pkgPath), '..');
|
||||
|
||||
const addFilePath = (object, filePath) => {
|
||||
filepaths.set(object, filePath);
|
||||
filePaths.set(object, filePath);
|
||||
return object;
|
||||
};
|
||||
|
||||
const pkgConf = (namespace, options = {}) => {
|
||||
if (!namespace) {
|
||||
return Promise.reject(new TypeError('Expected a namespace'));
|
||||
}
|
||||
|
||||
return findUp('package.json', options.cwd ? {cwd: options.cwd} : {})
|
||||
.then(filePath => {
|
||||
if (!filePath) {
|
||||
return addFilePath(Object.assign({}, options.defaults), filePath);
|
||||
}
|
||||
|
||||
return loadJsonFile(filePath).then(package_ => {
|
||||
if (options.skipOnFalse && package_[namespace] === false) {
|
||||
const newOptions = Object.assign({}, options, {cwd: findNextCwd(filePath)});
|
||||
return pkgConf(namespace, newOptions);
|
||||
}
|
||||
|
||||
return addFilePath(Object.assign({}, options.defaults, package_[namespace]), filePath);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const sync = (namespace, options = {}) => {
|
||||
export async function packageConfig(namespace, options = {}) {
|
||||
if (!namespace) {
|
||||
throw new TypeError('Expected a namespace');
|
||||
}
|
||||
|
||||
const filePath = findUp.sync('package.json', options.cwd ? {cwd: options.cwd} : {});
|
||||
const filePath = await findUp('package.json', options.cwd ? {cwd: options.cwd} : {});
|
||||
|
||||
if (!filePath) {
|
||||
return addFilePath(Object.assign({}, options.defaults), filePath);
|
||||
return addFilePath({...options.defaults}, filePath);
|
||||
}
|
||||
|
||||
const package_ = loadJsonFile.sync(filePath);
|
||||
const packageJson = await loadJsonFile(filePath);
|
||||
|
||||
if (options.skipOnFalse && package_[namespace] === false) {
|
||||
const newOptions = Object.assign({}, options, {cwd: findNextCwd(filePath)});
|
||||
return sync(namespace, newOptions);
|
||||
if (options.skipOnFalse && packageJson[namespace] === false) {
|
||||
return packageConfig(namespace, {...options, cwd: findNextCwd(filePath)});
|
||||
}
|
||||
|
||||
return addFilePath(Object.assign({}, options.defaults, package_[namespace]), filePath);
|
||||
};
|
||||
return addFilePath({...options.defaults, ...packageJson[namespace]}, filePath);
|
||||
}
|
||||
|
||||
module.exports = pkgConf;
|
||||
// TODO: Remove this for the next major release
|
||||
module.exports.default = pkgConf;
|
||||
module.exports.filepath = filepath;
|
||||
module.exports.sync = sync;
|
||||
export function packageConfigSync(namespace, options = {}) {
|
||||
if (!namespace) {
|
||||
throw new TypeError('Expected a namespace');
|
||||
}
|
||||
|
||||
const filePath = findUpSync('package.json', options.cwd ? {cwd: options.cwd} : {});
|
||||
|
||||
if (!filePath) {
|
||||
return addFilePath({...options.defaults}, filePath);
|
||||
}
|
||||
|
||||
const packageJson = loadJsonFileSync(filePath);
|
||||
|
||||
if (options.skipOnFalse && packageJson[namespace] === false) {
|
||||
return packageConfigSync(namespace, {...options, cwd: findNextCwd(filePath)});
|
||||
}
|
||||
|
||||
return addFilePath({...options.defaults, ...packageJson[namespace]}, filePath);
|
||||
}
|
||||
|
||||
export function packageJsonPath(config) {
|
||||
return filePaths.get(config);
|
||||
}
|
||||
|
|
|
|||
2
node_modules/pkg-conf/license
generated
vendored
2
node_modules/pkg-conf/license
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
|
|
|
|||
46
node_modules/pkg-conf/node_modules/find-up/index.js
generated
vendored
46
node_modules/pkg-conf/node_modules/find-up/index.js
generated
vendored
|
|
@ -1,46 +0,0 @@
|
|||
'use strict';
|
||||
const path = require('path');
|
||||
const locatePath = require('locate-path');
|
||||
|
||||
module.exports = (filename, opts = {}) => {
|
||||
const startDir = path.resolve(opts.cwd || '');
|
||||
const {root} = path.parse(startDir);
|
||||
|
||||
const filenames = [].concat(filename);
|
||||
|
||||
return new Promise(resolve => {
|
||||
(function find(dir) {
|
||||
locatePath(filenames, {cwd: dir}).then(file => {
|
||||
if (file) {
|
||||
resolve(path.join(dir, file));
|
||||
} else if (dir === root) {
|
||||
resolve(null);
|
||||
} else {
|
||||
find(path.dirname(dir));
|
||||
}
|
||||
});
|
||||
})(startDir);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.sync = (filename, opts = {}) => {
|
||||
let dir = path.resolve(opts.cwd || '');
|
||||
const {root} = path.parse(dir);
|
||||
|
||||
const filenames = [].concat(filename);
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
const file = locatePath.sync(filenames, {cwd: dir});
|
||||
|
||||
if (file) {
|
||||
return path.join(dir, file);
|
||||
}
|
||||
|
||||
if (dir === root) {
|
||||
return null;
|
||||
}
|
||||
|
||||
dir = path.dirname(dir);
|
||||
}
|
||||
};
|
||||
9
node_modules/pkg-conf/node_modules/find-up/license
generated
vendored
9
node_modules/pkg-conf/node_modules/find-up/license
generated
vendored
|
|
@ -1,9 +0,0 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
50
node_modules/pkg-conf/node_modules/find-up/package.json
generated
vendored
50
node_modules/pkg-conf/node_modules/find-up/package.json
generated
vendored
|
|
@ -1,50 +0,0 @@
|
|||
{
|
||||
"name": "find-up",
|
||||
"version": "3.0.0",
|
||||
"description": "Find a file or directory by walking up parent directories",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/find-up",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"find",
|
||||
"up",
|
||||
"find-up",
|
||||
"findup",
|
||||
"look-up",
|
||||
"look",
|
||||
"file",
|
||||
"search",
|
||||
"match",
|
||||
"package",
|
||||
"resolve",
|
||||
"parent",
|
||||
"parents",
|
||||
"folder",
|
||||
"directory",
|
||||
"dir",
|
||||
"walk",
|
||||
"walking",
|
||||
"path"
|
||||
],
|
||||
"dependencies": {
|
||||
"locate-path": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"tempy": "^0.2.1",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
87
node_modules/pkg-conf/node_modules/find-up/readme.md
generated
vendored
87
node_modules/pkg-conf/node_modules/find-up/readme.md
generated
vendored
|
|
@ -1,87 +0,0 @@
|
|||
# find-up [](https://travis-ci.org/sindresorhus/find-up) [](https://ci.appveyor.com/project/sindresorhus/find-up/branch/master)
|
||||
|
||||
> Find a file or directory by walking up parent directories
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install find-up
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
/
|
||||
└── Users
|
||||
└── sindresorhus
|
||||
├── unicorn.png
|
||||
└── foo
|
||||
└── bar
|
||||
├── baz
|
||||
└── example.js
|
||||
```
|
||||
|
||||
`example.js`
|
||||
|
||||
```js
|
||||
const findUp = require('find-up');
|
||||
|
||||
(async () => {
|
||||
console.log(await findUp('unicorn.png'));
|
||||
//=> '/Users/sindresorhus/unicorn.png'
|
||||
|
||||
console.log(await findUp(['rainbow.png', 'unicorn.png']));
|
||||
//=> '/Users/sindresorhus/unicorn.png'
|
||||
})();
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### findUp(filename, [options])
|
||||
|
||||
Returns a `Promise` for either the filepath or `null` if it couldn't be found.
|
||||
|
||||
### findUp([filenameA, filenameB], [options])
|
||||
|
||||
Returns a `Promise` for either the first filepath found (by respecting the order) or `null` if none could be found.
|
||||
|
||||
### findUp.sync(filename, [options])
|
||||
|
||||
Returns a filepath or `null`.
|
||||
|
||||
### findUp.sync([filenameA, filenameB], [options])
|
||||
|
||||
Returns the first filepath found (by respecting the order) or `null`.
|
||||
|
||||
#### filename
|
||||
|
||||
Type: `string`
|
||||
|
||||
Filename of the file to find.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
Directory to start from.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [find-up-cli](https://github.com/sindresorhus/find-up-cli) - CLI for this module
|
||||
- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file
|
||||
- [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package
|
||||
- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module like `require.resolve()` but from a given path
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
21
node_modules/pkg-conf/package.json
generated
vendored
21
node_modules/pkg-conf/package.json
generated
vendored
|
|
@ -1,16 +1,19 @@
|
|||
{
|
||||
"name": "pkg-conf",
|
||||
"version": "3.1.0",
|
||||
"version": "4.0.0",
|
||||
"description": "Get namespaced config from the closest package.json",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/pkg-conf",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
|
|
@ -27,23 +30,21 @@
|
|||
"fs",
|
||||
"graceful",
|
||||
"load",
|
||||
"pkg",
|
||||
"package",
|
||||
"config",
|
||||
"conf",
|
||||
"configuration",
|
||||
"object",
|
||||
"namespace",
|
||||
"namespaced"
|
||||
],
|
||||
"dependencies": {
|
||||
"find-up": "^3.0.0",
|
||||
"load-json-file": "^5.2.0"
|
||||
"find-up": "^6.0.0",
|
||||
"load-json-file": "^7.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
"ava": "^3.15.0",
|
||||
"tsd": "^0.17.0",
|
||||
"xo": "^0.44.0"
|
||||
},
|
||||
"fixture": {
|
||||
"foo": true
|
||||
|
|
|
|||
45
node_modules/pkg-conf/readme.md
generated
vendored
45
node_modules/pkg-conf/readme.md
generated
vendored
|
|
@ -1,9 +1,8 @@
|
|||
# pkg-conf [](https://travis-ci.org/sindresorhus/pkg-conf)
|
||||
# pkg-conf
|
||||
|
||||
> Get namespaced config from the closest package.json
|
||||
|
||||
Having tool specific config in package.json reduces the amount of metafiles in your repo (there are usually a lot!) and makes the config obvious compared to hidden dotfiles like `.eslintrc`, which can end up causing confusion. [XO](https://github.com/xojs/xo), for example, uses the `xo` namespace in package.json, and [ESLint](http://eslint.org) uses `eslintConfig`. Many more tools supports this, like [AVA](https://ava.li), [Babel](https://babeljs.io), [nyc](https://github.com/istanbuljs/nyc), etc.
|
||||
|
||||
Having tool specific config in package.json reduces the amount of metafiles in your repo (there are usually a lot!) and makes the config obvious compared to hidden dotfiles like `.eslintrc`, which can end up causing confusion. [XO](https://github.com/xojs/xo), for example, uses the `xo` namespace in package.json, and [ESLint](http://eslint.org) uses `eslintConfig`. Many more tools supports this, like [AVA](https://avajs.dev), [Babel](https://babeljs.io), [nyc](https://github.com/istanbuljs/nyc), etc.
|
||||
|
||||
## Install
|
||||
|
||||
|
|
@ -11,7 +10,6 @@ Having tool specific config in package.json reduces the amount of metafiles in y
|
|||
$ npm install pkg-conf
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```json
|
||||
|
|
@ -25,26 +23,23 @@ $ npm install pkg-conf
|
|||
```
|
||||
|
||||
```js
|
||||
const pkgConf = require('pkg-conf');
|
||||
import {packageConfig} from 'pkg-conf';
|
||||
|
||||
(async () => {
|
||||
const config = await pkgConf('unicorn');
|
||||
const config = await packageConfig('unicorn');
|
||||
|
||||
console.log(config.rainbow);
|
||||
//=> true
|
||||
})();
|
||||
console.log(config.rainbow);
|
||||
//=> true
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
It [walks up](https://github.com/sindresorhus/find-up) parent directories until a `package.json` can be found, reads it, and returns the user specified namespace or an empty object if not found.
|
||||
|
||||
### pkgConf(namespace, [options])
|
||||
### packageConfig(namespace, options?)
|
||||
|
||||
Returns a `Promise` for the config.
|
||||
|
||||
### pkgConf.sync(namespace, [options])
|
||||
### packageConfigSync(namespace, options?)
|
||||
|
||||
Returns the config.
|
||||
|
||||
|
|
@ -56,24 +51,24 @@ The package.json namespace you want.
|
|||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
Type: `object`
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string`<br>
|
||||
Type: `string`\
|
||||
Default: `process.cwd()`
|
||||
|
||||
Directory to start looking up for a package.json file.
|
||||
The directory to start looking up for a package.json file.
|
||||
|
||||
##### defaults
|
||||
|
||||
Type: `Object`<br>
|
||||
Type: `object`
|
||||
|
||||
Default config.
|
||||
The default config.
|
||||
|
||||
##### skipOnFalse
|
||||
|
||||
Type: `boolean`<br>
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
Skip `package.json` files that have the namespaced config explicitly set to `false`.
|
||||
|
|
@ -90,20 +85,14 @@ Example usage for the user:
|
|||
}
|
||||
```
|
||||
|
||||
### pkgConf.filepath(config)
|
||||
### packageJsonPath(config)
|
||||
|
||||
Pass in the `config` returned from any of the above methods.
|
||||
|
||||
Returns the filepath to the package.json file or `null` when not found.
|
||||
Pass in the config returned from any of the above methods.
|
||||
|
||||
Returns the file path to the package.json file or `undefined` if not found.
|
||||
|
||||
## Related
|
||||
|
||||
- [read-pkg-up](https://github.com/sindresorhus/read-pkg-up) - Read the closest package.json file
|
||||
- [read-pkg](https://github.com/sindresorhus/read-pkg) - Read a package.json file
|
||||
- [find-up](https://github.com/sindresorhus/find-up) - Find a file by walking up parent directories
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue