Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. npm
  3. package-config

package-config

MITJavaScriptv5.0.0

A Node.js utility to retrieve namespaced configuration from the nearest package.json file.

GitHubGitHub
120 stars10 forks0 contributors

What is package-config?

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.

Target Audience

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.

Value Proposition

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.

Overview

Get namespaced config from the closest package.json

Use Cases

Best For

  • Reading ESLint, Babel, or AVA configuration from package.json
  • Building CLI tools that support package.json-based user settings
  • Reducing hidden dotfiles in JavaScript/Node.js projects
  • Implementing namespaced config for custom development tools
  • Retrieving nested or root-level package.json configuration
  • Creating tools that need to traverse directory structures for config

Not Ideal For

  • Tools requiring configuration from multiple file formats (e.g., YAML, TOML)
  • Applications that need dynamic, real-time config updates without file system reads
  • Projects with complex validation or transformation rules for configuration data
  • Environments without package.json, such as browser-only libraries or non-Node.js setups

Pros & Cons

Pros

Centralized Configuration

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.

Automatic Directory Traversal

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.

Dual API Support

Provides both synchronous (packageConfigSync) and asynchronous (packageConfig) methods, catering to different Node.js use cases, such as CLI tools or async workflows.

Flexible Search Options

Supports custom cwd, default config fallbacks, and skipOnFalse to ignore configs set to false, offering control over how configuration is retrieved in complex setups.

Cons

Limited to Package.json

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.

No Built-in Validation

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.

Niche Use Case

Primarily targets Node.js tools that adopt package.json-based config; for broader configuration management, more comprehensive libraries like cosmiconfig might be necessary.

Frequently Asked Questions

Quick Stats

Stars120
Forks10
Contributors0
Open Issues0
Last commit2 years ago
CreatedSince 2015

Tags

#developer-tools#package-json#npm-package#nodejs#tooling#javascript#config-loader#configuration-management

Built With

N
Node.js

Included in

npm4.7k
Auto-fetched 18 hours ago

Related Projects

npm-checknpm-check

Check for outdated, incorrect, and unused dependencies.

Stars6,637
Forks235
Last commit6 days ago
npm-run-allnpm-run-all

A CLI tool to run multiple npm-scripts in parallel or sequential.

Stars5,839
Forks239
Last commit1 year ago
npm-windows-upgradenpm-windows-upgrade

:rocket: Upgrade npm on Windows

Stars2,507
Forks145
Last commit5 years ago
emma-cliemma-cli

📦 Terminal assistant to find and install node packages.

Stars1,245
Forks42
Last commit8 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub