feat(repo): package portable zip in local Windows builds

Clean and generate wtoffline-launcher-<version>-win-x64-portable.zip from win-unpacked directly inside scripts/build-windows-installer.ts so local package:win builds produce both the NSIS installer and the portable archive.

Checked: root and launcher typechecks pass.
This commit is contained in:
N0VAN0M4LY committed 2026-12-02 09:20:32 +08:00
1 parent c55ec4ed57
commit ae1e5ec65b
1 file changed
+9 -1
+9 -1
View File
@@ -97,8 +97,9 @@ async function cleanInstallerOutput(version: string): Promise<void> {
if (relative(output, root) !== '') throw new Error('The installer output directory is redirected.');
const { installer, manifest, signature } = launcherReleaseFiles(version);
const portable = `wtoffline-launcher-${version}-win-x64-portable.zip`;
const legacy = `WTOffline Launcher Setup ${version}.exe`;
const names = [installer, installer + '.blockmap', legacy, legacy + '.blockmap', manifest, signature, 'win-unpacked'];
const names = [installer, installer + '.blockmap', portable, legacy, legacy + '.blockmap', manifest, signature, 'win-unpacked'];
const artifacts = [];
for (const name of names) {
const path = join(root, name);
@@ -160,6 +161,13 @@ async function main(): Promise<void> {
},
});
for (const artifact of artifacts) console.info(artifact);
const portable = join(output, `wtoffline-launcher-${manifest.version}-win-x64-portable.zip`);
const unpackedGlob = join(output, 'win-unpacked', '*');
execFileSync('powershell.exe', [
'-NoProfile', '-NonInteractive', '-Command',
`Compress-Archive -Path "${unpackedGlob}" -DestinationPath "${portable}" -Force`,
], { cwd: repository, stdio: 'inherit', windowsHide: true });
console.info(portable);
} finally {
const actual = await realpath(stage);
if (actual === stage && dirname(actual) === temp) await rm(stage, { recursive: true, force: true });