Compare commits

...

2 Commits

7 changed files with 163 additions and 3 deletions
+34
View File
@@ -0,0 +1,34 @@
# Review — `fix/installer-name`
**What:** the Windows installer is published as `RoseaDomi_<version>_x64-setup.exe`, not
`Rosea Domi_<version>_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).
+1 -1
View File
@@ -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.", "description": "The Tauri 2 shell: the Android, iOS and desktop apps around apps/rosea's built game (dist-tauri/). Imports no package.",
"scripts": { "scripts": {
"dev": "tsx scripts/icons.ts && tsx scripts/domi-app.ts && tauri dev", "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": "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", "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", "sign:apk": "tsx scripts/sign-apk.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}`);
}
+25
View File
@@ -0,0 +1,25 @@
/**
* The Windows installer's published file name. Tauri's NSIS bundler names it after `productName`
* (`Rosea Domi_<version>_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
* `<Name>_<version>_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;
}
+1 -1
View File
@@ -51,7 +51,7 @@ describe('domi-app.toml', () => {
it('is made before every desktop build and never committed', () => { it('is made before every desktop build and never committed', () => {
const pkg = JSON.parse(readFileSync(join(HERE, '..', 'package.json'), 'utf8')) as { scripts: Record<string, string> }; const pkg = JSON.parse(readFileSync(join(HERE, '..', 'package.json'), 'utf8')) as { scripts: Record<string, string> };
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'); expect(pkg.scripts['dev']).toContain('tsx scripts/domi-app.ts');
const ignore = readFileSync(join(HERE, '..', '..', '..', '.gitignore'), 'utf8'); const ignore = readFileSync(join(HERE, '..', '..', '..', '.gitignore'), 'utf8');
expect(ignore).toContain('apps/rosea-tauri/src-tauri/atrium/'); expect(ignore).toContain('apps/rosea-tauri/src-tauri/atrium/');
@@ -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<string, string> };
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']);
});
});