forked from havsar/node-ts-cache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
41 lines (35 loc) · 1.09 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
const { parallel, task } = require('gulp');
const del = require('del');
const glob = require('glob');
const childProcess = require('child_process');
task('cleanModules', function() {
return del(['./ts-cache/node_modules', './storages/*/node_modules']);
});
task('cleanTmp', function() {
return del(['./ts-cache/.tmp', './storages/*/.tmp']);
});
task('cleanDist', function() {
return del(['./ts-cache/dist', './storages/*/dist']);
});
task('updatePackages', function(cb) {
const check = pkgJsonPath => {
try {
return childProcess.execSync(`npx ncu --packageFile ${pkgJsonPath} -u`).toString();
} catch (error) {
console.log(`exec error: ${error.message}`);
process.exit(error.status);
}
};
glob('./**/*/package.json', {}, (er, files) => {
files.forEach(file => {
if (file.includes('node_modules')) {
return;
}
// console.log(`command to update: ncu --packageFileDir --packageFile ${file} -u -i`);
console.log(check(file));
});
cb();
});
});
exports.superclean = parallel('cleanDist', 'cleanTmp', 'cleanModules');
exports.clean = parallel('cleanDist', 'cleanTmp');