fix(patch-pack): write bundled manifest and prefer newer bundled patches

Generate manifest.json for bundled patches during installer builds and ignore previously downloaded adaptation packs that are older than or equal to the bundled patch set.
This commit is contained in:
N0VAN0M4LY committed 2026-11-30 16:50:46 +08:00
1 parent 8c19811714
commit f39d7b05c1
4 files changed
+34 -24

No files matched your search

+10
View File
@@ -4,6 +4,7 @@ import { tmpdir } from 'node:os';
import { dirname, join, relative, resolve, sep } from 'node:path';
import { Arch, build, Platform } from 'electron-builder';
import { launcherReleaseFiles } from '../apps/launcher/src/shared/schemas/app-update.ts';
import { formatManifest, MANIFEST_FILE, PATCH_PACK_FORMAT, recordedGameVersions } from '../packages/patcher/src/index.ts';
const repository = resolve(import.meta.dirname, '..');
const launcher = join(repository, 'apps', 'launcher');
@@ -68,6 +69,15 @@ async function stageInstaller(stage: string, manifest: LauncherManifest): Promis
for (const folder of ['exe', 'gui', 'native', 'versions']) {
await cp(join(repository, 'patches', folder), join(resources, 'patches', folder), { recursive: true });
}
const now = new Date();
const bundledPackVersion = `${now.getUTCFullYear()}.${String(now.getUTCMonth() + 1).padStart(2, '0')}.${String(now.getUTCDate()).padStart(2, '0')}`;
await writeFile(join(resources, 'patches', MANIFEST_FILE), formatManifest({
format: PATCH_PACK_FORMAT,
version: bundledPackVersion,
minAppVersion: version,
gameVersions: recordedGameVersions(join(resources, 'patches')),
createdAt: now.toISOString(),
}), 'utf8');
const runtimeModules = join(stage, 'installer-modules');
for (const folder of workspacePackages) await stageWorkspacePackage(folder, resources, runtimeModules);
for (const name of ['fflate', 'zod']) {