Refactor project shape

This commit is contained in:
Alex Dima 2018-03-08 15:28:00 +01:00
parent 5c70cefbad
commit 92af97ca38
25 changed files with 96 additions and 104 deletions

21
scripts/rmdir.js Normal file
View file

@ -0,0 +1,21 @@
const fs = require('fs');
const path = require('path');
const target = path.join(process.cwd(), process.argv[2]);
rmDir(target);
console.log(`Deleted ${process.argv[2]}`);
function rmDir(dirPath) {
let entries = fs.readdirSync(dirPath);
if (entries.length > 0) {
for (var i = 0; i < entries.length; i++) {
var filePath = path.join(dirPath, entries[i]);
if (fs.statSync(filePath).isFile()) {
fs.unlinkSync(filePath);
} else {
rmDir(filePath);
}
}
}
fs.rmdirSync(dirPath);
}