1
1
import childProcess from 'child_process' ;
2
2
import path from 'path' ;
3
+ import * as configLoader from './configLoader' ;
3
4
import * as adapter from './adapter' ;
4
- import * as configLoader from '../configLoader' ;
5
5
6
6
let {
7
7
addPathToAdapterConfig,
@@ -15,9 +15,6 @@ export default init;
15
15
16
16
const CLI_PATH = path . normalize ( path . join ( __dirname , '../../' ) ) ;
17
17
18
- /** Configuration sources in priority order. */
19
- const LOADER_CONFIGS = [ '.czrc' , '.cz.json' , 'package.json' ] ;
20
-
21
18
/**
22
19
* CZ INIT
23
20
*
@@ -66,7 +63,7 @@ function init (repoPath, adapterNpmName, {
66
63
checkRequiredArguments ( repoPath , adapterNpmName ) ;
67
64
68
65
// Load the current adapter config
69
- let adapterConfig = configLoader . loader ( LOADER_CONFIGS , null , repoPath ) ;
66
+ let adapterConfig = loadAdapterConfig ( repoPath ) ;
70
67
71
68
// Get the npm string mappings based on the arguments provided
72
69
let stringMappings = yarn ? getYarnAddStringMappings ( dev , exact , force ) : getNpmInstallStringMappings ( save , saveDev , saveExact , force ) ;
@@ -110,3 +107,16 @@ function checkRequiredArguments (path, adapterNpmName) {
110
107
throw new Error ( "The adapter's npm name is required when running init." ) ;
111
108
}
112
109
}
110
+
111
+ /**
112
+ * CONFIG
113
+ * Loads and returns the adapter config at key config.commitizen, if it exists
114
+ */
115
+ function loadAdapterConfig ( cwd ) {
116
+ let config = configLoader . load ( null , cwd ) ;
117
+ if ( config ) {
118
+ return config ;
119
+ } else {
120
+
121
+ }
122
+ }
0 commit comments