Read namespaced configuration from the nearest package.json file in a project.
package-config is a Node.js library that reads namespaced configuration from the nearest `package.json` file in a directory tree. It solves the problem of scattered, hidden configuration files (like `.eslintrc`) by centralizing tool settings within `package.json`, making them more visible and reducing repository clutter.
Node.js developers and tool authors who want to store and retrieve configuration in `package.json` namespaces, especially those building CLI tools, linters, bundlers, or testing frameworks.
Developers choose package-config for its simplicity, reliability, and alignment with the ecosystem trend of using `package.json` for configuration. It offers both sync and async APIs, flexible traversal options, and integrates seamlessly with existing tools like ESLint and AVA.
Get namespaced config from the closest package.json
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Reduces hidden dotfiles like .eslintrc by storing config in package.json, making settings more discoverable and cutting repository clutter, as highlighted in the README's philosophy.
Walks up parent directories to find the closest package.json, ideal for nested structures like monorepos, supported by the walk-up mechanism described in the API.
Provides both synchronous (packageConfigSync) and asynchronous (packageConfig) methods, catering to different Node.js use cases with clear examples in the documentation.
Seamlessly works with popular tools like ESLint and AVA that already use namespaced config in package.json, reducing adoption friction for tool authors.
Centralizing all configs can lead to a large, unwieldy package.json file, especially in complex projects with many tools, complicating maintenance.
Restricts config to JSON format within package.json, lacking support for comments or alternative formats like YAML that some teams prefer for configuration.
Only retrieves config without validating structure or correctness, requiring users to implement error handling and schema checks separately.