forked from krausest/js-framework-benchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cleanup.js
33 lines (30 loc) · 911 Bytes
/
cleanup.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
var _ = require('lodash');
var exec = require('child_process').execSync;
var fs = require('fs');
var commandExists = require('command-exists');
const path = require('path');
const rimraf = require('rimraf');
function rmIfExists(base, name) {
let dir = path.join(base, name);
if(fs.existsSync(dir)) {
console.log("Clean ",dir);
rimraf.sync(dir);
}
}
for (let keyedType of ['keyed', 'non-keyed']) {
let dir = path.resolve('frameworks', keyedType);
let directories = fs.readdirSync(dir);
for (let name of directories) {
let fd = path.resolve(dir, name);
console.log('cleaning ', fd);
if(fs.existsSync(fd+"/node_modules")) {
rimraf.sync(fd+"/node_modules");
}
rmIfExists(fd, "package-lock.json");
rmIfExists(fd, "yarn.lock");
rmIfExists(fd, "dist");
rmIfExists(fd, "elm-stuff");
rmIfExists(fd, "bower_components");
rmIfExists(fd, "node_modules");
}
}