fix: script imports

This commit is contained in:
TrèsAbhi committed 2025-10-13 22:26:11 -05:00
1 parent 2c55455cd7
commit 49b5d4f7dc
6 files changed
+301 -284

No files matched your search

+27 -23
View File
@@ -1,7 +1,32 @@
{
"name": "@blitzkit/scripts",
"dependencies": {
"@blitzkit/closed": "workspace:*",
"@blitzkit/core": "workspace:*",
"@blitzkit/i18n": "workspace:*",
"@gltf-transform/core": "^4.2.1",
"@gltf-transform/extensions": "^4.2.1",
"@gltf-transform/functions": "^4.2.1",
"@types/bun": "^1.3.0",
"@types/decompress": "^4.2.7",
"@types/lodash-es": "^4.17.12",
"@types/lz4js": "^0.2.1",
"@types/progress": "^2.0.7",
"@types/three": "^0.180.0",
"crc": "^4.3.2",
"csv-parse": "^6.1.0",
"decompress": "^4.2.1",
"dotenv": "^17.2.3",
"esbuild": "^0.25.10",
"fast-xml-parser": "^5.2.5",
"lodash-es": "^4.17.21",
"lz4js": "^0.2.0",
"progress": "^2.0.3",
"puppeteer": "^24.22.3",
"three": "^0.180.0",
"ts-proto": "^2.7.7"
},
"private": true,
"type": "module",
"scripts": {
"build:assets": "bun src/buildAssets/index.ts",
"build:averages": "bun src/averages.ts",
@@ -15,26 +40,5 @@
"prunestrings": "bun src/pruneStrings.ts",
"build:protos": "bun src/protos.ts"
},
"dependencies": {
"@blitzkit/closed": "workspace:*",
"@blitzkit/core": "workspace:*",
"@blitzkit/i18n": "workspace:*",
"@gltf-transform/core": "^4.2.1",
"@gltf-transform/extensions": "^4.2.1",
"@gltf-transform/functions": "^4.2.1",
"@types/lz4js": "^0.2.1",
"crc": "^4.3.2",
"csv-parse": "^6.1.0",
"decompress": "^4.2.1",
"esbuild": "^0.25.10",
"fast-xml-parser": "^5.2.5",
"lz4js": "^0.2.0",
"progress": "^2.0.3",
"puppeteer": "^24.22.3",
"ts-proto": "^2.7.7"
},
"devDependencies": {
"@types/decompress": "^4.2.7",
"@types/progress": "^2.0.7"
}
"type": "module"
}
+23 -24
View File
@@ -1,33 +1,32 @@
import { config } from 'dotenv';
import { argv } from 'process';
import { config } from "dotenv";
import { argv } from "process";
config();
const allTargets = argv.includes('--all-targets');
const allTargets = argv.includes("--all-targets");
const targets = argv
.find((argument) => argument.startsWith('--target'))
?.split('=')[1]
.split(',');
.find((argument) => argument.startsWith("--target"))
?.split("=")[1]
.split(",");
import { blitzkitTankIcons } from './blitzkitTankIcons';
import { boosterIcons } from './boosterIcons';
import { camouflageIcons } from './camouflageIcons';
import { consumableProvisionIcons } from './consumableProvisionIcons';
import { currencies } from './currencies';
import { definitions } from './definitions';
import { equipmentIcons } from './equipmentIcons';
import { flags } from './flags';
import { gameModeBanners } from './gameModeBanners';
import { glossary } from './glossary';
import { migration } from './migration';
import { moduleIcons } from './moduleIcons';
import { shellIcons } from './shellIcons';
import { skillIcons } from './skillIcons';
import { tankArmors } from './tankArmors';
import { tankIcons } from './tankIcons';
import { tankModels } from './tankModels';
import { boosterIcons } from "./boosterIcons";
import { camouflageIcons } from "./camouflageIcons";
import { consumableProvisionIcons } from "./consumableProvisionIcons";
import { currencies } from "./currencies";
import { definitions } from "./definitions";
import { equipmentIcons } from "./equipmentIcons";
import { flags } from "./flags";
import { gameModeBanners } from "./gameModeBanners";
import { glossary } from "./glossary";
import { migration } from "./migration";
import { moduleIcons } from "./moduleIcons";
import { shellIcons } from "./shellIcons";
import { skillIcons } from "./skillIcons";
import { tankArmors } from "./tankArmors";
import { tankIcons } from "./tankIcons";
import { tankModels } from "./tankModels";
if (!targets && !allTargets) throw new Error('No target(s) specified');
if (!targets && !allTargets) throw new Error("No target(s) specified");
const methods = [
migration,
+21 -21
View File
@@ -10,18 +10,18 @@ import {
Region,
REGIONS,
regionToRegionSubdomain,
} from '@blitzkit/core';
import { chunk } from 'lodash';
import { argv } from 'process';
import { commitAssets } from './core/github/commitAssets';
import { FileChange } from './core/github/commitMultipleFiles';
} from "@blitzkit/core";
import { chunk } from "lodash-es";
import { argv } from "process";
import { commitAssets } from "./core/github/commitAssets";
import { FileChange } from "./core/github/commitMultipleFiles";
const region = argv
.find((arg) => arg.startsWith('--region='))
?.split('=')[1] as Region | undefined;
.find((arg) => arg.startsWith("--region="))
?.split("=")[1] as Region | undefined;
if (region === undefined || !REGIONS.includes(region)) {
throw new Error('No valid region specified');
throw new Error("No valid region specified");
}
console.log(`Building rating leaderboard for ${region}`);
@@ -29,11 +29,11 @@ console.log(`Building rating leaderboard for ${region}`);
const regionSubdomain = regionToRegionSubdomain(region);
const NEIGHBORS = 2 ** 8;
const PLAYERS = await patientFetchJSON<RatingInfo>(
`https://${regionSubdomain}.wotblitz.com/en/api/rating-leaderboards/season/`,
`https://${regionSubdomain}.wotblitz.com/en/api/rating-leaderboards/season/`
).then((data) => (data.detail === undefined ? data.count : undefined));
if (PLAYERS === undefined) {
throw new Error('No current rating season running');
throw new Error("No current rating season running");
}
const players: Record<number, RatingPlayer> = {};
@@ -43,7 +43,7 @@ let registered = 0;
async function branchFromPlayer(id: number) {
const { neighbors } = await patientFetchJSON<RatingNeighbors>(
`https://${regionSubdomain}.wotblitz.com/en/api/rating-leaderboards/user/${id}/?neighbors=${NEIGHBORS}`,
`https://${regionSubdomain}.wotblitz.com/en/api/rating-leaderboards/user/${id}/?neighbors=${NEIGHBORS}`
);
const firstPlayer = neighbors[0];
@@ -66,7 +66,7 @@ async function branchFromPlayer(id: number) {
`Registered ${registered} / ${PLAYERS} (${(
(registered / PLAYERS!) *
100
).toFixed(2)}%)`,
).toFixed(2)}%)`
);
await Promise.all(branches);
@@ -74,7 +74,7 @@ async function branchFromPlayer(id: number) {
async function branchFromLeague(id: number) {
const { result } = await patientFetchJSON<{ result: RatingPlayer[] }>(
`https://${regionSubdomain}.wotblitz.com/en/api/rating-leaderboards/league/${id}/top/`,
`https://${regionSubdomain}.wotblitz.com/en/api/rating-leaderboards/league/${id}/top/`
);
const firstPlayer = result[0];
@@ -86,7 +86,7 @@ async function branchFromLeague(id: number) {
]);
}
console.log('Branching from leagues...');
console.log("Branching from leagues...");
await Promise.all([
branchFromLeague(0),
branchFromLeague(1),
@@ -95,7 +95,7 @@ await Promise.all([
branchFromLeague(4),
]);
console.log('Converting to an array...');
console.log("Converting to an array...");
for (let index = 0; index < PLAYERS; index++) {
const listing = players[index + 1];
if (listing) {
@@ -106,18 +106,18 @@ for (let index = 0; index < PLAYERS; index++) {
}
}
console.log('Requesting further stats...');
console.log("Requesting further stats...");
const entries: RatingLeaderboardEntryV2[] = [];
let chunkIndex = 0;
for (const leaderboardChunk of chunk(entriesV1, 100)) {
console.log(
`Chunk ${chunkIndex + 1} of ${Math.ceil(entriesV1.length / 100)}`,
`Chunk ${chunkIndex + 1} of ${Math.ceil(entriesV1.length / 100)}`
);
const stats = await getAccountInfo(
region,
leaderboardChunk.map(({ id }) => id),
['statistics.rating'],
["statistics.rating"]
);
stats.forEach((stat, index) => {
@@ -153,12 +153,12 @@ for (const leaderboardChunk of chunk(entriesV1, 100)) {
}
const info = await patientFetchJSON<RatingInfo & { detail: undefined }>(
`https://${regionSubdomain}.wotblitz.com/en/api/rating-leaderboards/season/`,
`https://${regionSubdomain}.wotblitz.com/en/api/rating-leaderboards/season/`
);
const normalizedServer = regionSubdomain === 'na' ? 'com' : regionSubdomain;
const normalizedServer = regionSubdomain === "na" ? "com" : regionSubdomain;
const content = RatingLeaderboard.encode({
version: { $case: 'v2', value: { entries } },
version: { $case: "v2", value: { entries } },
}).finish();
const changes: FileChange[] = [