mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 05:37:20 +01:00
Added telemetry script.
This commit is contained in:
parent
3717b0e888
commit
45e4bfe3a9
6 changed files with 162 additions and 31 deletions
|
|
@ -1,4 +1,4 @@
|
|||
const fs = require('fs');
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const del = require('del');
|
||||
const prettier = require('prettier');
|
||||
|
|
@ -14,22 +14,24 @@ if (removed.length) {
|
|||
console.log(removed.map(n => `${n} ${chalk.redBright('✗')}`).join('\n'));
|
||||
}
|
||||
|
||||
if (!fs.existsSync(dest)) {
|
||||
fs.mkdirSync(dest);
|
||||
async function run() {
|
||||
await fs.ensureDir(dest);
|
||||
|
||||
files.forEach(file => {
|
||||
const lang = require(`../lang/${file}`);
|
||||
const keys = Object.keys(lang).sort();
|
||||
|
||||
const formatted = keys.reduce((obj, key) => {
|
||||
obj[key] = { defaultMessage: lang[key] };
|
||||
return obj;
|
||||
}, {});
|
||||
|
||||
const json = prettier.format(JSON.stringify(formatted), { parser: 'json' });
|
||||
|
||||
fs.writeFileSync(path.resolve(dest, file), json);
|
||||
|
||||
console.log(path.resolve(src, file), chalk.greenBright('->'), path.resolve(dest, file));
|
||||
});
|
||||
}
|
||||
|
||||
files.forEach(file => {
|
||||
const lang = require(`../lang/${file}`);
|
||||
const keys = Object.keys(lang).sort();
|
||||
|
||||
const formatted = keys.reduce((obj, key) => {
|
||||
obj[key] = { defaultMessage: lang[key] };
|
||||
return obj;
|
||||
}, {});
|
||||
|
||||
const json = prettier.format(JSON.stringify(formatted), { parser: 'json' });
|
||||
|
||||
fs.writeFileSync(path.resolve(dest, file), json);
|
||||
|
||||
console.log(path.resolve(src, file), chalk.greenBright('->'), path.resolve(dest, file));
|
||||
});
|
||||
run();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue