Cotton code
32 lines · 1.8 KB · TypeScriptRaw
import { existsSync, readFileSync, readdirSync } from "node:fs";import { join, resolve } from "node:path";import { expect, it } from "vitest";import { foundsPersonal, registryApps } from "./helpers/app-registry";// RULE: shipped business flavours wait to join; Cotton, Development, Rigby// (Cotton's own flavour under its own identity, 22 Oct 2026) and Cotton's own// apps over the one object — Books, Music, Cinemas, Money, Keys (owner, 4 Nov 2026: Cotton// splits into apps, one kit each over the one object; Keys 8 Nov 2026) — keep Personal genesis,// and every one makes it on first open without asking: no manifest names a// first-open choice (Cotton works before anyone signs in, owner, 1 Nov 2026;// the choice gone everywhere, 6 Nov 2026). Repository// packaging belongs here, outside Rust crates.// Which apps found Personal is read from the registry and their kits (`foundsPersonal`), never listed here.it("shipped manifests select their genesis policy", () => {  const app = resolve(__dirname, "../../apps/cotton/App");  const flavours = join(app, "Flavours");  const paths = [join(app, "CottonManifest/flavour.json"),    ...readdirSync(flavours, { withFileTypes: true })      .filter(entry => entry.isDirectory())      .map(entry => join(flavours, entry.name, "flavour.json"))      .filter(path => existsSync(path))];  for (const path of paths) {    const manifest = JSON.parse(readFileSync(path, "utf8"));    const row = registryApps().find((a) => a.slug === (manifest.flavour === "real" ? "cotton" : manifest.flavour));    expect(row, `${path}: the registry has no row for ${manifest.flavour}`).toBeDefined();    const personal = foundsPersonal(row!);    expect(manifest.genesis, path).toBe(personal ? "personal" : "none");    expect(manifest.first_open, `${path}: there is no first-open choice`).toBeUndefined();  }});