mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-12-03 00:09:19 -08:00
Replace the desktop app placeholder pictures with real captures, redraw the banner
AI Assisted
This commit is contained in:
1 parent
ccf82c4eb7
commit
bc2325e061
12 files changed
+468
-75
No files matched your search
@@ -16,6 +16,10 @@
|
||||
//
|
||||
// Shots: dashboard, dashboard-plan, dashboard-utilities, question, doc, build, signoff, signoff-changes, finish, ask, git,
|
||||
// notebook, learning, lessons, deps, activities and prototypes.
|
||||
// --app takes the desktop app's five pictures instead (app-launch, app-terminal,
|
||||
// loop-setup, loop-banner, loop-stop; dark only): the app's own page with a
|
||||
// stand-in for its Rust side, framing a real staged console. See
|
||||
// scripts/capture-app-shots.mjs. --only picks one of them.
|
||||
// --compare adds workspace, stop, delete, help, prefs and cleanup: screens the
|
||||
// docs never show, for checking a change by eye against a "before" set. Its
|
||||
// --out must be outside docs/screenshots/, so the set is never published.
|
||||
@@ -37,6 +41,7 @@ import path from "node:path";
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { launchBrowser } from "./browser.mjs";
|
||||
import { APP_SHOTS, captureAppShot, serveAppUi } from "./capture-app-shots.mjs";
|
||||
|
||||
const ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
||||
const CONSOLE_CLI = path.join(ROOT, "src", "web-console", "console.mjs");
|
||||
@@ -659,8 +664,12 @@ async function main() {
|
||||
fail(`--compare never writes into ${path.relative(ROOT, docs)}: pass --out with a folder outside it.`);
|
||||
}
|
||||
const table = args.compare ? { ...SHOTS, ...COMPARE_SHOTS } : SHOTS;
|
||||
const names = args.only ? [args.only] : Object.keys(table);
|
||||
for (const n of names) if (!table[n]) fail(`Unknown shot "${n}". Shots: ${Object.keys(table).join(", ")}`);
|
||||
const known = args.app ? APP_SHOTS : Object.keys(table);
|
||||
const names = args.only ? [args.only] : known;
|
||||
for (const n of names) if (!known.includes(n)) fail(`Unknown shot "${n}". Shots: ${known.join(", ")}`);
|
||||
// The app's page is served before any console starts: the console is told
|
||||
// its origin is allowed to frame it.
|
||||
const appUi = args.app ? await serveAppUi(ROOT) : null;
|
||||
|
||||
SCRATCH = fs.mkdtempSync(path.join(SCRATCH_ROOT, "p2c-shots-"));
|
||||
HOME = path.join(SCRATCH, "console-home");
|
||||
@@ -672,7 +681,11 @@ async function main() {
|
||||
PLAN2CODE_NOTEPADS_DIR: path.join(SCRATCH, "notepads"),
|
||||
PLAN2CODE_LEARNING_DIR: path.join(SCRATCH, "learning"),
|
||||
PLAN2CODE_NO_BROWSER: "1",
|
||||
...(appUi ? { PLAN2CODE_IN_APP: "1", PLAN2CODE_EMBED_ORIGIN: appUi.origin } : {}),
|
||||
};
|
||||
// Never announce to a real app window this shell may have inherited.
|
||||
for (const k of ["PLAN2CODE_APP_TOKEN", "PLAN2CODE_APP_ANNOUNCE", "PLAN2CODE_CONSOLE_SID", "PLAN2CODE_APP_VERSION"]) delete ENV[k];
|
||||
if (!appUi) delete ENV.PLAN2CODE_IN_APP;
|
||||
fs.mkdirSync(HOME, { recursive: true });
|
||||
fs.mkdirSync(OUT, { recursive: true });
|
||||
let browser = null;
|
||||
@@ -687,7 +700,10 @@ async function main() {
|
||||
...(typeof args.browser === "string" ? { executablePath: args.browser } : {}),
|
||||
args: ["--no-first-run", "--no-default-browser-check", "--mute-audio"],
|
||||
});
|
||||
for (const name of names) {
|
||||
if (appUi) {
|
||||
for (const name of names) await captureAppShot(name, { browser, origin: appUi.origin, project, cli, post, stage, root: ROOT, out: OUT });
|
||||
}
|
||||
for (const name of appUi ? [] : names) {
|
||||
const spec = table[name];
|
||||
const where = spec.repo
|
||||
? makeGitProject()
|
||||
@@ -709,6 +725,7 @@ async function main() {
|
||||
if (args.snapshot) fs.writeFileSync(path.resolve(String(args.snapshot)), JSON.stringify(SNAP));
|
||||
} finally {
|
||||
if (browser) await browser.close();
|
||||
if (appUi) await appUi.close();
|
||||
if (project) cli(project, "stop", "--all");
|
||||
removeScratch();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user