* change root dit and change way to import modules * update deps to latest versions * use latest tools for building bundles * rewrite webpack config * use nomodule technique for loading modern bundle * inject polyfills by babel usebuiltins * update eslint rules * rename all style files to CSS * use postcss preset env for building styles * proper typescript typing * put all html files to templates folder * etc
36 lines
960 B
JavaScript
36 lines
960 B
JavaScript
const fs = require('fs');
|
|
const process = require('process');
|
|
const locales = require('./supportedLocales');
|
|
const getLocalePath = require('./getLocalePath');
|
|
const defaultMessages = require('./defaultMessages');
|
|
|
|
const errors = [];
|
|
|
|
locales.forEach(locale => {
|
|
const pathToDict = getLocalePath(locale);
|
|
|
|
if (!fs.existsSync(pathToDict)) {
|
|
throw new Error(
|
|
`"${locale}" translation file not found. Please run "npm run translation:generate" and commit changes.`
|
|
);
|
|
}
|
|
|
|
const dict = require(pathToDict);
|
|
const keysFromDict = Object.keys(dict);
|
|
const keys = Object.keys(defaultMessages);
|
|
|
|
keysFromDict.forEach(key => {
|
|
if (!keys.includes(key)) {
|
|
errors.push(
|
|
`"${key}" key not found in "${locale}" locale dict. Please run "npm run translation:generate" and commit changes.`
|
|
);
|
|
}
|
|
});
|
|
});
|
|
|
|
if (errors.length) {
|
|
// eslint-disable-next-line no-console
|
|
console.error(errors.join(`\n`));
|
|
process.exit(1);
|
|
}
|