Skip to content

Add same config file resolution as cz-cli #547

Description

@kykungz

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions