@@ -77,16 +77,7 @@ const mimeTypes = {
77
77
".7z" : "application/x-7z-compressed"
78
78
}
79
79
80
- module . exports = async function file ( CoCreateConfig ) {
81
-
82
- let configFile = path . resolve ( process . cwd ( ) , 'CoCreate.config.js' ) ;
83
- if ( fs . existsSync ( configFile ) ) {
84
- CoCreateConfig = require ( configFile ) ;
85
- } else {
86
- console . log ( 'CoCreate.config.js could not be found.' )
87
- process . exit ( )
88
- }
89
-
80
+ module . exports = async function file ( CoCreateConfig , configPath ) {
90
81
let { directories, sources } = CoCreateConfig ;
91
82
let config = await Config ( {
92
83
organization_id : {
@@ -113,7 +104,7 @@ module.exports = async function file(CoCreateConfig) {
113
104
}
114
105
}
115
106
}
116
- } )
107
+ } , null , null , configPath )
117
108
118
109
if ( ! config . organization_id || ! config . host || ! config . key && ( ! config . password || config . email ) ) {
119
110
console . log ( 'One or more required config params could not be found' )
@@ -170,7 +161,15 @@ module.exports = async function file(CoCreateConfig) {
170
161
let files = fs . readdirSync ( entry ) ;
171
162
172
163
for ( let file of files ) {
173
- if ( exclude && exclude . includes ( file ) ) continue
164
+ let skip = false
165
+ for ( let i = 0 ; i < exclude . length ; i ++ ) {
166
+ if ( file . includes ( exclude ) ) {
167
+ skip = true
168
+ break ;
169
+ }
170
+ }
171
+ if ( skip ) continue
172
+
174
173
175
174
let isDirectory = fs . existsSync ( `${ entry } /${ file } ` ) && fs . lstatSync ( `${ entry } /${ file } ` ) . isDirectory ( ) ;
176
175
let name = file
@@ -199,8 +198,6 @@ module.exports = async function file(CoCreateConfig) {
199
198
else
200
199
pathName = '/' + name
201
200
202
- if ( exclude && exclude . includes ( pathName ) ) continue
203
-
204
201
if ( isDirectory )
205
202
mimeType = "text/directory"
206
203
else
@@ -377,6 +374,8 @@ module.exports = async function file(CoCreateConfig) {
377
374
378
375
async function runStore ( data ) {
379
376
try {
377
+ if ( data . object . name === 'prism-chunk.js' )
378
+ console . log ( 'prism-chunk.js' )
380
379
let response ;
381
380
if ( ! data . object . _id && ! data . filter ) {
382
381
response = await crud . send ( {
@@ -424,9 +423,8 @@ module.exports = async function file(CoCreateConfig) {
424
423
425
424
delete newConfig . url
426
425
delete newConfig . broadcast
427
- const write_str = `module.exports = ${ JSON . stringify ( newConfig , null , 4 ) } ;` ;
428
426
429
- fs . writeFileSync ( configFile , write_str ) ;
427
+ fs . writeFileSync ( configPath , `module.exports = ${ JSON . stringify ( newConfig , null , 4 ) } ;` ) ;
430
428
}
431
429
432
430
console . log ( 'upload complete!' ) ;
0 commit comments