Currently, git-cz already has its own configuration file resolution:
|
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:
|
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?
Currently,
git-czalready has its own configuration file resolution:git-cz/lib/getConfig.js
Lines 7 to 12 in e02bcb1
And also able to resolve
commitizenconfig viaconfig.commitizen.changeloginpackage.json:git-cz/lib/getConfig.js
Lines 27 to 38 in e02bcb1
So it is already playing quite nice with commitizen's config, meaning we don't need to have an extra
.git-cz.jsonorchangelog.config.jsfile in our repository, as allgit-czconfigs can be stored alongside withcommitizenconfig inpackage.json.However, when we want to use
commitizenglobally, the convention is to use.czrcor.cz.jsonfile in$HOMEdirectory, which isn't supported ingit-cz.So I'm wondering if we could do the same with
package.jsonby also recursively reading.czrcand.cz.jsonlike whatcommitizendoes?