{"_id":"package-config","_rev":"7-da0f76b601da8a207ce0505af499e475","name":"package-config","description":"Get namespaced config from the closest package.json","dist-tags":{"latest":"5.0.0"},"versions":{"0.1.0":{"name":"package-config","version":"0.1.0","description":"Node.js config loader based on package.json file.","main":"index.js","scripts":{"test":"mocha test -R spec --colors --bail"},"repository":{"type":"git","url":"https://github.com/leorossi/node-package-config.git"},"keywords":["package.json","config","environments"],"author":{"name":"Leonardo Rossi","email":"leonardo.rossi@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/leorossi/node-package-config/issues"},"homepage":"https://github.com/leorossi/node-package-config","devDependencies":{"should":"^4.4.2"},"gitHead":"cac70fec290e90029d890538421170304091c66c","_id":"package-config@0.1.0","_shasum":"87950ceb37723cecafca29650c24f790f2739d4f","_from":"./","_npmVersion":"1.4.28","_npmUser":{"name":"leorossi","email":"leonardo.rossi@gmail.com"},"maintainers":[{"name":"leorossi","email":"leonardo.rossi@gmail.com"}],"dist":{"shasum":"87950ceb37723cecafca29650c24f790f2739d4f","tarball":"https://registry.npmjs.org/package-config/-/package-config-0.1.0.tgz","integrity":"sha512-0YRNsV1ot6V0UDspC3MCsLmI6AFjwH3J6P2fObIpoXcQRUw63TOsmEZ7nGBTL+Aje8RFgFZ+kruPqo3ZJ3W1jg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDPdJidAzgHQ3RE8TwnJVq0b6YqbRxSz2dbtz9sNbpUlwIhAOS8fvFYMNpP7hO6EY3gsCEuiwD5lEA4GPRo7d/c1/0D"}]},"directories":{}},"5.0.0":{"name":"package-config","version":"5.0.0","description":"Get namespaced config from the closest package.json","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/package-config.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=18"},"scripts":{"test":"xo && ava && tsd"},"keywords":["json","read","parse","file","fs","graceful","load","package","config","configuration","object","namespace","namespaced"],"dependencies":{"find-up-simple":"^1.0.0","load-json-file":"^7.0.1"},"devDependencies":{"ava":"^5.3.1","tsd":"^0.29.0","xo":"^0.56.0"},"fixture":{"foo":true},"types":"./index.d.ts","gitHead":"06c7e264cafe44df72cf3c6cfb4b29eee4fb7a3f","bugs":{"url":"https://github.com/sindresorhus/package-config/issues"},"homepage":"https://github.com/sindresorhus/package-config#readme","_id":"package-config@5.0.0","_nodeVersion":"20.9.0","_npmVersion":"9.2.0","dist":{"integrity":"sha512-GYTTew2slBcYdvRHqjhwaaydVMvn/qrGC323+nKclYioNSLTDUM/lGgtGTgyHVtYcozb+XkE8CNhwcraOmZ9Mg==","shasum":"cba78b7feb3396fa0149caca2c72677ff302b3c4","tarball":"https://registry.npmjs.org/package-config/-/package-config-5.0.0.tgz","fileCount":5,"unpackedSize":8922,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCQysCK9u7pxpeUS8dknj6loXt/eYq/ATpKtnCthCO6BgIgP6G1Do6ohEgrxhJxCuDVZmcWHYV1ADO1pKKdq8iGeLE="}]},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/package-config_5.0.0_1699211508961_0.3770151924868308"},"_hasShrinkwrap":false}},"readme":"# package-config\n\n> Get namespaced config from the closest package.json\n\nHaving 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.\n\n## Install\n\n```sh\nnpm install package-config\n```\n\n## Usage\n\n```json\n{\n\t\"name\": \"some-package\",\n\t\"version\": \"1.0.0\",\n\t\"unicorn\": {\n\t\t\"rainbow\": true\n\t}\n}\n```\n\n```js\nimport {packageConfig} from 'package-config';\n\nconst config = await packageConfig('unicorn');\n\nconsole.log(config.rainbow);\n//=> true\n```\n\n## API\n\nIt [walks up](https://github.com/sindresorhus/find-up-simple) parent directories until a `package.json` can be found, reads it, and returns the user specified namespace or an empty object if not found.\n\n### packageConfig(namespace, options?)\n\nReturns a `Promise` for the config.\n\n### packageConfigSync(namespace, options?)\n\nReturns the config.\n\n#### namespace\n\nType: `string`\n\nThe package.json namespace you want.\n\n#### options\n\nType: `object`\n\n##### cwd\n\nType: `string`\\\nDefault: `process.cwd()`\n\nThe directory to start looking up for a package.json file.\n\n##### defaults\n\nType: `object`\n\nThe default config.\n\n##### skipOnFalse\n\nType: `boolean`\\\nDefault: `false`\n\nSkip `package.json` files that have the namespaced config explicitly set to `false`.\n\nContinues 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.\n\nExample usage for the user:\n\n```json\n{\n\t\"name\": \"some-package\",\n\t\"version\": \"1.0.0\",\n\t\"unicorn\": false\n}\n```\n\n### packageJsonPath(config)\n\nPass in the config returned from any of the above methods.\n\nReturns the file path to the package.json file or `undefined` if not found.\n\n## Related\n\n- [read-package-up](https://github.com/sindresorhus/read-package-up) - Read the closest package.json file\n- [read-pkg](https://github.com/sindresorhus/read-pkg) - Read a package.json file\n- [find-up](https://github.com/sindresorhus/find-up) - Find a file by walking up parent directories\n","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"time":{"modified":"2023-11-05T19:11:49.322Z","created":"2015-01-09T07:20:14.757Z","0.1.0":"2015-01-09T07:20:14.757Z","5.0.0":"2023-11-05T19:11:49.145Z"},"homepage":"https://github.com/sindresorhus/package-config#readme","keywords":["json","read","parse","file","fs","graceful","load","package","config","configuration","object","namespace","namespaced"],"repository":{"type":"git","url":"git+https://github.com/sindresorhus/package-config.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"bugs":{"url":"https://github.com/sindresorhus/package-config/issues"},"license":"MIT","readmeFilename":"readme.md"}