Remove download-country-names and download-language-names

This commit is contained in:
Minseo Lee 2024-09-05 11:29:19 +09:00
parent 8159d90535
commit 5e52ecd10b
3 changed files with 0 additions and 78 deletions

View file

@ -37,8 +37,6 @@
"compile-lang": "formatjs compile-folder --ast build/messages public/intl/messages", "compile-lang": "formatjs compile-folder --ast build/messages public/intl/messages",
"clean-lang": "prettier --write ./public/intl/messages/*.json", "clean-lang": "prettier --write ./public/intl/messages/*.json",
"check-lang": "node scripts/check-lang.js", "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", "change-password": "node scripts/change-password.js",
"lint": "next lint --quiet", "lint": "next lint --quiet",
"prepare": "node -e \"if (process.env.NODE_ENV !== 'production'){process.exit(1)} \" || husky install", "prepare": "node -e \"if (process.env.NODE_ENV !== 'production'){process.exit(1)} \" || husky install",

View file

@ -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);

View file

@ -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);