-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
41 lines (36 loc) · 992 Bytes
/
Copy pathgulpfile.js
File metadata and controls
41 lines (36 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable no-console */
"use strict";
const gulp = require("gulp");
const fs = require("fs");
const rm = require("rimraf");
gulp.task('clean', () => {
const tempDirArray = [
".temp",
'./coverage',
'./.nyc_output',
"dist",
"tests/.temp"
];
for (let i = 0; i < tempDirArray.length; i += 1) {
const tempDir = tempDirArray[i];
try {
fs.stat(tempDir, (fsError) => {
if (fsError) {
if (fsError.code !== 'ENOENT') {
console.error(`ERROR: rmdifs.stat(${tempDir}) erorr: ${fsError}`);
}
} else {
rm(tempDir, (err) => {
if (err) {
console.error(`ERROR: Failed to rimraf dirs : ${tempDir}`);
}
});
}
});
} catch(err) {
console.error(`Clean '${tempDir}' error: '${err}'`);
}
}
return Promise.resolve(); // Directory does not exist, but do not stop GULP
});