Skip to content

Commit

Permalink
fix(config): fixes incorrect deprecation notice
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jimthedev committed Nov 3, 2015
1 parent be51429 commit 7bef1af
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/configLoader/getNormalizedConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ function getNormalizedConfig(config, content) {
// Use the npm config key, be good citizens
if(content.config && content.config.commitizen) {
return content.config.commitizen;
} else {
// Old method, will be deprecated in 3.0.0
} else if(content.czConfig) { // Old method, will be deprecated in 3.0.0

// Suppress during test
if(typeof global.it !== 'function')
{
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");
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");
}
return content.czConfig;
}

} else {
// .cz.json or .czrc
return content;
Expand Down

0 comments on commit 7bef1af

Please sign in to comment.