Skip to content

Conversation

bhouston
Copy link
Member

Replace cosmiconfig with c12 for configuration management

This PR replaces cosmiconfig with c12 for better TypeScript support and additional configuration features, as requested in issue #260.

Changes

  • Replaced cosmiconfig with c12 for configuration loading
  • Added configuration watching capability via watchConfigForChanges function
  • Removed dependency on cosmiconfig
  • Maintained backward compatibility with existing configuration files
  • Fixed type issues when working with c12's configuration types

Benefits of c12 over cosmiconfig

  1. TypeScript Support: c12 has built-in TypeScript support without requiring custom loaders
  2. More Configuration Formats: Supports JSONC, JSON5, TOML in addition to standard formats
  3. Configuration Directory: Supports a .config/ directory for organizing configuration files
  4. Environment-specific Configurations: Allows for environment-specific configuration files
  5. Extended Configurations: Supports extending configurations from other files or packages
  6. Configuration Watching: Built-in support for watching configuration files for changes
  7. Dotenv Support: Built-in support for loading environment variables from .env files
  8. Active Development: Part of the UnJS ecosystem, actively maintained

Testing

  • All tests pass with the new implementation
  • The API remains compatible with existing code

Closes #260

- Replace cosmiconfig with c12 for better TypeScript support
- Add configuration watching capability
- Remove dependency on cosmiconfig
- Maintain backward compatibility with existing config files
- Closes #260
@bhouston bhouston merged commit cc17315 into main Mar 14, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adopt UnJS/c12 instead of cosmiconfig

1 participant