mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-14 21:26:08 +01:00
Merge branch 'main' into data-driven
This commit is contained in:
7 files changed
+31
-30
No files matched your search
@@ -107,19 +107,10 @@ jobs:
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
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 }}
|
||||
|
||||
# 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
|
||||
uses: oven-sh/setup-bun@v2
|
||||
|
||||
|
||||
@@ -104,6 +104,7 @@ export abstract class ServerBlitzKitAPI0 extends AbstractBlitzKitAPI {
|
||||
protected gameTypeSelectorStyles?: SquadBattleTypeStylesYaml;
|
||||
protected combatRoles?: CombatRolesYaml;
|
||||
protected tierEqualizer?: string[][];
|
||||
protected version?: string;
|
||||
|
||||
constructor(vfs: AbstractVFS) {
|
||||
super();
|
||||
@@ -115,15 +116,11 @@ export abstract class ServerBlitzKitAPI0 extends AbstractBlitzKitAPI {
|
||||
const { existsSync } = await import("fs");
|
||||
const { readFile, writeFile, mkdir } = await import("fs/promises");
|
||||
|
||||
console.log("Initializing virtual file system...");
|
||||
|
||||
const path = await import("node:path");
|
||||
|
||||
this.extname = path.extname;
|
||||
this.parsePath = path.parse;
|
||||
|
||||
await this.vfs.init();
|
||||
|
||||
console.log("Fetching game data...");
|
||||
this.nationsDir = await this.vfs
|
||||
.dir("Data/XML/item_defs/vehicles")
|
||||
@@ -161,11 +158,13 @@ export abstract class ServerBlitzKitAPI0 extends AbstractBlitzKitAPI {
|
||||
{ delimiter: ";" },
|
||||
);
|
||||
|
||||
this.version = (await this.vfs.text("Data/version.txt")).split(" ")[0];
|
||||
|
||||
console.log("Fetching game localizations...");
|
||||
|
||||
await Promise.all(
|
||||
locales.supported.map(async ({ locale }) => {
|
||||
const root = "../../temp/game-strings";
|
||||
const root = `../../temp/game-strings/${this.version}`;
|
||||
const cachePath = `${root}/${locale}.json`;
|
||||
|
||||
if (existsSync(cachePath)) {
|
||||
|
||||
@@ -20,9 +20,7 @@ export abstract class ServerBlitzKitAPI9 extends ServerBlitzKitAPI8 {
|
||||
provisionNativeNames[key] = provision.id;
|
||||
});
|
||||
|
||||
const version = (await this.vfs.text("Data/version.txt")).split(" ")[0];
|
||||
|
||||
gameDefinitions.version = version;
|
||||
gameDefinitions.version = this.version!;
|
||||
gameDefinitions.nations = (
|
||||
await this.vfs.yaml<AvailableNationsYaml>("Data/available_nations.yaml")
|
||||
).available_nations;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -3,7 +3,6 @@ import { mkdir, rm } from "node:fs/promises";
|
||||
import { downloadSteamClient } from "./steam";
|
||||
import { downloadWGCClient } from "./wgc";
|
||||
import { downloadWGPKGClient } from "./wgpkg";
|
||||
import { downloadZipClient } from "./zip";
|
||||
|
||||
export const DEPOT_DOWNLOADER_RETRY_TIME = 30_000;
|
||||
|
||||
@@ -20,9 +19,9 @@ switch (provider) {
|
||||
await downloadSteamClient();
|
||||
break;
|
||||
|
||||
// from zip, usually has a root directory for opentest
|
||||
// from zip, read remotely by ZipVFS at build time; nothing to download
|
||||
case "zip":
|
||||
await downloadZipClient();
|
||||
console.log("Zip client provider; skipping download in favor of ZipVFS");
|
||||
break;
|
||||
|
||||
// effectively the same as wgc, but direct for preview
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
import { assertSecret } from "@blitzkit/core";
|
||||
import { LocalVFS } from "@blitzkit/core/src/blitzkit/vfs/local";
|
||||
import { createClientVFS } from "@blitzkit/core/src/blitzkit/vfs/client";
|
||||
|
||||
export const vfs = await new LocalVFS(
|
||||
assertSecret(import.meta.env.CLIENT_DIR),
|
||||
).init();
|
||||
export const vfs = await createClientVFS();
|
||||
@@ -1,4 +1,3 @@
|
||||
import { assertSecret } from "@blitzkit/core";
|
||||
import { LocalVFS } from "@blitzkit/core/src/blitzkit/vfs/local";
|
||||
import { createClientVFS } from "@blitzkit/core/src/blitzkit/vfs/client";
|
||||
|
||||
export const vfs = new LocalVFS(assertSecret(import.meta.env.CLIENT_DIR));
|
||||
export const vfs = await createClientVFS();
|
||||
Reference in new issue
Block a user