no need for fse dep here

This commit is contained in:
tophf 2022-09-16 12:47:37 +03:00
parent da4bdc6821
commit 405a93f9e5

View File

@ -1,13 +1,12 @@
'use strict'; 'use strict';
const fs = require('fs'); const fs = require('fs');
const fse = require('fs-extra');
const DIR = '_locales/'; const DIR = '_locales/';
const RX_LNG_CODE = /^\w\w(_\w{2,3})?$/; // like `en` or `en_GB` const RX_LNG_CODE = /^\w\w(_\w{2,3})?$/; // like `en` or `en_GB`
const makeFileName = lng => `${DIR}${lng}/messages.json`; const makeFileName = lng => `${DIR}${lng}/messages.json`;
const readLngJson = lng => fse.readJsonSync(makeFileName(lng)); const readLngJson = lng => JSON.parse(fs.readFileSync(makeFileName(lng), 'utf8'));
const sortAlpha = ([a], [b]) => a < b ? -1 : a > b; const sortAlpha = ([a], [b]) => a < b ? -1 : a > b;
const src = readLngJson('en'); const src = readLngJson('en');
@ -63,7 +62,7 @@ function fixLngFile(lng) {
fs.rmSync(`${DIR}${lng}`, {recursive: true, force: true}); fs.rmSync(`${DIR}${lng}`, {recursive: true, force: true});
err = 'no translations -> deleted'; err = 'no translations -> deleted';
} else { } else {
fse.outputFileSync(makeFileName(lng), resStr + '\n'); fs.writeFileSync(makeFileName(lng), resStr + '\n', 'utf8');
err = [ err = [
numUnknown && `${numUnknown} unknown (dropped)`, numUnknown && `${numUnknown} unknown (dropped)`,
numUntranslated && `${numUntranslated} untranslated (dropped)`, numUntranslated && `${numUntranslated} untranslated (dropped)`,