General improvements #92
|
@ -15,10 +15,6 @@
|
|||
"@babel/preset-env": "^7.20.2",
|
||||
"@intlify/vue-i18n-loader": "^4.2.0",
|
||||
"@quasar/app-webpack": "^3.0.0",
|
||||
"archiver": "^5.3.1",
|
||||
"assets-webpack-plugin": "^7.1.1",
|
||||
"babel-loader": "^9.1.0",
|
||||
"bundle-loader": "^0.5.6",
|
||||
"cypress-mochawesome-reporter": "^3.8.2",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
|
@ -31,9 +27,6 @@
|
|||
"eslint-plugin-vue": "^9.27.0",
|
||||
"eslint-webpack-plugin": "^3.1.1",
|
||||
"file-loader": "^6.2.0",
|
||||
"fs-extra": "^10.1.0",
|
||||
"glob": "^8.0.3",
|
||||
"html-webpack-plugin": "^5.5.0",
|
||||
"json-loader": "^0.5.7",
|
||||
"yaml-loader": "^0.5.0"
|
||||
},
|
||||
|
@ -42,7 +35,6 @@
|
|||
"@quasar/extras": "^1.16.9",
|
||||
"axios": "^0.21.1",
|
||||
"core-js": "^3.6.5",
|
||||
"js-yaml": "^3.12.1",
|
||||
"pinia": "^2.0.11",
|
||||
"quasar": "^2.14.5",
|
||||
"require-yaml": "0.0.1",
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
#!/usr/bin/node
|
||||
|
||||
var glob = require('glob');
|
||||
var fs = require('fs-extra');
|
||||
var path = require('path');
|
||||
var archiver = require('archiver');
|
||||
|
||||
let lang = process.argv[2];
|
||||
|
||||
if (lang == null)
|
||||
{
|
||||
let baseName = path.basename(process.argv[1]);
|
||||
console.log(`Usage: ${baseName} language_code`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
let nTasks;
|
||||
let projectDir;
|
||||
|
||||
(async () => {
|
||||
await fs.remove(lang);
|
||||
projectDir = await fs.realpath(`${__dirname}/..`);
|
||||
|
||||
projectDir = realPath;
|
||||
let len = projectDir.length + 1;
|
||||
|
||||
glob(`${projectDir}/**/locale/`, async (err, localeDirs) => {
|
||||
if (err) throw err;
|
||||
|
||||
for (let localeDir of localeDirs) {
|
||||
localeDir = localeDir.substr(len)
|
||||
|
||||
if (/^node_modules\//.test (localeDir))
|
||||
continue;
|
||||
|
||||
await exportLocale(localeDir);
|
||||
}
|
||||
|
||||
nTasks = localeDirs.length;
|
||||
});
|
||||
})();
|
||||
|
||||
async function exportLocale (localeDir) {
|
||||
let dstDir = `${lang}/${localeDir}`;
|
||||
|
||||
try {
|
||||
await fs.mkdirp(dstDir);
|
||||
|
||||
let src, dst;
|
||||
|
||||
src = `${projectDir}/${localeDir}/en.json`;
|
||||
dst = `${dstDir}/en.json`;
|
||||
fs.copy(src, dst, onTaskEnd);
|
||||
|
||||
src = `${projectDir}/${localeDir}/${lang}.json`;
|
||||
dst = `${dstDir}/${lang}.json`;
|
||||
fs.copy(src, dst, onTaskEnd);
|
||||
|
||||
nTasks += 2;
|
||||
}
|
||||
catch (e) {
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
nTasks--;
|
||||
if (nTasks > 0) return;
|
||||
|
||||
let output = fs.createWriteStream(`${lang}.zip`);
|
||||
output.on ('close', () =>{
|
||||
fs.remove(lang);
|
||||
console.log ('Export finalized!');
|
||||
});
|
||||
|
||||
let archive = archiver('zip', {
|
||||
zlib: { level: 9 }
|
||||
});
|
||||
archive.on ('error', err => {
|
||||
throw err;
|
||||
});
|
||||
archive.pipe(output);
|
||||
archive.directory(lang);
|
||||
archive.finalize();
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
#!/usr/bin/node
|
||||
|
||||
var glob = require('glob');
|
||||
var fs = require('fs-extra');
|
||||
var yaml = require('js-yaml');
|
||||
|
||||
(async () => {
|
||||
let projectDir = await fs.realpath(`${__dirname}/..`);
|
||||
|
||||
glob(`${projectDir}/**/locale/*.json`, async (err, localeFiles) => {
|
||||
if (err) throw err;
|
||||
|
||||
for (let localeFile of localeFiles) {
|
||||
if (/node_modules/.test (localeFile))
|
||||
continue;
|
||||
|
||||
let dstFile = localeFile.replace(/\.json$/, '.yml');
|
||||
let ymlString = yaml.safeDump(require(localeFile));
|
||||
await fs.writeFile(dstFile, ymlString, 'utf8');
|
||||
await fs.unlink(localeFile);
|
||||
|
||||
console.log('->', localeFile);
|
||||
console.log(' ', dstFile);
|
||||
}
|
||||
|
||||
console.log('Total %d files dumped.', localeFiles.length);
|
||||
});
|
||||
})();
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"buildDir": "build",
|
||||
"devServerPort": 9090,
|
||||
"entry": "./app.js"
|
||||
}
|
Loading…
Reference in New Issue