Skip to content
This repository was archived by the owner on Jun 6, 2023. It is now read-only.

Commit 9ba4acd

Browse files
committed
Update lib/jobs/create.js
1 parent ae9845c commit 9ba4acd

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

lib/jobs/create.js

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -420,26 +420,27 @@ function create(params, cb) {
420420
if (params.ignoreFiles) {
421421
if (typeof params.ignoreFiles === 'string') {
422422
var ignoreFilesArray = params.ignoreFiles.split(',')
423-
ignoreFilesArray.forEach(function(element) {
424-
fs.lstat(params.workspace + '/' + element.trim(), (err, stats) => {
425-
if(err) {
426-
var err = new Error('Error: ignoreFiles argument not found');
427-
return ifCliPrintErrorOnly(err);
428-
}
429-
if (stats.isDirectory()) {
430-
element = '**/' + element + '/**'
431-
}
432-
console.log(element)
433-
})
423+
var ignoreFilesArrayFormatted = ignoreFilesArray.map(function(value, index, array) {
424+
try {
425+
var stats = fs.lstatSync(params.workspace + '/' + value.trim());
426+
}
427+
catch(err) {
428+
var err = new Error('Error: ignoreFiles argument not found');
429+
return ifCliPrintErrorOnly(err);
430+
}
431+
if (stats.isDirectory()) {
432+
value = '**/' + value + '/**'
433+
}
434+
return value
434435
})
435-
console.log(ignoreFilesArray)
436-
ignoreGlob = ignoreGlob.concat(ignoreFilesArray)
437-
} else {
438-
var err = new Error('Error: ignoreFiles argument should be folder or file name in string format');
439-
return ifCliPrintErrorOnly(err);
440-
}
436+
console.log(ignoreFilesArrayFormatted)
437+
ignoreGlob = ignoreGlob.concat(ignoreFilesArrayFormatted)
438+
} else {
439+
var err = new Error('Error: ignoreFiles argument should be folder or file name in string format');
440+
return ifCliPrintErrorOnly(err);
441441
}
442-
console.log(ignoreGlob)
442+
}
443+
console.log(ignoreGlob)
443444

444445
archive.pipe(output);
445446
if (stat.isDirectory()) {

0 commit comments

Comments
 (0)