Clear out the build directory before compiling lang.
This commit is contained in:
@@ -1,11 +1,19 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const del = require('del');
|
||||
const prettier = require('prettier');
|
||||
const chalk = require('chalk');
|
||||
|
||||
const src = path.resolve(__dirname, '../lang');
|
||||
const dest = path.resolve(__dirname, '../build');
|
||||
const files = fs.readdirSync(src);
|
||||
|
||||
const removed = del.sync([path.join(dest, '*.json')]);
|
||||
|
||||
if (removed.length) {
|
||||
console.log(removed.map(n => `${n} ${chalk.redBright('✗')}`).join('\n'));
|
||||
}
|
||||
|
||||
if (!fs.existsSync(dest)) {
|
||||
fs.mkdirSync(dest);
|
||||
}
|
||||
@@ -23,5 +31,5 @@ files.forEach(file => {
|
||||
|
||||
fs.writeFileSync(path.resolve(dest, file), json);
|
||||
|
||||
console.log(path.resolve(src, file), '->', path.resolve(dest, file));
|
||||
console.log(path.resolve(src, file), chalk.greenBright('->'), path.resolve(dest, file));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user