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

support config file #460

Closed
zyy7259 opened this issue Nov 15, 2017 · 12 comments · Fixed by #739
Closed

support config file #460

zyy7259 opened this issue Nov 15, 2017 · 12 comments · Fixed by #739
Labels

Comments

@zyy7259
Copy link

zyy7259 commented Nov 15, 2017

support .czrc or cz.config.js config file through https://github.com/davidtheclark/cosmiconfig

@prometheas
Copy link

I must first say that it's very courteous indeed that commitizen at least looks for its configs under a top-level config key in package.json, rather than forcing us to jam another bespoke key name in that file like so many other packages do, but… definitely this, please!

@lucascono
Copy link

Please, implement cosmiconfig. It is very useful to be able to highlight syntax in text editors according to file extensions.

@Nargonath
Copy link

Another use case for this is when you want to gather all your configuration into one package ala react-scripts.

@fsmaia
Copy link
Contributor

fsmaia commented May 14, 2020

I would love this too! Any help wanted?

@travi
Copy link
Contributor

travi commented May 14, 2020

is there something special desired about cosmiconfig that isn't handled currently? i've been using .czrc files in my projects for quite a while. here are the currently supported sources:

var configs = ['.czrc', '.cz.json', 'package.json'];

@Nargonath
Copy link

From what I remembered since my last post, what I wanted to do is "import" my configuration from a package instead of having it in the root folder i.e for prettier I can do that:

// .prettierrc.js
const config = require('my-prettier-config');

module.exports = config;

From what I understand such behavior was not possible at least in 2019 when I commented.

@fsmaia
Copy link
Contributor

fsmaia commented May 14, 2020

I found out that the configuration is read in the presets/styles instead of cz-cli. Example:
https://github.com/commitizen/cz-conventional-changelog/blob/master/index.js#L7

@Nargonath
Copy link

I'm not sure what you mean by that.

@fsmaia
Copy link
Contributor

fsmaia commented May 15, 2020

I mean that configLoader is used by cz-cli to determine the preset, but preset with additional configurations must also call configLoader to load them, otherwise rc file configurations won't be read.

But IMHO this issue's main purpose is the lack of documentation concerning configuration files. A simple phrase in README like: "this project uses cosmiconfig" would be enough.

@prometheas
Copy link

prometheas commented May 19, 2020

Yes, agree with @fsmaia that the heart of this issue is the lack of documentation around the package's support of config files, though it's hard to know without confirmation from its creator, @zyy7259.

That said, assuming this is correct, the PR above (assuming it's approved and merged) does seem allow this issue to be closed…

@commitizen-bot
Copy link

🎉 This issue has been resolved in version 4.1.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@pmcelhaney
Copy link
Contributor

For anyone following this thread I just created a PR to support cosmiconfig attached to #773

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants