Currently, pkg reads configuration from the "pkg" field in package.json or a custom JSON file passed via --config. This requires either polluting package.json with pkg-specific fields or maintaining a separate .config.json file that must be explicitly referenced on every invocation.
Proposal
Support a .pkgrc (or .pkgrc.json / pkg.config.js) file that is auto-discovered in the project root, similar to how tools like ESLint, Prettier, and Babel handle configuration. This would:
- Reduce CLI verbosity — no need to pass
--config every time
- Keep
package.json clean
- Allow comments and richer config formats (JS/YAML) if desired
Scope
- Define the lookup order (e.g.
.pkgrc → .pkgrc.json → pkg.config.js → package.json#pkg)
- Update
lib/index.ts config resolution logic
- Document the new config file format
Part of #235
Currently, pkg reads configuration from the
"pkg"field inpackage.jsonor a custom JSON file passed via--config. This requires either pollutingpackage.jsonwith pkg-specific fields or maintaining a separate.config.jsonfile that must be explicitly referenced on every invocation.Proposal
Support a
.pkgrc(or.pkgrc.json/pkg.config.js) file that is auto-discovered in the project root, similar to how tools like ESLint, Prettier, and Babel handle configuration. This would:--configevery timepackage.jsoncleanScope
.pkgrc→.pkgrc.json→pkg.config.js→package.json#pkg)lib/index.tsconfig resolution logicPart of #235