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

Add same config file resolution as cz-cli #547

Open
kykungz opened this issue Dec 22, 2022 · 0 comments
Open

Add same config file resolution as cz-cli #547

kykungz opened this issue Dec 22, 2022 · 0 comments

Comments

@kykungz
Copy link

kykungz commented Dec 22, 2022

Currently, git-cz already has its own configuration file resolution:

git-cz/lib/getConfig.js

Lines 7 to 12 in e02bcb1

const configFiles = [
'.git-cz.json',
'changelog.config.js',
'changelog.config.cjs',
'changelog.config.json'
];

And also able to resolve commitizen config via config.commitizen.changelog in package.json:

git-cz/lib/getConfig.js

Lines 27 to 38 in e02bcb1

const pkgFilename = path.join(dir, 'package.json');
if (fs.existsSync(pkgFilename)) {
try {
const changelog = require(pkgFilename).config.commitizen.changelog;
if (changelog) {
return changelog;
}
// eslint-disable-next-line no-empty
} catch (error) {}
}

So it is already playing quite nice with commitizen's config, meaning we don't need to have an extra .git-cz.json or changelog.config.js file in our repository, as all git-cz configs can be stored alongside with commitizen config in package.json.

However, when we want to use commitizen globally, the convention is to use .czrc or .cz.json file in $HOME directory, which isn't supported in git-cz.

So I'm wondering if we could do the same with package.json by also recursively reading .czrc and .cz.json like what commitizen does?

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

No branches or pull requests

1 participant