A Node.js utility to retrieve namespaced configuration from the nearest package.json file.
package-config is a Node.js library that retrieves namespaced configuration data 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 manageable. The library automatically walks up parent directories to find the relevant package.json and extracts config under a specified namespace.
Node.js developers and tool authors who need to read configuration from package.json files, especially those building CLI tools, linters, bundlers, or other development utilities that support package.json-based config.
Developers choose package-config for its simplicity, reliability, and alignment with the trend of storing tool config in package.json. It reduces repository noise, provides both sync and async APIs, and integrates seamlessly with existing Node.js tooling ecosystems.
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.
Eliminates hidden dotfiles like .eslintrc by storing tool settings directly in package.json, reducing repository clutter and improving discoverability, as highlighted in the README's philosophy.
Walks up parent directories to find the closest package.json, ensuring the most relevant config is used without manual path handling, which simplifies nested project structures.
Provides both synchronous (packageConfigSync) and asynchronous (packageConfig) methods, catering to different Node.js use cases, such as CLI tools or async workflows.
Supports custom cwd, default config fallbacks, and skipOnFalse to ignore configs set to false, offering control over how configuration is retrieved in complex setups.
Only reads configuration from package.json files, making it unsuitable for tools that need to support other sources like environment variables or separate config files.
Does not validate the structure or schema of the configuration data, requiring users to handle errors manually, which can lead to runtime issues if the config is malformed.
Primarily targets Node.js tools that adopt package.json-based config; for broader configuration management, more comprehensive libraries like cosmiconfig might be necessary.