forked from biocodellc/ppo-data-interface
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
47 lines (40 loc) · 1.16 KB
/
gulpfile.js
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
42
43
44
45
46
const gulp = require('gulp');
const fs = require('fs');
const path = require('path');
const { series, src, dest } = gulp;
// Custom clean function using fs and path
function clean(cb) {
const directory = './public';
// Check if directory exists
if (fs.existsSync(directory)) {
// Recursively remove directory
removeDirectory(directory);
}
cb(); // Callback to indicate completion
}
// Recursive function to remove directory
function removeDirectory(directory) {
fs.readdirSync(directory).forEach((file) => {
const filePath = path.join(directory, file);
if (fs.lstatSync(filePath).isDirectory()) {
removeDirectory(filePath);
} else {
fs.unlinkSync(filePath);
}
});
fs.rmdirSync(directory);
}
// Example of other tasks
function defaultTask(cb) {
src('app/*')
.pipe(dest('public/'))
.on('end', function() {
src('app/trait-viz/lib/*')
.pipe(dest('public/trait-viz/lib/'))
.on('end', cb);
});
}
// Register tasks
exports.clean = clean;
exports.default = defaultTask;
exports.build = series(clean, defaultTask);