@@ -72,41 +72,50 @@ try {
7272}
7373catch ( ex ) {
7474
75- // Create a config file if asked to do so
76- if ( cli . args . createConfig ) {
75+ console . log ( "No configuration, using defaults." ) ;
76+
77+ }
7778
78- // Check for config dir
79- if ( ! fs . existsSync ( "config" ) ) {
80- // Create dir
81- executeCommand ( "mkdir config" ) ;
82- }
83-
84- // Check for environment config file
85- if ( ! fs . existsSync ( "config/" + env + ".json" ) ) {
86-
87- // Create file
88- fs . writeFileSync ( "config/" + env + ".json" ,
89- JSON . stringify (
90- {
91- "importer" : importer ,
92- "converter" : converter ,
93- "builder" : builder ,
94- "exporter" : exporter
95- } ,
96- null ,
97- '\t'
98- )
99- ) ;
100-
101- }
79+ // Create a config file if asked to do so
80+ if ( cli . args . createConfig ) {
10281
82+ // Check for config dir
83+ if ( ! fs . existsSync ( "config" ) ) {
84+ // Create dir
85+ executeCommand ( "mkdir config" ) ;
10386 }
10487
88+ // Check for environment config file
89+ if ( ! fs . existsSync ( "config/" + env + ".json" ) ) {
90+
91+ // Create file
92+ fs . writeFileSync ( "config/" + env + ".json" ,
93+ JSON . stringify (
94+ {
95+ "importer" : importer ,
96+ "converter" : converter ,
97+ "builder" : builder ,
98+ "exporter" : exporter
99+ } ,
100+ null ,
101+ '\t'
102+ )
103+ ) ;
104+
105+ }
106+
107+ // Kill the program
108+ console . log ( "Configuration file created successfully." ) ;
109+ process . exit ( ) ;
110+
105111}
106112
107113// Append properties to payload
108114payload . build . force = cli . args . forceBuild ;
109115
116+ // Check if we need to build
117+ let shouldBuild = builder . shouldBuild ( ) || cli . args . forceBuild ;
118+
110119// Start the engine
111120console . log ( "Importing..." ) ;
112121executeCommand ( importer . precmd ) ;
@@ -119,7 +128,7 @@ importer.run(payload)
119128 } )
120129 . then ( ( payload ) => {
121130 executeCommand ( converter . postcmd ) ;
122- if ( builder . shouldBuild ( ) || cli . args . forceBuild ) {
131+ if ( shouldBuild ) {
123132 executeCommand ( builder . precmd ) ;
124133 console . log ( "Building..." ) ;
125134 return builder . run ( payload ) ;
@@ -130,7 +139,7 @@ importer.run(payload)
130139 }
131140 } )
132141 . then ( ( payload ) => {
133- if ( builder . shouldBuild ( ) || cli . args . forceBuild ) {
142+ if ( shouldBuild ) {
134143 executeCommand ( builder . postcmd ) ;
135144 }
136145 executeCommand ( exporter . precmd ) ;
0 commit comments