From 578aa44f239ef0bc38fab78a09bb8351d6da76f4 Mon Sep 17 00:00:00 2001 From: mnovak Date: Wed, 2 Dec 2026 15:32:43 +0100 Subject: [PATCH] [tauri] InstallerName: Publish the Windows installer as RoseaDomi__x64-setup.exe, a name Aula and Atrium accept; productName stays Rosea Domi --- .agents/reviews/fix-installer-name.md | 34 +++++++++++ AULA.md | 2 +- apps/rosea-tauri/package.json | 2 +- apps/rosea-tauri/scripts/installer-name.ts | 38 ++++++++++++ apps/rosea-tauri/src/installer-name.ts | 25 ++++++++ apps/rosea-tauri/test/domi-app.test.ts | 2 +- apps/rosea-tauri/test/installer-name.test.ts | 63 ++++++++++++++++++++ 7 files changed, 163 insertions(+), 3 deletions(-) create mode 100644 .agents/reviews/fix-installer-name.md create mode 100644 apps/rosea-tauri/scripts/installer-name.ts create mode 100644 apps/rosea-tauri/src/installer-name.ts create mode 100644 apps/rosea-tauri/test/installer-name.test.ts diff --git a/.agents/reviews/fix-installer-name.md b/.agents/reviews/fix-installer-name.md new file mode 100644 index 0000000..964d366 --- /dev/null +++ b/.agents/reviews/fix-installer-name.md @@ -0,0 +1,34 @@ +# Review — `fix/installer-name` + +**What:** the Windows installer is published as `RoseaDomi__x64-setup.exe`, not +`Rosea Domi__x64-setup.exe`. Aula makes an installer public only when its name matches +`[A-Za-z0-9._-]+-setup.exe` (Aula docs/14_feed.md), which is also the form Atrium Domi expects. So v0.1.1's +installer never appeared on Aula, while its APK did (reported by Aula, 2026-12-02). + +**How:** `tauri build` still names the file after `productName`. Then `scripts/installer-name.ts` renames it, +in the same `build:desktop` command, before the release's `desktop` step collects `*-setup.exe`. The names and the +pattern live in `src/installer-name.ts`, where the test can reach them without a build. + +## Findings + +1. **Why not change `productName`?** It is also the window title, the install folder and the uninstall + entry Atrium finds her by. A new `productName` would make the next installer a second app beside the + first, and a player who updates would have two roses. Only the file is renamed. *Not done:* the + installer's own wizard text still says "Rosea Domi", which is right. +2. **An older installer left in the folder.** The release step publishes every `*-setup.exe` in + `bundle/nsis/`. The rename deletes any other installer there (build output only) and fails unless exactly + one remains with an accepted name. Tested with an old Tauri-named file and an old renamed one beside the + new one. +3. **The signing steps** (`sign`, `minisign`, `publish`) match `**/*-setup.exe`, so they find the renamed + file. *Not verified until the v0.1.2 hub run.* +4. **Test honesty:** with the space put back (`${PRODUCT_NAME}` unchanged), 4 of the 7 new tests fail + (drill run on D:, then reverted). The `build:desktop` order is pinned by a test, and `domi-app.test.ts` was + loosened only to allow what follows `tauri build`. +5. **AULA.md** names the new file, so a player following the page finds it. +6. **Soul, privacy, reachability, offline:** nothing a player sees inside the game changed. + +**Not verified:** a real `tauri build` here (it is the hub's step), and Aula showing the installer once v0.1.2 +is published. + +**Gate (D:, 2026-12-02):** lint 0, typecheck 0, lint:copy 0 problems; `pnpm test` 653 passed (schema 19, identity 5, +release 8, cpu-guard 13, storage 70, content 88, art-prep 80, tauri 99, ui 92, engine 179). diff --git a/AULA.md b/AULA.md index 78e1995..8dae6b5 100644 --- a/AULA.md +++ b/AULA.md @@ -30,7 +30,7 @@ does not even ask for the permission to use the internet. ## Installing -- **Windows:** run `Rosea Domi__x64-setup.exe`. It installs for you alone, with no +- **Windows:** run `RoseaDomi__x64-setup.exe`. It installs for you alone, with no administrator rights. - **Android:** install the `.apk` (Android 7 or newer). Your phone will ask you to allow installing apps from where you downloaded it. diff --git a/apps/rosea-tauri/package.json b/apps/rosea-tauri/package.json index acdd883..5e3ab5d 100644 --- a/apps/rosea-tauri/package.json +++ b/apps/rosea-tauri/package.json @@ -7,7 +7,7 @@ "description": "The Tauri 2 shell: the Android, iOS and desktop apps around apps/rosea's built game (dist-tauri/). Imports no package.", "scripts": { "dev": "tsx scripts/icons.ts && tsx scripts/domi-app.ts && tauri dev", - "build:desktop": "tsx scripts/icons.ts && tsx scripts/domi-app.ts && tauri build", + "build:desktop": "tsx scripts/icons.ts && tsx scripts/domi-app.ts && tauri build && tsx scripts/installer-name.ts", "build:android": "tsx scripts/android.ts prepare && tauri android build --debug --apk --target aarch64 && tsx scripts/android.ts verify", "build:android-release": "tsx scripts/android.ts prepare && tauri android build --apk --target aarch64 && tsx scripts/android.ts verify src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release-unsigned.apk", "sign:apk": "tsx scripts/sign-apk.ts", diff --git a/apps/rosea-tauri/scripts/installer-name.ts b/apps/rosea-tauri/scripts/installer-name.ts new file mode 100644 index 0000000..8f29c4b --- /dev/null +++ b/apps/rosea-tauri/scripts/installer-name.ts @@ -0,0 +1,38 @@ +/** + * After `tauri build`: renames the NSIS installer to its published name (src/installer-name.ts), so + * the release step's `*-setup.exe` finds one file, and its name has no space. + * + * tsx scripts/installer-name.ts in src-tauri/target/release/bundle/nsis/ + */ +import { existsSync, readdirSync, renameSync, rmSync } from 'node:fs'; +import { join, resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { INSTALLER_PATTERN, installerName, tauriInstallerName } from '../src/installer-name.js'; +import { gameVersion } from './domi-app.js'; +import { SRC_TAURI } from './tauri.js'; + +/** + * Renames the version's installer in `dir` and removes any other installer there (an older build's, + * which the release's `*-setup.exe` would otherwise publish too). Returns the new path. Fails if the + * built file is missing, or if anything but the one accepted installer is left. + */ +export function renameInstaller(dir: string, version: string): string { + const from = join(dir, tauriInstallerName(version)); + const name = installerName(version); + const to = join(dir, name); + if (!existsSync(from)) throw new Error(`no installer to rename: ${from}`); + for (const f of readdirSync(dir)) { + if (f.endsWith('-setup.exe') && f !== tauriInstallerName(version)) rmSync(join(dir, f)); + } + renameSync(from, to); + const left = readdirSync(dir).filter((f) => f.endsWith('-setup.exe')); + if (left.length !== 1 || left[0] !== name || !INSTALLER_PATTERN.test(name)) { + throw new Error(`expected only ${name}, found: ${left.join(', ')}`); + } + return to; +} + +if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) { + const to = renameInstaller(join(SRC_TAURI, 'target', 'release', 'bundle', 'nsis'), gameVersion()); + console.log(`installer: ${to}`); +} diff --git a/apps/rosea-tauri/src/installer-name.ts b/apps/rosea-tauri/src/installer-name.ts new file mode 100644 index 0000000..81be022 --- /dev/null +++ b/apps/rosea-tauri/src/installer-name.ts @@ -0,0 +1,25 @@ +/** + * The Windows installer's published file name. Tauri's NSIS bundler names it after `productName` + * (`Rosea Domi__x64-setup.exe`), and the space keeps it off Aula: Aula makes an installer + * public only when its name matches `[A-Za-z0-9._-]+-setup.exe` (Aula docs/14_feed.md), the + * `__x64-setup.exe` form Atrium Domi expects as well. + * + * Only the file is renamed after the build. `productName` stays "Rosea Domi": it is also the window + * title, the install folder and the uninstall entry Atrium finds her by, and changing it would make + * the next installer a second app beside the first. + */ +import { PRODUCT_NAME } from '../../../packages/schema/src/constants.js'; + +/** What Aula and Atrium accept as an installer's name. */ +export const INSTALLER_PATTERN = /^[A-Za-z0-9._-]+-setup\.exe$/; + +/** Tauri's own name for the installer of a version. */ +export const tauriInstallerName = (version: string): string => `${PRODUCT_NAME}_${version}_x64-setup.exe`; + +/** The published name: the product name without spaces, e.g. `RoseaDomi_0.1.2_x64-setup.exe`. */ +export function installerName(version: string): string { + if (!/^\d+\.\d+\.\d+$/.test(version)) throw new Error(`not a version: ${version}`); + const name = `${PRODUCT_NAME.replace(/\s+/g, '')}_${version}_x64-setup.exe`; + if (!INSTALLER_PATTERN.test(name)) throw new Error(`the installer's name would not be accepted: ${name}`); + return name; +} diff --git a/apps/rosea-tauri/test/domi-app.test.ts b/apps/rosea-tauri/test/domi-app.test.ts index ae23b73..44d59e7 100644 --- a/apps/rosea-tauri/test/domi-app.test.ts +++ b/apps/rosea-tauri/test/domi-app.test.ts @@ -51,7 +51,7 @@ describe('domi-app.toml', () => { it('is made before every desktop build and never committed', () => { const pkg = JSON.parse(readFileSync(join(HERE, '..', 'package.json'), 'utf8')) as { scripts: Record }; - expect(pkg.scripts['build:desktop']).toMatch(/tsx scripts\/domi-app\.ts && tauri build$/); + expect(pkg.scripts['build:desktop']).toMatch(/tsx scripts\/domi-app\.ts && tauri build( |$)/); expect(pkg.scripts['dev']).toContain('tsx scripts/domi-app.ts'); const ignore = readFileSync(join(HERE, '..', '..', '..', '.gitignore'), 'utf8'); expect(ignore).toContain('apps/rosea-tauri/src-tauri/atrium/'); diff --git a/apps/rosea-tauri/test/installer-name.test.ts b/apps/rosea-tauri/test/installer-name.test.ts new file mode 100644 index 0000000..e62bc48 --- /dev/null +++ b/apps/rosea-tauri/test/installer-name.test.ts @@ -0,0 +1,63 @@ +import { mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'; +import { tmpdir } from 'node:os'; +import { dirname, join } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { afterEach, describe, expect, it } from 'vitest'; +import { renameInstaller } from '../scripts/installer-name.js'; +import { INSTALLER_PATTERN, installerName, tauriInstallerName } from '../src/installer-name.js'; + +describe('installerName', () => { + it('has no space, and matches what Aula and Atrium accept', () => { + expect(installerName('0.1.2')).toBe('RoseaDomi_0.1.2_x64-setup.exe'); + expect(installerName('0.1.2')).toMatch(INSTALLER_PATTERN); + expect(installerName('12.0.31')).toMatch(INSTALLER_PATTERN); + }); + + it("knows Tauri's own name has a space, which Aula refuses", () => { + expect(tauriInstallerName('0.1.2')).toBe('Rosea Domi_0.1.2_x64-setup.exe'); + expect(tauriInstallerName('0.1.2')).not.toMatch(INSTALLER_PATTERN); + }); + + it('refuses something that is not a version', () => { + expect(() => installerName('0.1')).toThrow(/not a version/); + expect(() => installerName('0.1.2 x')).toThrow(/not a version/); + }); +}); + +describe('the desktop build', () => { + it('renames the installer right after tauri build, so the release never sees the name with a space', () => { + const pkg = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), '..', 'package.json'), 'utf8')) as { scripts: Record }; + expect(pkg.scripts['build:desktop']).toMatch(/&& tauri build && tsx scripts\/installer-name\.ts$/); + }); +}); + +describe('renameInstaller', () => { + let dir = ''; + afterEach(() => { + if (dir) rmSync(dir, { recursive: true, force: true }); + dir = ''; + }); + + it("renames the built installer, and leaves only names Aula accepts", () => { + dir = mkdtempSync(join(tmpdir(), 'rosea-nsis-')); + writeFileSync(join(dir, 'Rosea Domi_0.1.2_x64-setup.exe'), 'exe'); + const to = renameInstaller(dir, '0.1.2'); + expect(to).toBe(join(dir, 'RoseaDomi_0.1.2_x64-setup.exe')); + expect(readdirSync(dir)).toEqual(['RoseaDomi_0.1.2_x64-setup.exe']); + }); + + it('fails when the build left no installer', () => { + dir = mkdtempSync(join(tmpdir(), 'rosea-nsis-')); + expect(() => renameInstaller(dir, '0.1.2')).toThrow(/no installer to rename/); + }); + + it("removes an older build's installers, so the release publishes only this one", () => { + dir = mkdtempSync(join(tmpdir(), 'rosea-nsis-')); + writeFileSync(join(dir, 'Rosea Domi_0.1.2_x64-setup.exe'), 'exe'); + writeFileSync(join(dir, 'Rosea Domi_0.1.1_x64-setup.exe'), 'old'); + writeFileSync(join(dir, 'RoseaDomi_0.1.1_x64-setup.exe'), 'old'); + writeFileSync(join(dir, 'notes.txt'), 'kept'); + renameInstaller(dir, '0.1.2'); + expect(readdirSync(dir).sort()).toEqual(['RoseaDomi_0.1.2_x64-setup.exe', 'notes.txt']); + }); +});