@@ -176,20 +176,23 @@ module.exports = async function file(CoCreateConfig, configPath, match) {
176
176
}
177
177
if ( skip ) continue
178
178
179
+ let isDirectory = fs . existsSync ( `${ entryPath } /${ file } ` ) && fs . lstatSync ( `${ entryPath } /${ file } ` ) . isDirectory ( ) ;
180
+ let name = file
181
+ let source = ''
182
+
179
183
for ( let i = 0 ; i < match . length ; i ++ ) {
180
184
skip = true
181
185
const filePath = path . resolve ( entryPath , file ) ;
182
186
if ( filePath . startsWith ( match [ i ] ) ) {
183
187
skip = false
184
188
break ;
189
+ } else if ( isDirectory && match [ i ] . startsWith ( filePath ) ) {
190
+ skip = 'directory'
191
+ break ;
185
192
}
186
193
}
187
194
188
- if ( skip ) continue
189
-
190
- let isDirectory = fs . existsSync ( `${ entryPath } /${ file } ` ) && fs . lstatSync ( `${ entryPath } /${ file } ` ) . isDirectory ( ) ;
191
- let name = file
192
- let source = ''
195
+ if ( skip === true ) continue
193
196
194
197
const fileExtension = path . extname ( file ) ;
195
198
let mimeType = mimeTypes [ fileExtension ]
@@ -267,16 +270,19 @@ module.exports = async function file(CoCreateConfig, configPath, match) {
267
270
}
268
271
}
269
272
270
- if ( ! newObject . object . _id )
271
- newObject . $filter = {
272
- query : [ { key : 'pathname' , value : pathname , operator : '$eq' } ]
273
- }
274
273
275
- response = await runStore ( newObject ) ;
276
- console . log ( `Uploaded: ${ entryPath } /${ file } ` , `To: ${ pathname } ` )
274
+ if ( skip !== 'directory' ) {
275
+ if ( ! newObject . object . _id )
276
+ newObject . $filter = {
277
+ query : [ { key : 'pathname' , value : pathname , operator : '$eq' } ]
278
+ }
279
+
280
+ response = await runStore ( newObject ) ;
281
+ console . log ( `Uploaded: ${ entryPath } /${ file } ` , `To: ${ pathname } ` )
277
282
278
- if ( response . error )
279
- errorLog . push ( response . error )
283
+ if ( response . error )
284
+ errorLog . push ( response . error )
285
+ }
280
286
281
287
if ( isDirectory && pathname ) {
282
288
let newEntry
0 commit comments