synthesisui 0.16.510 → 0.16.511
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/template.js +23 -1
- package/dist/index.js +8 -2
- package/dist/registry.js +17 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { mkdir, stat, writeFile } from "node:fs/promises";
|
|
|
2
2
|
import { dirname, join, relative } from "node:path";
|
|
3
3
|
import { readProjectConfig, resolveRegistry } from "../config.js";
|
|
4
4
|
import { installedSheetCss, RECIPE_HEADER, recipeRulesFor, } from "../recipe-css.js";
|
|
5
|
-
import { fetchDesignSystem, fetchTemplate } from "../registry.js";
|
|
5
|
+
import { fetchDesignSystem, fetchPages, fetchTemplate } from "../registry.js";
|
|
6
6
|
import { inTheirTongue, projectTongue, tongueFromArtifacts, } from "../their-tongue.js";
|
|
7
7
|
import { keptLine, recordWritten, editedHere as theirEdits, } from "../written.js";
|
|
8
8
|
/**
|
|
@@ -46,6 +46,28 @@ function withoutTheSheetInstruction(code) {
|
|
|
46
46
|
* path classes; the co-located CSS (Next target) carries the responsive media
|
|
47
47
|
* queries + the CSS-only hamburger, so it re-vests once `tokens.css` is in.
|
|
48
48
|
*/
|
|
49
|
+
/**
|
|
50
|
+
* `template <slug>` SEM NOME - as páginas prontas do sistema (jornada "o CLI na primeira página", E02). Antes, a única
|
|
51
|
+
* resposta era pedir os dois argumentos, e o nome só se descobria tentando. Sem página nenhuma, o caminho que existe é
|
|
52
|
+
* a landing por seções, e a lista diz isso em vez de ficar vazia.
|
|
53
|
+
*/
|
|
54
|
+
export async function listPages(slug, registry) {
|
|
55
|
+
const pages = await fetchPages(resolveRegistry(registry), slug);
|
|
56
|
+
if (pages === null) {
|
|
57
|
+
console.log(`The registry did not list the pages of "${slug}". Try \`synthesisui template ${slug} <name>\`.`);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (pages.length === 0) {
|
|
61
|
+
console.log(`"${slug}" has no ready pages.`);
|
|
62
|
+
console.log(`A landing is put together from its sections: synthesisui landing ${slug} "<what the page is for>"`);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
console.log(`"${slug}" has ${pages.length} ready page${pages.length === 1 ? "" : "s"}:`);
|
|
66
|
+
for (const page of pages)
|
|
67
|
+
console.log(` ${page}`);
|
|
68
|
+
console.log("");
|
|
69
|
+
console.log(` synthesisui template ${slug} ${pages[0]}`);
|
|
70
|
+
}
|
|
49
71
|
export async function template(slug, name, opts) {
|
|
50
72
|
const base = resolveRegistry(opts.registry);
|
|
51
73
|
const root = opts.dir ?? process.cwd();
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ import { request } from "./commands/request.js";
|
|
|
34
34
|
import { status } from "./commands/status.js";
|
|
35
35
|
import { summary } from "./commands/summary.js";
|
|
36
36
|
import { sync } from "./commands/sync.js";
|
|
37
|
-
import { template } from "./commands/template.js";
|
|
37
|
+
import { listPages, template } from "./commands/template.js";
|
|
38
38
|
import { upgrade } from "./commands/upgrade.js";
|
|
39
39
|
import { use } from "./commands/use.js";
|
|
40
40
|
import { appendEvent } from "./doctor/ledger.js";
|
|
@@ -62,6 +62,7 @@ Usage - deterministic, FREE:
|
|
|
62
62
|
synthesisui blueprint | component the same command, spelled in full
|
|
63
63
|
synthesisui template <slug> <name> materialize a whole page from a DS template
|
|
64
64
|
(--as landing-home names the output - multi-page safe)
|
|
65
|
+
synthesisui template <slug> the ready pages that system has
|
|
65
66
|
synthesisui upgrade <slug> update an installed DS + regenerate your components + migration brief
|
|
66
67
|
synthesisui colours [slug] write the colours you chose on the site into your CSS, in your names (asks first)
|
|
67
68
|
synthesisui use <slug> "<intent>" print a ready-to-paste agent prompt to build/modify on-system
|
|
@@ -608,11 +609,16 @@ async function main() {
|
|
|
608
609
|
}
|
|
609
610
|
const slug = args[0];
|
|
610
611
|
const name = args[1];
|
|
611
|
-
if (!slug
|
|
612
|
+
if (!slug) {
|
|
612
613
|
console.error("error: provide slug and template name - `synthesisui template <slug> <name>`");
|
|
613
614
|
process.exitCode = 1;
|
|
614
615
|
return;
|
|
615
616
|
}
|
|
617
|
+
/** SEM NOME, A LISTA - o que o sistema tem, em vez de pedir um nome que só se descobre tentando (E02, 12/10). */
|
|
618
|
+
if (!name) {
|
|
619
|
+
await listPages(slug, registry);
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
616
622
|
let version;
|
|
617
623
|
if (typeof flags.version === "string") {
|
|
618
624
|
version = Number.parseInt(flags.version.replace(/^v/i, ""), 10);
|
package/dist/registry.js
CHANGED
|
@@ -70,6 +70,23 @@ export async function fetchDesignSystem(base, slug, version) {
|
|
|
70
70
|
* Fetches a whole page generated from a DS template (`?template=&target=`). The
|
|
71
71
|
* server codegens it from `document.layouts[<template>]`; the CLI just writes it.
|
|
72
72
|
*/
|
|
73
|
+
/**
|
|
74
|
+
* AS PÁGINAS PRONTAS DE UM SISTEMA - `template <slug>` sem nome (jornada "o CLI na primeira página", E02). `null` quando
|
|
75
|
+
* o registro ainda não sabe responder (anterior a `?pages=1`): ele devolve o documento, que não tem `pages`.
|
|
76
|
+
*/
|
|
77
|
+
export async function fetchPages(base, slug) {
|
|
78
|
+
const url = new URL(`${base}/api/registry/ds/${encodeURIComponent(slug)}`);
|
|
79
|
+
url.searchParams.set("pages", "1");
|
|
80
|
+
const res = await request(url.toString());
|
|
81
|
+
if (res.status === 404)
|
|
82
|
+
throw new RegistryError(`No design system "${slug}" that this machine can see. \`synthesisui list\` shows what is public.`);
|
|
83
|
+
if (!res.ok)
|
|
84
|
+
throw new RegistryError(`Registry responded ${res.status} while listing the pages of "${slug}".`);
|
|
85
|
+
const body = (await res.json().catch(() => ({})));
|
|
86
|
+
return Array.isArray(body.pages)
|
|
87
|
+
? body.pages.filter((p) => typeof p === "string")
|
|
88
|
+
: null;
|
|
89
|
+
}
|
|
73
90
|
export async function fetchTemplate(base, slug, template, target, version, as_) {
|
|
74
91
|
const url = new URL(`${base}/api/registry/ds/${encodeURIComponent(slug)}`);
|
|
75
92
|
url.searchParams.set("template", template);
|
package/package.json
CHANGED