chore: api mock configuration files

This commit is contained in:
2024-09-30 14:23:20 +02:00
parent 5105229eef
commit 4ac92198b7
8 changed files with 41 additions and 28870 deletions
+4 -1
View File
@@ -36,4 +36,7 @@ node_modules
.env.* .env.*
.fake .fake
.ionide .ionide
# api-mock
/api-mock/endpoints/
File diff suppressed because it is too large Load Diff
-80
View File
@@ -1,80 +0,0 @@
[
"SzybkiWiewiór",
"matseb",
"peterminecraft333",
"MIlanSVK_SimRailCZ",
"kierownik_z_ulicy",
"luk31as",
"pppatryk123",
"MilyPan",
"paweld",
"Isitkiwi",
"Krisoy007",
"zeswaq",
"robcioRK",
"Ugulele",
"Spanky",
"KapitanKoza",
"Kuba6396",
"Littlebeaver",
"BravuraLion",
"trichlor",
"jasieleczeq",
"trannelgamer",
"Waffel",
"krytaqu",
"NadrazakHonza",
"zordem",
"Ludolog",
"Benni_007",
"Newkamilk4show",
"kowbojYT",
"lxd2476",
"_mmatek",
"Siwakowski26",
"Grzekor",
"Kryszakos",
"aleer7",
"niescioreq",
"Dobromir",
"XOndrasX",
"Grzechu_KKA",
"rolekor",
"Sami",
"Jakub0408",
"Kacper_Ok",
"HONZIKKOScz",
"ISDR_Patryk",
"Data",
"Saix95",
"Sunsie",
"Martin32",
"RolledBread",
"Asscred",
"Skajen",
"UwagaAutobus",
"MrTalon63",
"kubaliny",
"Kolar1234",
"ZimnySobi",
"YamishoFen",
"Ondrappp",
"Matejko820",
"HerrAndrzej",
"Metalov",
"kajetan2003",
"fankolei12237",
"P3trN",
"Tygrys_500",
"TrBLeMaker",
"seweryn",
"tommy001",
"piotr2143",
"shafter",
"Avoro",
"Michal14",
"Skalar",
"Gabriel96",
"MikiKox",
"Skipper"
]
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+33
View File
@@ -0,0 +1,33 @@
import { existsSync } from 'fs';
import { mkdir, writeFile } from 'fs/promises';
async function fetchJSONEndpointData(url, fileName) {
try {
const res = await fetch(url);
const data = await res.json();
await writeFile(`./endpoints/${fileName}`, JSON.stringify(data));
return true;
} catch (error) {
console.error(error);
}
return false;
}
async function main() {
if (!existsSync('endpoints')) await mkdir('endpoints');
Promise.all(
['getActiveData', 'getDonators', 'getSceneries', 'getVehicles'].map((endpointName) =>
fetchJSONEndpointData(
`https://stacjownik.spythere.eu/api/${endpointName}`,
`${endpointName}.json`
)
)
).then(() => {
console.log('Endpoints downloaded!');
});
}
main();
+2 -1
View File
@@ -6,7 +6,8 @@
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js" "start": "node index.js",
"fetch": "node fetchEndpoints.js"
}, },
"author": "", "author": "",
"license": "ISC", "license": "ISC",
+2 -1
View File
@@ -4,8 +4,9 @@
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite --mode staging",
"dev:mock": "vite --mode development & yarn --cwd ./api-mock start", "dev:mock": "vite --mode development & yarn --cwd ./api-mock start",
"dev:fetch": "yarn --cwd ./api-mock fetch",
"build": "vue-tsc --noEmit && vite build", "build": "vue-tsc --noEmit && vite build",
"deploy:prod": "yarn build && firebase deploy --only hosting", "deploy:prod": "yarn build && firebase deploy --only hosting",
"deploy:dev": "yarn build && firebase hosting:channel:deploy dev --expires 7d", "deploy:dev": "yarn build && firebase hosting:channel:deploy dev --expires 7d",