From 7bef1aff92ace750de51d19e8fb74a7f000db048 Mon Sep 17 00:00:00 2001 From: Jim Cummins Date: Mon, 2 Nov 2015 20:36:08 -0600 Subject: [PATCH] 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 --- src/configLoader/getNormalizedConfig.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/configLoader/getNormalizedConfig.js b/src/configLoader/getNormalizedConfig.js index 9a745af7..96a10858 100644 --- a/src/configLoader/getNormalizedConfig.js +++ b/src/configLoader/getNormalizedConfig.js @@ -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;