Merge branch 'main' into data-driven

This commit is contained in:
tresabhi committed 2026-11-14 13:57:46 -06:00
commit da9c5272bc
7 files changed
+31 -30

No files matched your search

+2 -11
View File
@@ -107,19 +107,10 @@ jobs:
uses: actions/checkout@v6 uses: actions/checkout@v6
with: with:
ref: ${{ github.event.pull_request.head.sha || inputs.branch || 'production' }} ref: ${{ github.event.pull_request.head.sha || inputs.branch || 'production' }}
submodules: false # the only submodule is closed, which needs secrets
submodules: ${{ env.HAS_ROOT_REPO_CONTEXT == 'true' && 'recursive' || 'false' }}
token: ${{ secrets.GH_TOKEN || github.token }} token: ${{ secrets.GH_TOKEN || github.token }}
# Future proofing for Reforged: we'll have both closed and open repos, so
# we need to handle them here instead of disabling submodules outright
- name: Checkout submodules
run: |
if [ "$HAS_ROOT_REPO_CONTEXT" = "true" ]; then
git submodule update --init --recursive --depth=1
else
git submodule update --init --recursive --depth=1 -- . ':!packages/closed'
fi
- name: Setup bun - name: Setup bun
uses: oven-sh/setup-bun@v2 uses: oven-sh/setup-bun@v2
@@ -104,6 +104,7 @@ export abstract class ServerBlitzKitAPI0 extends AbstractBlitzKitAPI {
protected gameTypeSelectorStyles?: SquadBattleTypeStylesYaml; protected gameTypeSelectorStyles?: SquadBattleTypeStylesYaml;
protected combatRoles?: CombatRolesYaml; protected combatRoles?: CombatRolesYaml;
protected tierEqualizer?: string[][]; protected tierEqualizer?: string[][];
protected version?: string;
constructor(vfs: AbstractVFS) { constructor(vfs: AbstractVFS) {
super(); super();
@@ -115,15 +116,11 @@ export abstract class ServerBlitzKitAPI0 extends AbstractBlitzKitAPI {
const { existsSync } = await import("fs"); const { existsSync } = await import("fs");
const { readFile, writeFile, mkdir } = await import("fs/promises"); const { readFile, writeFile, mkdir } = await import("fs/promises");
console.log("Initializing virtual file system...");
const path = await import("node:path"); const path = await import("node:path");
this.extname = path.extname; this.extname = path.extname;
this.parsePath = path.parse; this.parsePath = path.parse;
await this.vfs.init();
console.log("Fetching game data..."); console.log("Fetching game data...");
this.nationsDir = await this.vfs this.nationsDir = await this.vfs
.dir("Data/XML/item_defs/vehicles") .dir("Data/XML/item_defs/vehicles")
@@ -161,11 +158,13 @@ export abstract class ServerBlitzKitAPI0 extends AbstractBlitzKitAPI {
{ delimiter: ";" }, { delimiter: ";" },
); );
this.version = (await this.vfs.text("Data/version.txt")).split(" ")[0];
console.log("Fetching game localizations..."); console.log("Fetching game localizations...");
await Promise.all( await Promise.all(
locales.supported.map(async ({ locale }) => { locales.supported.map(async ({ locale }) => {
const root = "../../temp/game-strings"; const root = `../../temp/game-strings/${this.version}`;
const cachePath = `${root}/${locale}.json`; const cachePath = `${root}/${locale}.json`;
if (existsSync(cachePath)) { if (existsSync(cachePath)) {
@@ -20,9 +20,7 @@ export abstract class ServerBlitzKitAPI9 extends ServerBlitzKitAPI8 {
provisionNativeNames[key] = provision.id; provisionNativeNames[key] = provision.id;
}); });
const version = (await this.vfs.text("Data/version.txt")).split(" ")[0]; gameDefinitions.version = this.version!;
gameDefinitions.version = version;
gameDefinitions.nations = ( gameDefinitions.nations = (
await this.vfs.yaml<AvailableNationsYaml>("Data/available_nations.yaml") await this.vfs.yaml<AvailableNationsYaml>("Data/available_nations.yaml")
).available_nations; ).available_nations;
+18
View File
@@ -0,0 +1,18 @@
import { assertSecret } from "@blitzkit/core";
import { AbstractVFS } from "./abstract";
import { LocalVFS } from "./local";
import { ZipVFS } from "./zip";
export async function createClientVFS() {
let vfs: AbstractVFS;
if (import.meta.env.CLIENT_PROVIDER === "zip") {
vfs = new ZipVFS(assertSecret(import.meta.env.CLIENT_SOURCE));
} else {
vfs = new LocalVFS(assertSecret(import.meta.env.CLIENT_DIR));
}
await vfs.init();
return vfs;
}
+2 -3
View File
@@ -3,7 +3,6 @@ import { mkdir, rm } from "node:fs/promises";
import { downloadSteamClient } from "./steam"; import { downloadSteamClient } from "./steam";
import { downloadWGCClient } from "./wgc"; import { downloadWGCClient } from "./wgc";
import { downloadWGPKGClient } from "./wgpkg"; import { downloadWGPKGClient } from "./wgpkg";
import { downloadZipClient } from "./zip";
export const DEPOT_DOWNLOADER_RETRY_TIME = 30_000; export const DEPOT_DOWNLOADER_RETRY_TIME = 30_000;
@@ -20,9 +19,9 @@ switch (provider) {
await downloadSteamClient(); await downloadSteamClient();
break; break;
// from zip, usually has a root directory for opentest // from zip, read remotely by ZipVFS at build time; nothing to download
case "zip": case "zip":
await downloadZipClient(); console.log("Zip client provider; skipping download in favor of ZipVFS");
break; break;
// effectively the same as wgc, but direct for preview // effectively the same as wgc, but direct for preview
+2 -5
View File
@@ -1,6 +1,3 @@
import { assertSecret } from "@blitzkit/core"; import { createClientVFS } from "@blitzkit/core/src/blitzkit/vfs/client";
import { LocalVFS } from "@blitzkit/core/src/blitzkit/vfs/local";
export const vfs = await new LocalVFS( export const vfs = await createClientVFS();
assertSecret(import.meta.env.CLIENT_DIR),
).init();
+2 -3
View File
@@ -1,4 +1,3 @@
import { assertSecret } from "@blitzkit/core"; import { createClientVFS } from "@blitzkit/core/src/blitzkit/vfs/client";
import { LocalVFS } from "@blitzkit/core/src/blitzkit/vfs/local";
export const vfs = new LocalVFS(assertSecret(import.meta.env.CLIENT_DIR)); export const vfs = await createClientVFS();