11import childProcess from 'child_process' ;
22import path from 'path' ;
3+ import * as configLoader from './configLoader' ;
34import * as adapter from './adapter' ;
4- import * as configLoader from '../configLoader' ;
55
66let {
77 addPathToAdapterConfig,
@@ -15,9 +15,6 @@ export default init;
1515
1616const CLI_PATH = path . normalize ( path . join ( __dirname , '../../' ) ) ;
1717
18- /** Configuration sources in priority order. */
19- const LOADER_CONFIGS = [ '.czrc' , '.cz.json' , 'package.json' ] ;
20-
2118/**
2219 * CZ INIT
2320 *
@@ -66,7 +63,7 @@ function init (repoPath, adapterNpmName, {
6663 checkRequiredArguments ( repoPath , adapterNpmName ) ;
6764
6865 // Load the current adapter config
69- let adapterConfig = configLoader . loader ( LOADER_CONFIGS , null , repoPath ) ;
66+ let adapterConfig = loadAdapterConfig ( repoPath ) ;
7067
7168 // Get the npm string mappings based on the arguments provided
7269 let stringMappings = yarn ? getYarnAddStringMappings ( dev , exact , force ) : getNpmInstallStringMappings ( save , saveDev , saveExact , force ) ;
@@ -110,3 +107,16 @@ function checkRequiredArguments (path, adapterNpmName) {
110107 throw new Error ( "The adapter's npm name is required when running init." ) ;
111108 }
112109}
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