[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:
@@ -0,0 +1,3 @@
|
||||
/** Types for check-version.mjs, which Fabrica runs with plain `node` (no build step). */
|
||||
export declare const VERSION_FILES: readonly string[];
|
||||
export declare function versionProblems(root: string, want: string | undefined): string[];
|
||||
@@ -0,0 +1,38 @@
|
||||
// The release tag and the version files must agree (.agents/features/fabrica-release.md F10).
|
||||
// Fabrica's Deploy runs `node scripts/check-version.mjs <version>` and rewrites exactly the files it names;
|
||||
// each line is Fabrica's contract: `<file> says <old>, the tag says <new>` (Fabrica docs/04_deploy.md).
|
||||
// The installer and the APK take their version from apps/rosea/package.json (tauri.conf.json reads it).
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { join, resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
/** Every file that carries the app's version, relative to the repository root. */
|
||||
export const VERSION_FILES = [
|
||||
'package.json',
|
||||
'apps/rosea/package.json',
|
||||
'apps/rosea-tauri/package.json',
|
||||
'apps/rosea-tauri/src-tauri/Cargo.toml'
|
||||
];
|
||||
|
||||
function versionOf(root, file) {
|
||||
const text = readFileSync(join(root, file), 'utf8');
|
||||
if (file.endsWith('.toml')) return text.match(/^version = "([^"]+)"/m)?.[1];
|
||||
return JSON.parse(text).version;
|
||||
}
|
||||
|
||||
/** The lines to print, one per file whose version is not `want`. Empty when they all agree. */
|
||||
export function versionProblems(root, want) {
|
||||
if (!want) return ['usage: node scripts/check-version.mjs <version>'];
|
||||
return VERSION_FILES.map((f) => [f, versionOf(root, f)])
|
||||
.filter(([, v]) => v !== want)
|
||||
.map(([f, v]) => `${f} says ${v}, the tag says ${want}`);
|
||||
}
|
||||
|
||||
const isMain = (arg) => Boolean(arg) && resolve(arg).toLowerCase() === fileURLToPath(import.meta.url).toLowerCase();
|
||||
if (isMain(process.argv[1])) {
|
||||
const want = process.argv[2]?.replace(/^v/, '');
|
||||
const problems = versionProblems(fileURLToPath(new URL('..', import.meta.url)), want);
|
||||
for (const p of problems) console.error(p);
|
||||
if (problems.length > 0) process.exit(1);
|
||||
console.log(`version ${want} everywhere`);
|
||||
}
|
||||
+12
-3
@@ -19,11 +19,14 @@ const TARGETS: readonly { dir: string; ext: readonly string[] }[] = [
|
||||
{ dir: 'packages/ui/src', ext: ['.ts', '.svelte', '.css'] },
|
||||
{ dir: 'apps/rosea/src', ext: ['.ts', '.svelte', '.css'] },
|
||||
// Store listings, once they exist, live here and are player-facing too (§8).
|
||||
{ dir: 'store', ext: ['.md', '.txt', '.json'] }
|
||||
{ dir: 'store', ext: ['.md', '.txt', '.json'] },
|
||||
// The Aula page's brief and each release's notes: a stranger reads them (fabrica-release.md F11).
|
||||
{ dir: '.fabrica/aula', ext: ['.md'] },
|
||||
{ dir: '.fabrica/notes', ext: ['.md'] }
|
||||
];
|
||||
|
||||
/** Single files: the page shell, the config that builds the web manifest, and the Letter. */
|
||||
const FILES: readonly string[] = ['apps/rosea/index.html', 'apps/rosea/vite.config.ts', 'docs/LETTER.md'];
|
||||
/** Single files: the page shell, the config that builds the web manifest, the Letter, and the Aula page's text. */
|
||||
const FILES: readonly string[] = ['apps/rosea/index.html', 'apps/rosea/vite.config.ts', 'docs/LETTER.md', 'AULA.md'];
|
||||
|
||||
function walk(dir: string, ext: readonly string[]): string[] {
|
||||
if (!existsSync(dir)) return [];
|
||||
@@ -44,6 +47,12 @@ if (files.length === 0) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// `--list` prints what would be read and checks nothing: the seam tools/release tests the list through.
|
||||
if (process.argv.includes('--list')) {
|
||||
for (const file of files) console.log(relative(root, file).replace(/\\/g, '/'));
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
let problems = 0;
|
||||
for (const file of files) {
|
||||
for (const p of lintCopy(readFileSync(file, 'utf8'))) {
|
||||
|
||||
Reference in New Issue
Block a user