Skip to content

Commit 7bef1af

Browse files
committed
fix(config): fixes incorrect deprecation notice
In certain scenarios a deprecation warning for czConfig was shown, even if the user had actually correctly configured commitizen to use the config.commitizen key. This fixes that issue and improves the warning in the deprecation notice to be more clear that it is specifically the repo (and not the adapter or the cli) that is having issues. Closes #50
1 parent be51429 commit 7bef1af

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/configLoader/getNormalizedConfig.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,15 @@ function getNormalizedConfig(config, content) {
1111
// Use the npm config key, be good citizens
1212
if(content.config && content.config.commitizen) {
1313
return content.config.commitizen;
14-
} else {
15-
16-
// Old method, will be deprecated in 3.0.0
14+
} else if(content.czConfig) { // Old method, will be deprecated in 3.0.0
15+
16+
// Suppress during test
1717
if(typeof global.it !== 'function')
1818
{
19-
console.error("\n********\nWARNING: You are using czConfig in your package.json. czConfig will be deprecated in Commitizen 3. \nPlease use this instead:\n{\n \"config\": {\n \"commitizen\": {\n \"path\": \"./path/to/adapter\"\n }\n }\n}\nFor more information, see: http://commitizen.github.io/cz-cli/\n********\n");
19+
console.error("\n********\nWARNING: This repository's package.json is using czConfig. czConfig will be deprecated in Commitizen 3. \nPlease use this instead:\n{\n \"config\": {\n \"commitizen\": {\n \"path\": \"./path/to/adapter\"\n }\n }\n}\nFor more information, see: http://commitizen.github.io/cz-cli/\n********\n");
2020
}
2121
return content.czConfig;
2222
}
23-
2423
} else {
2524
// .cz.json or .czrc
2625
return content;

0 commit comments

Comments
 (0)