storebound/tools/ci.ts
CRT 7fab0a5b03 Desktop app shell (apps/desktop): Tauri 2 + React 19 around the storebound sidecar
- Rust host: spawns storebound serve --stdio with fixed args, hands over a per-session secret,
  mints confirm tokens only after a native dialog showing the summary and the dry run
- every app command re-checks window label and page origin; one capability (main window, app
  commands + event listen only, no plugin API in the webview); strict CSP; tests/security.rs pins it
- store keys picked in native dialogs, kept in the OS keychain, passed per call in memory only
- plugins: shell (Rust only), single-instance, deep-link storebound://, window-state, opener,
  dialog, notification, updater (placeholder endpoint and key until signing), process
- app-centric UI: Portfolio, App (Releases, Catalog, Listings, Health, Reviews, TestFlight),
  App folders, Accounts, Dependencies, Settings; light / dark with the storebound.dev tokens,
  reduced motion, home folder shown as ~
- macOS menu: Cmd+Q quits, Edit menu, Window menu keeps the main window; Linux DMABUF fix
- Bun workspace (npm files unchanged), ci runs desktop typecheck, build, cargo test and clippy;
  scrub covers home paths; docs/desktop.md (protocol, safety, dependency sources and licenses)
2026-10-10 17:57:33 +00:00

30 lines
1.6 KiB
TypeScript

#!/usr/bin/env bun
// Everything CI runs, in order; stops at the first failure. bun run ci
// `bun test` covers the CLI and the desktop webview (apps/desktop/tests). The desktop Rust host (cargo test, clippy
// with warnings as errors) runs when cargo is installed; set STOREBOUND_CI_RUST=0 to skip it on a machine without Rust.
import { join } from 'node:path';
const root = new URL('..', import.meta.url).pathname;
const tauri = join(root, 'apps/desktop/src-tauri');
const cargo = process.env.STOREBOUND_CI_RUST === '0' ? null : Bun.which('cargo');
const steps: [string, string[], string?][] = [
['adapters', ['bun', 'tools/gen-adapters.ts', '--check']],
['tests', ['bun', 'test']],
['typecheck', ['bunx', 'tsc', '--noEmit']],
['desktop typecheck', ['bunx', 'tsc', '--noEmit', '-p', 'apps/desktop']],
['desktop build', ['bun', 'run', '--cwd', 'apps/desktop', 'build']],
...(cargo ? [
['desktop rust tests', [cargo, 'test', '--quiet'], tauri],
['desktop clippy', [cargo, 'clippy', '--all-targets', '--quiet', '--', '-D', 'warnings'], tauri],
] as [string, string[], string][] : []),
['scrub', ['bun', 'tools/scrub.ts']],
];
if (!cargo) console.log('ci: cargo not found (or STOREBOUND_CI_RUST=0): desktop Rust tests and clippy skipped');
for (const [name, cmd, cwd] of steps) {
const t = Date.now();
console.log(`\n== ${name}: ${cmd.join(' ')}`);
const r = Bun.spawnSync(cmd, { cwd: cwd ?? root, stdout: 'inherit', stderr: 'inherit' });
if (r.exitCode !== 0) { console.error(`\nci: ${name} failed (exit ${r.exitCode})`); process.exit(1); }
console.log(`== ${name} ok (${((Date.now() - t) / 1000).toFixed(1)}s)`);
}
console.log('\nci: all green');