[repo] FabricaRelease: Rosea as a Fabrica app: the release and e2e pipelines, the Aula page's words and pictures, the version check, the APK signed in Custos, domi-rosea:// from the installer, the phone target

This commit is contained in:
2026-11-19 01:38:53 +01:00
parent 185625e7fe
commit 0d37f91763
34 changed files with 1148 additions and 6 deletions
+16
View File
@@ -0,0 +1,16 @@
{
"name": "@rosea/release",
"version": "0.1.0",
"private": true,
"type": "module",
"description": "Tests of what a release through Fabrica reads from this repository (.agents/features/fabrica-release.md): the version files, the page's words under lint:copy, the pipeline files. Never imported by the app.",
"scripts": {
"typecheck": "tsc -p tsconfig.json",
"test": "vitest run --reporter=verbose"
},
"devDependencies": {
"@types/node": "22.20.1",
"typescript": "5.9.3",
"vitest": "3.2.7"
}
}
+34
View File
@@ -0,0 +1,34 @@
import { spawnSync } from 'node:child_process';
import { createRequire } from 'node:module';
import { join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { describe, expect, it } from 'vitest';
/**
* The Aula page's words are read by strangers, like a store listing (CLAUDE.md §8), so
* lint:copy must read them (fabrica-release.md F11). The rules themselves are tested in
* @rosea/content; this proves the files are in the list the script checks.
*/
const repo = fileURLToPath(new URL('../../../', import.meta.url));
const tsx = createRequire(join(repo, 'package.json')).resolve('tsx/cli');
function listed(): string[] {
const run = spawnSync(process.execPath, [tsx, join(repo, 'scripts/lint-copy.ts'), '--list'], { cwd: repo, encoding: 'utf8' });
expect(run.status, run.stderr).toBe(0);
return run.stdout.split(/\r?\n/).filter(Boolean);
}
describe('lint:copy reads the Aula page', { timeout: 60_000 }, () => {
it('AULA.md, the brief and every release note are checked', () => {
const files = listed();
expect(files).toContain('AULA.md');
expect(files).toContain('.fabrica/aula/brief.md');
expect(files).toContain('.fabrica/notes/0.1.0.md');
});
it('the game itself is still checked', () => {
const files = listed();
expect(files).toContain('packages/ui/src/copy/en.ts');
expect(files).toContain('docs/LETTER.md');
});
});
+62
View File
@@ -0,0 +1,62 @@
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { spawnSync } from 'node:child_process';
import { afterEach, describe, expect, it } from 'vitest';
import { VERSION_FILES, versionProblems } from '../../../scripts/check-version.mjs';
/** The version check Fabrica's Deploy reads (fabrica-release.md F10). */
const repo = fileURLToPath(new URL('../../../', import.meta.url));
const temps: string[] = [];
afterEach(() => {
for (const t of temps.splice(0)) rmSync(t, { recursive: true, force: true });
});
function fakeRepo(versions: Record<string, string>): string {
const root = mkdtempSync(join(tmpdir(), 'rosea-version-'));
temps.push(root);
for (const file of VERSION_FILES) {
const v = versions[file] ?? '0.1.0';
mkdirSync(dirname(join(root, file)), { recursive: true });
const text = file.endsWith('.toml') ? `[package]\nname = "x"\nversion = "${v}"\n` : JSON.stringify({ name: 'x', version: v });
writeFileSync(join(root, file), text);
}
return root;
}
describe('check-version', { timeout: 30_000 }, () => {
it('agrees when every file carries the version', () => {
expect(versionProblems(fakeRepo({}), '0.1.0')).toEqual([]);
});
it('names each file that differs, in the words Fabrica parses', () => {
const root = fakeRepo({ 'apps/rosea-tauri/src-tauri/Cargo.toml': '0.0.9', 'apps/rosea/package.json': '0.2.0' });
expect(versionProblems(root, '0.1.0')).toEqual([
'apps/rosea/package.json says 0.2.0, the tag says 0.1.0',
'apps/rosea-tauri/src-tauri/Cargo.toml says 0.0.9, the tag says 0.1.0'
]);
});
it('refuses without a version', () => {
expect(versionProblems(fakeRepo({}), undefined)).toEqual(['usage: node scripts/check-version.mjs <version>']);
});
it('covers the file the installer and the APK take their version from', () => {
const conf = JSON.parse(readFileSync(join(repo, 'apps/rosea-tauri/src-tauri/tauri.conf.json'), 'utf8')) as { version: string };
// tauri.conf.json names the game's package.json relative to itself.
const named = join('apps/rosea-tauri/src-tauri', conf.version).replace(/\\/g, '/');
expect(VERSION_FILES).toContain(named);
});
it('this repository agrees with itself, and the CLI says so (a v prefix is the tag, not the version)', () => {
const version = (JSON.parse(readFileSync(join(repo, 'package.json'), 'utf8')) as { version: string }).version;
expect(versionProblems(repo, version)).toEqual([]);
const ok = spawnSync(process.execPath, [join(repo, 'scripts/check-version.mjs'), `v${version}`], { encoding: 'utf8' });
expect(ok.status).toBe(0);
expect(ok.stdout).toContain(`version ${version} everywhere`);
const bad = spawnSync(process.execPath, [join(repo, 'scripts/check-version.mjs'), '9.9.9'], { encoding: 'utf8' });
expect(bad.status).toBe(1);
expect(bad.stderr).toContain(`package.json says ${version}, the tag says 9.9.9`);
});
});
+7
View File
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": ["node"]
},
"include": ["test/**/*.ts"]
}