@@ -8,7 +8,7 @@ const deepAssign = require('deep-assign');
88const updateNotifier = require ( 'update-notifier' ) ;
99
1010const pkg = require ( '../package.json' ) ;
11- const { preprocessArgs, fileExists, parseConfig, collect} = require ( './internals' ) ;
11+ const { preprocessArgs, fileExists, parseConfig, collect, ensureArray } = require ( './internals' ) ;
1212
1313const defaultConfig = parseConfig ( require ( './defaultConfig.json' ) ) ;
1414
@@ -66,12 +66,8 @@ if (!packageConfig && !doprConfig) {
6666}
6767
6868// Backward compat.
69- if ( packageConfig && typeof packageConfig . file === 'string' ) {
70- packageConfig . file = [ packageConfig . file ] ;
71- }
72- if ( doprConfig && typeof doprConfig . file === 'string' ) {
73- doprConfig . file = [ doprConfig . file ] ;
74- }
69+ packageConfig . file = ensureArray ( packageConfig . file ) ;
70+ doprConfig . file = ensureArray ( doprConfig . file ) ;
7571
7672// Construct configuration
7773const mergedConfig = deepAssign ( { } , defaultConfig , packageConfig , doprConfig ) ;
@@ -116,15 +112,19 @@ const configAction = (config.actions && config.actions[action]) || {};
116112const cliAction = Object . assign ( { } , defaultAction , configAction , programAction ) ;
117113
118114// Validation
119- if ( cliAction . file . length === 0 ) {
115+ if ( ! cliAction . file || cliAction . file . length === 0 ) {
120116 console . log ( chalk . red ( '\'file\' not configured.' ) ) ;
121117 process . exit ( 1 ) ;
122118}
119+
123120if ( cliAction . exec && ! cliAction . service ) {
124121 console . log ( chalk . red ( '\'service\' not configured.' ) ) ;
125122 process . exit ( 1 ) ;
126123}
127124
125+ cliAction . file = ensureArray ( cliAction . file ) ;
126+ cliAction . command = ensureArray ( cliAction . command ) ;
127+
128128const dockerComposeFiles = [ ] ;
129129
130130// Validate/sanitize all docker-compose files!
@@ -144,11 +144,6 @@ cliAction.file.forEach((file, pos) => {
144144 dockerComposeFiles . push ( '--file' , file ) ;
145145} ) ;
146146
147- // Supporting array command so treat anything else as array as well.
148- if ( typeof cliAction . command === 'string' ) {
149- cliAction . command = [ cliAction . command ] ;
150- }
151-
152147const cliOptions = {
153148 cwd : basePath ,
154149 stdio : 'inherit' ,
0 commit comments