@@ -19,7 +19,7 @@ setTimeout(function(){
1919 process . exit ( )
2020} , 120000 )
2121
22- const { config, directories, sources } = CoCreateConfig ;
22+ const { config, directories, sources } = CoCreateConfig ;
2323
2424CoCreateCrud . socket . create ( config )
2525config . broadcast = false
@@ -147,14 +147,14 @@ async function runFiles(directory, entry, exclude, parentDirectory = '') {
147147
148148
149149function getSource ( path , mimeType ) {
150- let readType = 'utf8'
151- if ( / ^ ( i m a g e | a u d i o | v i d e o ) \/ [ - + . \w ] + / . test ( mimeType ) )
152- readType = 'base64'
150+ let readType = 'utf8'
151+ if ( / ^ ( i m a g e | a u d i o | v i d e o ) \/ [ - + . \w ] + / . test ( mimeType ) )
152+ readType = 'base64'
153153
154- let binary = fs . readFileSync ( path ) ;
155- let content = new Buffer . from ( binary ) . toString ( readType ) ;
154+ let binary = fs . readFileSync ( path ) ;
155+ let content = new Buffer . from ( binary ) . toString ( readType ) ;
156156
157- return content
157+ return content
158158}
159159
160160/**
@@ -264,13 +264,14 @@ async function run() {
264264
265265 if ( sources ) {
266266 let sources = await runSources ( )
267- let new_config = {
268- config,
269- directories,
270- sources,
271- }
272- delete new_config . config . broadcast
273- let write_str = JSON . stringify ( new_config , null , 4 )
267+ let newConfig = { ...CoCreateConfig }
268+ if ( directories )
269+ newConfig . directories = directories
270+
271+ newConfig . sources = sources
272+
273+ delete newConfig . config . broadcast
274+ let write_str = JSON . stringify ( newConfig , null , 4 )
274275 write_str = "module.exports = " + write_str ;
275276
276277 fs . writeFileSync ( configFile , write_str ) ;
0 commit comments