forked from commitizen/cz-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetNormalizedConfig.js
More file actions
28 lines (22 loc) · 994 Bytes
/
getNormalizedConfig.js
File metadata and controls
28 lines (22 loc) · 994 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
export default getNormalizedConfig;
// Given a config and content, plucks the actual
// settings that we're interested in
function getNormalizedConfig (config, content) {
if (content && (config === 'package.json')) {
// PACKAGE.JSON
// Use the npm config key, be good citizens
if (content.config && content.config.commitizen) {
return content.config.commitizen;
} 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: 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;
}
}