mirror of
https://github.com/umami-software/umami.git
synced 2026-02-19 12:05:41 +01:00
Remove download-country-names and download-language-names
This commit is contained in:
parent
8159d90535
commit
5e52ecd10b
3 changed files with 0 additions and 78 deletions
|
|
@ -37,8 +37,6 @@
|
|||
"compile-lang": "formatjs compile-folder --ast build/messages public/intl/messages",
|
||||
"clean-lang": "prettier --write ./public/intl/messages/*.json",
|
||||
"check-lang": "node scripts/check-lang.js",
|
||||
"download-country-names": "node scripts/download-country-names.js",
|
||||
"download-language-names": "node scripts/download-language-names.js",
|
||||
"change-password": "node scripts/change-password.js",
|
||||
"lint": "next lint --quiet",
|
||||
"prepare": "node -e \"if (process.env.NODE_ENV !== 'production'){process.exit(1)} \" || husky install",
|
||||
|
|
|
|||
|
|
@ -1,38 +0,0 @@
|
|||
/* eslint-disable no-console, @typescript-eslint/no-var-requires */
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const https = require('https');
|
||||
const chalk = require('chalk');
|
||||
|
||||
const src = path.resolve(__dirname, '../src/lang');
|
||||
const dest = path.resolve(__dirname, '../public/intl/country');
|
||||
const files = fs.readdirSync(src);
|
||||
|
||||
const getUrl = locale =>
|
||||
`https://raw.githubusercontent.com/umpirsky/country-list/master/data/${locale}/country.json`;
|
||||
|
||||
const asyncForEach = async (array, callback) => {
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
await callback(array[index], index, array);
|
||||
}
|
||||
};
|
||||
|
||||
const download = async files => {
|
||||
await fs.ensureDir(dest);
|
||||
|
||||
await asyncForEach(files, async file => {
|
||||
const locale = file.replace('-', '_').replace('.json', '');
|
||||
|
||||
const filename = path.join(dest, file);
|
||||
if (!fs.existsSync(filename)) {
|
||||
await new Promise(resolve => {
|
||||
https.get(getUrl(locale), res => {
|
||||
console.log('Downloaded', chalk.greenBright('->'), filename);
|
||||
resolve(res.pipe(fs.createWriteStream(filename)));
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
download(files);
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
/* eslint-disable no-console */
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const https = require('https');
|
||||
const chalk = require('chalk');
|
||||
|
||||
const src = path.resolve(__dirname, '../src/lang');
|
||||
const dest = path.resolve(__dirname, '../public/intl/language');
|
||||
const files = fs.readdirSync(src);
|
||||
|
||||
const getUrl = locale =>
|
||||
`https://raw.githubusercontent.com/umpirsky/language-list/master/data/${locale}/language.json`;
|
||||
|
||||
const asyncForEach = async (array, callback) => {
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
await callback(array[index], index, array);
|
||||
}
|
||||
};
|
||||
|
||||
const download = async files => {
|
||||
await fs.ensureDir(dest);
|
||||
|
||||
await asyncForEach(files, async file => {
|
||||
const locale = file.replace('-', '_').replace('.json', '');
|
||||
|
||||
const filename = path.join(dest, file);
|
||||
if (!fs.existsSync(filename)) {
|
||||
await new Promise(resolve => {
|
||||
https.get(getUrl(locale), res => {
|
||||
console.log('Downloaded', chalk.greenBright('->'), filename);
|
||||
resolve(res.pipe(fs.createWriteStream(filename)));
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
download(files);
|
||||
Loading…
Add table
Add a link
Reference in a new issue