mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 12:47:13 +01:00
Clear out the build directory before compiling lang.
This commit is contained in:
parent
56bf85acae
commit
2444144db9
3 changed files with 67 additions and 6 deletions
|
|
@ -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));
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue