Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use cosmiconfig so users can use whatever config file extension they want #773

Open
felipecrs opened this issue Aug 27, 2020 · 3 comments · May be fixed by #888 or #987
Open

Use cosmiconfig so users can use whatever config file extension they want #773

felipecrs opened this issue Aug 27, 2020 · 3 comments · May be fixed by #888 or #987

Comments

@felipecrs
Copy link
Contributor

felipecrs commented Aug 27, 2020

With cosmiconfig we could automatically load the configuration file from whatever supported file, such as:

  • a package.json property
  • a JSON or YAML, extensionless "rc file"
  • an "rc file" with the extensions .json, .yaml, .yml, .js, or .cjs
  • a .config.js or .config.cjs CommonJS module

I'm personally looking for a .czrc.json, so my VSCode can automatically detect it as JSON.

Nonetheless, this would reduce a lot of code from this repo.

https://github.com/davidtheclark/cosmiconfig

Related: #460

@gustavopch
Copy link

My use case: I want to use .js to be able to import emojis from other file (my semantic-release and commitlint configs also import from there).

@pmcelhaney
Copy link
Contributor

Just found out about lilconfig which has the parts of cosmiconfig that matter and zero dependencies.

@pmcelhaney
Copy link
Contributor

I'm looking at this today.

pmcelhaney added a commit to pmcelhaney/cz-cli that referenced this issue Jan 5, 2022
it should now be able to find the config file from a subdirectory

fixes commitizen#773
pmcelhaney added a commit to pmcelhaney/cz-cli that referenced this issue Jan 5, 2022
it should now be able to find the config file from a subdirectory

fixes commitizen#773
pmcelhaney added a commit to pmcelhaney/cz-cli that referenced this issue Jan 5, 2022
it should now be able to find the config file from a subdirectory

fixes commitizen#773
@pmcelhaney pmcelhaney linked a pull request Jan 5, 2022 that will close this issue
pmcelhaney added a commit to pmcelhaney/cz-cli that referenced this issue Jan 5, 2022
it should now be able to find the config file from a subdirectory

fixes commitizen#773
levi2ki pushed a commit to levi2ki/cz-cli that referenced this issue Oct 31, 2023
Added fully compatible cosmiconfig support with BOM and encoding checks. Added json5 config format parser. Added tests. Some minor code style changes;

Closes: commitizen#773
levi2ki pushed a commit to levi2ki/cz-cli that referenced this issue Nov 5, 2023
Added cosmiconfig support;
Added json5 support for configs;
Removed deprecated czConfig attribute support;
Added load and loadAtRoot public api hepers;
Removed findup and config normalization functions that are not required for now;

BREAKING CHANGE: config.path now resolves relative to config location;
  config lookup now relays on cosmiconfig search rules;
Closes: commitizen#773
@levi2ki levi2ki linked a pull request Nov 5, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment