@nodii/dev 0.6.88 → 0.6.90
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/README.md +9 -2
- package/dist/cli.js +4 -3
- package/dist/core.js +4 -2
- package/dist/flags.js +1 -1
- package/dist/review.js +10 -2
- package/dist/surface.js +64 -26
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -873,8 +873,8 @@ run the same command again.
|
|
|
873
873
|
### Product pages from Surfaces: `surface generate` (MW8-17)
|
|
874
874
|
|
|
875
875
|
```sh
|
|
876
|
-
nodii-dev surface generate <componentSetKey|route> [--write] [--check] [--fetch] [--figma-version V] [--report FILE] [--post-scoreboard ISSUE]
|
|
877
|
-
nodii-dev surface generate --all [--module M] [--type page|dialog] [--write] [--check] [--fetch] [--report FILE] [--post-scoreboard ISSUE]
|
|
876
|
+
nodii-dev surface generate <componentSetKey|route> [--write] [--check] [--fetch] [--figma-version V] [--report FILE] [--post-scoreboard ISSUE] [--resume]
|
|
877
|
+
nodii-dev surface generate --all [--module M] [--type page|dialog] [--write] [--check] [--fetch] [--figma-version V] [--report FILE] [--post-scoreboard ISSUE] [--resume]
|
|
878
878
|
```
|
|
879
879
|
|
|
880
880
|
Run in a design-system checkout. It turns a Figma Surface into its product
|
|
@@ -918,6 +918,13 @@ product-page catalog names the Surface by its published component-set key
|
|
|
918
918
|
is not among its file's published sets, names it as not published (`--json`:
|
|
919
919
|
`data.unpublished`), and still generates and scores the rest. A Surface named
|
|
920
920
|
on its own still fails with `SURFACE_NOT_PUBLISHED`.
|
|
921
|
+
- **A 429 stops the read.** `--fetch` never retries a 429. `--all` then generates
|
|
922
|
+
and scores what it read, reports the rest as not generated yet (`--json`:
|
|
923
|
+
`data.stopped`) and exits 1. A Surface named on its own fails with
|
|
924
|
+
`FIGMA_RATE_LIMITED`. With `--write`, each tree is saved as soon as it is read,
|
|
925
|
+
so a stopped or killed run keeps its reads. Add `--resume` to carry on: it keeps
|
|
926
|
+
a saved tree and reads only the rest. With `--figma-version V`, it keeps only
|
|
927
|
+
trees read at `V`.
|
|
921
928
|
- **Scoreboard.** Every run returns `data.scoreboard`, one row per module, and
|
|
922
929
|
`--all` also prints it: Surfaces clean out of total, not published, not
|
|
923
930
|
generated yet, and unmapped layers by kind. A Surface is clean when it has no
|
package/dist/cli.js
CHANGED
|
@@ -165,15 +165,16 @@ Usage: nodii-dev <command> [options] [--json]
|
|
|
165
165
|
# values not bound to a variable and non-DS instances; submit reports the
|
|
166
166
|
# same on any Surface node a set touches (refuses where the host enforces).
|
|
167
167
|
# Reads Figma on Dev's token; exit 1 = SURFACES_CHECK_FAILED
|
|
168
|
-
surface generate <componentSetKey|route> [--write] [--check] [--fetch] [--figma-version V] [--report FILE] [--post-scoreboard ISSUE]
|
|
169
|
-
surface generate --all [--module M] [--type page|dialog] [--write] [--check] [--fetch] [--report FILE] [--post-scoreboard ISSUE]
|
|
168
|
+
surface generate <componentSetKey|route> [--write] [--check] [--fetch] [--figma-version V] [--report FILE] [--post-scoreboard ISSUE] [--resume]
|
|
169
|
+
surface generate --all [--module M] [--type page|dialog] [--write] [--check] [--fetch] [--figma-version V] [--report FILE] [--post-scoreboard ISSUE] [--resume]
|
|
170
170
|
# a Surface -> its product page's presentational code, from Code Connect
|
|
171
171
|
# (MW8-17), in a design-system checkout. --fetch reads Figma (FIGMA_PAT, one
|
|
172
172
|
# call per 8 s); --write writes <page>.surface.generated.tsx (and, with --fetch,
|
|
173
173
|
# the committed tree); --check refuses a difference (the surface-gen-equal gate);
|
|
174
174
|
# --report writes the unmapped layers per file (U08-14), .md or .json;
|
|
175
175
|
# --all --fetch skips and reports a Surface that is not published;
|
|
176
|
-
# --post-scoreboard comments the per-module scoreboard on the issue
|
|
176
|
+
# --post-scoreboard comments the per-module scoreboard on the issue;
|
|
177
|
+
# a 429 stops the read, and --fetch --write --resume keeps what is saved
|
|
177
178
|
figma lock FILE_KEY --title TEXT [--scope KIND:ID ...]
|
|
178
179
|
# scopes: component:NODE page:NODE section:NODE foundations create:PAGE:NAME;
|
|
179
180
|
# no --scope locks the whole file (DEC-0032)
|
package/dist/core.js
CHANGED
|
@@ -4,7 +4,7 @@ import { chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
|
4
4
|
import { homedir, platform } from "node:os";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
6
|
|
|
7
|
-
export const VERSION = "0.6.
|
|
7
|
+
export const VERSION = "0.6.90";
|
|
8
8
|
export const configPath = () =>
|
|
9
9
|
process.env.NODII_DEV_CONFIG_PATH ??
|
|
10
10
|
join(homedir(), ".config/nodii-dev/config.json");
|
|
@@ -299,7 +299,9 @@ export async function devExchange(method, path, bodyText, { contentType = "appli
|
|
|
299
299
|
} catch {
|
|
300
300
|
payload = { message: raw };
|
|
301
301
|
}
|
|
302
|
-
|
|
302
|
+
// Dev answers pending work as 202 with its error envelope (FIGMA_PLACEMENT_PENDING):
|
|
303
|
+
// a 2xx alone doesn't mean the change was made.
|
|
304
|
+
if (!response.ok || payload.error === true)
|
|
303
305
|
throw new CliError(
|
|
304
306
|
payload.code ?? `HTTP_${response.status}`,
|
|
305
307
|
payload.message ?? `Dev returned HTTP ${response.status}`,
|
package/dist/flags.js
CHANGED
|
@@ -70,7 +70,7 @@ export const COMMAND_FLAGS = {
|
|
|
70
70
|
"figma changeset": ["file", "actionable", "all", "limit"],
|
|
71
71
|
"figma apply": ["file", "figma-version"],
|
|
72
72
|
"figma lock": ["title", "scope"],
|
|
73
|
-
"surface generate": ["write", "check", "fetch", "all", "module", "type", "figma-version", "report", "post-scoreboard"],
|
|
73
|
+
"surface generate": ["write", "check", "fetch", "all", "module", "type", "figma-version", "report", "post-scoreboard", "resume"],
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
/** Refuse a flag the command does not declare (USAGE, exit 2), naming the valid ones. */
|
package/dist/review.js
CHANGED
|
@@ -116,6 +116,13 @@ export async function repoGeneratedPaths(request, repo) {
|
|
|
116
116
|
return (Array.isArray(harness?.generatedPaths) ? harness.generatedPaths : []).filter((path) => typeof path === "string" && path.trim());
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
/**
|
|
120
|
+
* Data no reviewer can read, left out in every repo alongside Dev's list: a
|
|
121
|
+
* Surface tree is Figma's own document, written only by `surface generate`, and
|
|
122
|
+
* a full set runs to 100 MB (DESIGN-SYSTEM-249).
|
|
123
|
+
*/
|
|
124
|
+
export const GENERATED_DATA_PATHS = ["docs/figma-ux-ds/figma/surface-trees/"];
|
|
125
|
+
|
|
119
126
|
/** One exclude pathspec per prefix, never per file, so a big regeneration cannot hit E2BIG. */
|
|
120
127
|
export const generatedPathspecs = (prefixes) => prefixes.map((prefix) => `:(exclude,glob)${prefix}**`);
|
|
121
128
|
|
|
@@ -127,11 +134,12 @@ export const generatedPathspecs = (prefixes) => prefixes.map((prefix) => `:(excl
|
|
|
127
134
|
* the diff the reviewer reads never disagree.
|
|
128
135
|
*/
|
|
129
136
|
export async function laneDiff(cwd, { exec = execFileAsync, generatedPaths = [] } = {}) {
|
|
130
|
-
|
|
137
|
+
// The same ceiling as the receipt's diff: `text` holds generated data too, so the digest covers every change.
|
|
138
|
+
const git = async (...args) => (await exec("git", ["-C", cwd, ...args], { encoding: "utf8", maxBuffer: 256 * 1024 * 1024 })).stdout;
|
|
131
139
|
const mergeBase = (await git("merge-base", "origin/main", "HEAD")).trim();
|
|
132
140
|
const changedNames = async (...specs) => (await git("diff", "--name-only", mergeBase, ...(specs.length ? ["--", ".", ...specs] : []))).split("\n").map((x) => x.trim()).filter(Boolean);
|
|
133
141
|
const untrackedNames = async (...specs) => (await git("ls-files", "--others", "--exclude-standard", "-z", ...(specs.length ? ["--", ".", ...specs] : []))).split("\0").filter(Boolean);
|
|
134
|
-
const specs = generatedPathspecs(generatedPaths);
|
|
142
|
+
const specs = generatedPathspecs([...GENERATED_DATA_PATHS, ...generatedPaths]);
|
|
135
143
|
const tracked = await git("diff", "--no-color", "--no-ext-diff", mergeBase);
|
|
136
144
|
const names = await changedNames();
|
|
137
145
|
const untracked = await untrackedNames();
|
package/dist/surface.js
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
// Figma reads (only with --fetch) are paced to one call per 8 s or slower;
|
|
25
25
|
// a 429 waits out Retry-After, or 30 s doubling when Figma sends none.
|
|
26
26
|
import { execFileSync } from "node:child_process";
|
|
27
|
-
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
27
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
28
28
|
import { tmpdir } from "node:os";
|
|
29
29
|
import { dirname, join, relative, resolve } from "node:path";
|
|
30
30
|
import { CliError, VERSION, devRequest, readConfig } from "./core.js";
|
|
@@ -42,12 +42,12 @@ const TYPE_EDGES_CATALOG = "packages/tokens/src/generated/type-edges-v2-catalog.
|
|
|
42
42
|
const SURFACE_REFERENCE = "docs/figma-ux-ds/figma/surface-reference.json";
|
|
43
43
|
const FIGMA_API = "https://api.figma.com/v1";
|
|
44
44
|
export const MIN_FIGMA_INTERVAL_MS = 8_000;
|
|
45
|
-
const
|
|
45
|
+
const BACKOFF_MS = 30_000;
|
|
46
46
|
const SET_KEY = /^[0-9a-f]{40}$/;
|
|
47
47
|
|
|
48
48
|
export const SURFACE_USAGE =
|
|
49
|
-
"surface generate <componentSetKey|route> [--write] [--check] [--fetch] [--figma-version V] [--report FILE] [--post-scoreboard ISSUE]\n" +
|
|
50
|
-
"surface generate --all [--module M] [--type page|dialog] [--write] [--check] [--fetch] [--report FILE] [--post-scoreboard ISSUE]";
|
|
49
|
+
"surface generate <componentSetKey|route> [--write] [--check] [--fetch] [--figma-version V] [--report FILE] [--post-scoreboard ISSUE] [--resume]\n" +
|
|
50
|
+
"surface generate --all [--module M] [--type page|dialog] [--write] [--check] [--fetch] [--figma-version V] [--report FILE] [--post-scoreboard ISSUE] [--resume]";
|
|
51
51
|
|
|
52
52
|
// ---------------------------------------------------------------------------
|
|
53
53
|
// Repository inputs
|
|
@@ -139,19 +139,20 @@ export function pacedFigma(token, { fetchImpl = fetch, sleep = (ms) => new Promi
|
|
|
139
139
|
response = await fetchImpl(`${FIGMA_API}${path}`, { headers: { "X-Figma-Token": token }, signal: AbortSignal.timeout(180_000) });
|
|
140
140
|
} catch (error) {
|
|
141
141
|
if (attempt >= attempts) throw new CliError("FIGMA_UNREACHABLE", `Cannot reach Figma: ${error.message}`);
|
|
142
|
-
await sleep(
|
|
142
|
+
await sleep(BACKOFF_MS);
|
|
143
143
|
continue;
|
|
144
144
|
}
|
|
145
145
|
if (response.ok) return response.json();
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const ms =
|
|
146
|
+
// A 429 is never retried: it means stop reading (DS-249 ruling), so it falls through to the throw.
|
|
147
|
+
if (response.status >= 500 && attempt < attempts) {
|
|
148
|
+
const ms = BACKOFF_MS * 2 ** (attempt - 1);
|
|
149
149
|
log(`Figma answered ${response.status} for ${path.split("?")[0]}; waiting ${Math.round(ms / 1000)} s`);
|
|
150
150
|
await sleep(ms);
|
|
151
151
|
continue;
|
|
152
152
|
}
|
|
153
153
|
const code = { 404: "FIGMA_NOT_FOUND", 403: "FIGMA_FORBIDDEN", 429: "FIGMA_RATE_LIMITED" }[response.status] ?? "FIGMA_ERROR";
|
|
154
|
-
|
|
154
|
+
const retryAfter = Number(response.headers?.get?.("retry-after"));
|
|
155
|
+
throw new CliError(code, `Figma answered ${response.status} for ${path.split("?")[0]}`, 1, { status: response.status, ...(retryAfter > 0 ? { retryAfterSeconds: retryAfter } : {}) });
|
|
155
156
|
}
|
|
156
157
|
};
|
|
157
158
|
}
|
|
@@ -438,6 +439,8 @@ export function emitSurface(tree, row, ds) {
|
|
|
438
439
|
* `ComponentProps<typeof Tag>["attr"]` for a prop, ReactNode for a child, an
|
|
439
440
|
* object of those for a member read. Sets each view's `uses`.
|
|
440
441
|
*/
|
|
442
|
+
const JS_LITERALS = new Set(["true", "false", "null", "undefined", "this"]);
|
|
443
|
+
|
|
441
444
|
function dataProps(views) {
|
|
442
445
|
const data = new Map();
|
|
443
446
|
const entry = (name) => data.get(name) ?? data.set(name, { attrs: new Set(), child: false, members: new Map() }).get(name);
|
|
@@ -445,6 +448,7 @@ function dataProps(views) {
|
|
|
445
448
|
view.uses = new Set();
|
|
446
449
|
const body = view.body;
|
|
447
450
|
for (const m of body.matchAll(/([A-Za-z][\w-]*)=\{([a-z][A-Za-z0-9]*)(?:\.([A-Za-z][A-Za-z0-9]*))?\}/g)) {
|
|
451
|
+
if (JS_LITERALS.has(m[2])) continue;
|
|
448
452
|
const tag = openingTag(body, m.index);
|
|
449
453
|
if (!tag) continue;
|
|
450
454
|
const ref = `ComponentProps<typeof ${tag}>[${JSON.stringify(m[1])}]`;
|
|
@@ -454,6 +458,7 @@ function dataProps(views) {
|
|
|
454
458
|
view.uses.add(m[2]);
|
|
455
459
|
}
|
|
456
460
|
for (const m of body.matchAll(/(^|>)\s*\{([a-z][A-Za-z0-9]*)\}/gm)) {
|
|
461
|
+
if (JS_LITERALS.has(m[2])) continue;
|
|
457
462
|
entry(m[2]).child = true;
|
|
458
463
|
view.uses.add(m[2]);
|
|
459
464
|
}
|
|
@@ -826,10 +831,11 @@ export function scoreboardText(board) {
|
|
|
826
831
|
}
|
|
827
832
|
|
|
828
833
|
/** The scoreboard as an issue comment. `source` names what the run read (P-4). */
|
|
829
|
-
export function scoreboardMarkdown(board, { mode, source }) {
|
|
834
|
+
export function scoreboardMarkdown(board, { mode, source, stopped = null }) {
|
|
830
835
|
const lines = [
|
|
831
836
|
`**Surface scoreboard** (\`surface generate\`, ${mode} run, \`@nodii/dev\` ${VERSION}, ${source}).`,
|
|
832
837
|
"",
|
|
838
|
+
...(stopped ? [`**Partial: Figma answered 429 at \`${stopped.at}\`, so the run stopped with ${stopped.notRead.length} Surface${stopped.notRead.length === 1 ? "" : "s"} not read.** They count as not generated yet.`, ""] : []),
|
|
833
839
|
"A Surface is clean when it has no unmapped layer. Total counts every selected Surface, including those not published or not generated yet.",
|
|
834
840
|
"",
|
|
835
841
|
"| Module | Clean / total | Not published | Not generated yet | Unmapped | By kind |",
|
|
@@ -859,6 +865,7 @@ export async function surfaceCommand(action, rest, f, deps = {}) {
|
|
|
859
865
|
if (rest.length > 1 || (rest.length && f.all)) throw new CliError("USAGE", SURFACE_USAGE, 2);
|
|
860
866
|
if (f.write && f.check) throw new CliError("USAGE", "--write and --check are separate runs: --write updates the files, --check refuses a difference", 2);
|
|
861
867
|
if (f.check && f.fetch) throw new CliError("USAGE", "--check regenerates from the committed trees and never reads Figma; drop --fetch", 2);
|
|
868
|
+
if (f.resume && !(f.fetch && f.write)) throw new CliError("USAGE", "--resume continues a stopped read: use it with --fetch --write", 2);
|
|
862
869
|
const postTo = f["post-scoreboard"];
|
|
863
870
|
if (postTo === true || postTo === "") throw new CliError("USAGE", "--post-scoreboard needs an issue key, for example DESIGN-SYSTEM-249", 2);
|
|
864
871
|
const { env = process.env, exec = execFileSync, log = (line) => process.stderr.write(`${line}\n`), figmaGet: injected, docs, cwd } = deps;
|
|
@@ -876,20 +883,51 @@ export async function surfaceCommand(action, rest, f, deps = {}) {
|
|
|
876
883
|
const indexes = new Map();
|
|
877
884
|
const trees = new Map();
|
|
878
885
|
const unpublished = [];
|
|
886
|
+
const stable = (value) => `${JSON.stringify(value, null, 2)}\n`;
|
|
887
|
+
// Saved as soon as it is read, through a rename, so a stopped or killed run keeps its reads whole.
|
|
888
|
+
const saveTree = (row, tree) => {
|
|
889
|
+
const path = treePath(root, row);
|
|
890
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
891
|
+
writeFileSync(`${path}.tmp`, stable(tree));
|
|
892
|
+
renameSync(`${path}.tmp`, path);
|
|
893
|
+
};
|
|
894
|
+
const figmaVersion = f["figma-version"] && f["figma-version"] !== true ? String(f["figma-version"]) : null;
|
|
895
|
+
let stopped = null;
|
|
896
|
+
let kept = 0;
|
|
879
897
|
for (const row of targets) {
|
|
880
898
|
const path = treePath(root, row);
|
|
881
899
|
if (f.fetch) {
|
|
900
|
+
if (f.resume && existsSync(path)) {
|
|
901
|
+
const saved = readJson(path);
|
|
902
|
+
if (!figmaVersion || saved.figmaVersion === figmaVersion) {
|
|
903
|
+
log(`keeping ${row.componentSetName ?? row.id}: read at version ${saved.figmaVersion ?? "unknown"}`);
|
|
904
|
+
trees.set(row, saved);
|
|
905
|
+
kept += 1;
|
|
906
|
+
continue;
|
|
907
|
+
}
|
|
908
|
+
}
|
|
882
909
|
figmaGet ??= pacedFigma(figmaTokenFrom(env), { log });
|
|
883
|
-
|
|
910
|
+
let tree;
|
|
911
|
+
try {
|
|
912
|
+
if (!indexes.has(row.fileKey)) indexes.set(row.fileKey, await setIndex(figmaGet, row.fileKey));
|
|
884
913
|
// --all covers a module: one unpublished Surface is reported, and the rest still generate.
|
|
885
914
|
// A Surface named on its own stays a refusal, because the run has nothing else to do.
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
915
|
+
if (f.all && !indexes.get(row.fileKey).has(row.componentSetKey)) {
|
|
916
|
+
log(`skipping ${row.componentSetName ?? row.id}: not among ${row.fileKey}'s published component sets`);
|
|
917
|
+
unpublished.push(row);
|
|
918
|
+
continue;
|
|
919
|
+
}
|
|
920
|
+
log(`reading ${row.componentSetName ?? row.id} from Figma`);
|
|
921
|
+
tree = await fetchSurfaceTree(figmaGet, row, { index: indexes.get(row.fileKey), version: pinnedVersion(root, row, f["figma-version"]) });
|
|
922
|
+
} catch (error) {
|
|
923
|
+
// --all keeps what it read and scores it; a Surface named on its own has nothing to keep.
|
|
924
|
+
if (!f.all || error?.code !== "FIGMA_RATE_LIMITED") throw error;
|
|
925
|
+
stopped = { code: error.code, at: row.id, retryAfterSeconds: error.details?.retryAfterSeconds ?? null };
|
|
926
|
+
log(`stopping at ${row.componentSetName ?? row.id}: Figma answered 429`);
|
|
927
|
+
break;
|
|
890
928
|
}
|
|
891
|
-
|
|
892
|
-
|
|
929
|
+
trees.set(row, tree);
|
|
930
|
+
if (f.write) saveTree(row, tree);
|
|
893
931
|
} else if (existsSync(path)) {
|
|
894
932
|
trees.set(row, readJson(path));
|
|
895
933
|
} else {
|
|
@@ -904,16 +942,11 @@ export async function surfaceCommand(action, rest, f, deps = {}) {
|
|
|
904
942
|
return { row, tree, ...emitSurface(tree, row, ds) };
|
|
905
943
|
});
|
|
906
944
|
|
|
907
|
-
const stable = (value) => `${JSON.stringify(value, null, 2)}\n`;
|
|
908
945
|
const differences = [];
|
|
909
946
|
for (const r of results) {
|
|
910
947
|
const out = generatedPath(root, r.row);
|
|
911
948
|
r.file = relative(root, out);
|
|
912
949
|
if (f.write) {
|
|
913
|
-
if (f.fetch) {
|
|
914
|
-
mkdirSync(dirname(treePath(root, r.row)), { recursive: true });
|
|
915
|
-
writeFileSync(treePath(root, r.row), stable(r.tree));
|
|
916
|
-
}
|
|
917
950
|
writeFileSync(out, r.code);
|
|
918
951
|
} else if (f.check) {
|
|
919
952
|
const current = existsSync(out) ? readFileSync(out, "utf8") : null;
|
|
@@ -929,14 +962,16 @@ export async function surfaceCommand(action, rest, f, deps = {}) {
|
|
|
929
962
|
}
|
|
930
963
|
|
|
931
964
|
const mode = f.check ? "check" : f.write ? "write" : "print";
|
|
932
|
-
const
|
|
965
|
+
const unread = stopped ? targets.filter((row) => !trees.has(row) && !unpublished.includes(row)) : [];
|
|
966
|
+
if (stopped) stopped.notRead = unread.map((row) => row.id);
|
|
967
|
+
const scoreboard = surfaceScoreboard(selected, results, { unpublished, notGeneratedYet: [...notYetRows, ...unread] });
|
|
933
968
|
let posted = null;
|
|
934
969
|
if (postTo) {
|
|
935
970
|
const commit = checkoutCommit(root, exec);
|
|
936
|
-
const source = `${f.fetch ?
|
|
971
|
+
const source = `${f.fetch ? `trees read from Figma${kept ? `, ${kept} of them kept from an earlier read by --resume` : ""}` : "committed trees"}${commit ? ` in checkout \`${commit}\`` : ""}`;
|
|
937
972
|
const { comment = async (key, body) => devRequest("POST", `/api/v1/issues/${encodeURIComponent(key)}/comment`, { body, onBehalfOf: (await readConfig()).person }) } = deps;
|
|
938
973
|
try {
|
|
939
|
-
await comment(String(postTo), scoreboardMarkdown(scoreboard, { mode, source }));
|
|
974
|
+
await comment(String(postTo), scoreboardMarkdown(scoreboard, { mode, source, stopped }));
|
|
940
975
|
} catch (error) {
|
|
941
976
|
throw new CliError("COMMENT_FAILED", `The run finished${f.write ? " and its files are written" : ""}, but the scoreboard was not posted on ${postTo} (${error?.code ?? "error"}: ${error?.message ?? error}).`, 1);
|
|
942
977
|
}
|
|
@@ -952,6 +987,7 @@ export async function surfaceCommand(action, rest, f, deps = {}) {
|
|
|
952
987
|
unpublished: unpublished.map((row) => ({ id: row.id, componentSetKey: row.componentSetKey, fileKey: row.fileKey })),
|
|
953
988
|
scoreboard,
|
|
954
989
|
scoreboardPostedOn: posted,
|
|
990
|
+
stopped,
|
|
955
991
|
unmapped: report,
|
|
956
992
|
},
|
|
957
993
|
};
|
|
@@ -964,9 +1000,11 @@ export async function surfaceCommand(action, rest, f, deps = {}) {
|
|
|
964
1000
|
if (unpublished.length) lines.push(`not published: ${unpublished.length} Surface${unpublished.length === 1 ? "" : "s"} skipped, not generated or scored: ${unpublished.map((row) => row.id).join(", ")}`);
|
|
965
1001
|
if (f.check && differences.length)
|
|
966
1002
|
lines.push(`SURFACE_GEN_DIFFERS: ${differences.length} product page${differences.length === 1 ? " differs" : "s differ"} from the generator's output; run \`nodii-dev surface generate --all --write\` and commit, never hand-edit a generated file`);
|
|
1003
|
+
if (stopped)
|
|
1004
|
+
lines.push(`FIGMA_RATE_LIMITED: Figma answered 429 at ${stopped.at}; stopped with ${stopped.notRead.length} Surface${stopped.notRead.length === 1 ? "" : "s"} not read. ${f.write ? "What was read is saved: carry on later with the same command plus --resume." : "Nothing was saved, because this run has no --write."}`);
|
|
967
1005
|
if (f.all) lines.push("", scoreboardText(scoreboard));
|
|
968
1006
|
if (posted) lines.push(`scoreboard posted on ${posted}`);
|
|
969
1007
|
return lines.join("\n");
|
|
970
1008
|
};
|
|
971
|
-
return { payload, human, exitCode: f.check && differences.length ? 1 : 0 };
|
|
1009
|
+
return { payload, human, exitCode: stopped || (f.check && differences.length) ? 1 : 0 };
|
|
972
1010
|
}
|