synthesisui 0.16.4 → 0.16.5
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/doctor.js +43 -4
- package/package.json +1 -1
package/dist/commands/doctor.js
CHANGED
|
@@ -292,7 +292,14 @@ export async function doctor(opts) {
|
|
|
292
292
|
*
|
|
293
293
|
* Nobody debugs from 0%. They conclude the product does not work.
|
|
294
294
|
*/
|
|
295
|
-
const wiring = {
|
|
295
|
+
const wiring = {
|
|
296
|
+
imported: false,
|
|
297
|
+
scoped: false,
|
|
298
|
+
/** `init` wrote a fonts file for this project (Next targets only). */
|
|
299
|
+
fontsWritten: false,
|
|
300
|
+
/** …and the stylesheet actually maps it onto the system's type tokens. */
|
|
301
|
+
fontsMapped: false,
|
|
302
|
+
};
|
|
296
303
|
for await (const file of scopes.length > 0 ? walkAll(scopes) : walk(root)) {
|
|
297
304
|
const src = await readFile(file, "utf8").catch(() => "");
|
|
298
305
|
if (!src)
|
|
@@ -305,6 +312,15 @@ export async function doctor(opts) {
|
|
|
305
312
|
wiring.imported = true;
|
|
306
313
|
if (src.includes(`data-ds="${table.slug}"`))
|
|
307
314
|
wiring.scoped = true;
|
|
315
|
+
// The third requirement, and the one that stayed invisible. `init`
|
|
316
|
+
// writes a fonts file and asks for two more edits; an agent told to
|
|
317
|
+
// check only the first two did exactly that, stopped, and left the
|
|
318
|
+
// project rendering in the framework's default face (my-test2, 27/07).
|
|
319
|
+
// What the checker checks is what gets done.
|
|
320
|
+
if (src.includes("--font-ds-") && /next\/font/.test(src))
|
|
321
|
+
wiring.fontsWritten = true;
|
|
322
|
+
if (/--ds-typography-families-\w+\s*:\s*var\(\s*--font-ds-/.test(src))
|
|
323
|
+
wiring.fontsMapped = true;
|
|
308
324
|
}
|
|
309
325
|
reports.push(scanSource(rel, src, table));
|
|
310
326
|
if (recipes.size > 0) {
|
|
@@ -378,7 +394,11 @@ export async function doctor(opts) {
|
|
|
378
394
|
// Before the number, because the number is the thing that misleads. An
|
|
379
395
|
// installed-but-unwired system reads 0%, and 0% reads as "broken product"
|
|
380
396
|
// rather than "one import missing".
|
|
381
|
-
|
|
397
|
+
// Fonts only count as missing when `init` actually wrote the file - a
|
|
398
|
+
// non-Next project has no fonts.ts and must not be nagged about one.
|
|
399
|
+
const fontsPending = wiring.fontsWritten && !wiring.fontsMapped;
|
|
400
|
+
const unwired = table.source === "installed" &&
|
|
401
|
+
(!wiring.imported || !wiring.scoped || fontsPending);
|
|
382
402
|
if (unwired) {
|
|
383
403
|
console.log("");
|
|
384
404
|
console.log(body(`${table.name ?? table.slug} is installed - but not wired up yet.`));
|
|
@@ -389,9 +409,28 @@ export async function doctor(opts) {
|
|
|
389
409
|
console.log(body(wiring.scoped
|
|
390
410
|
? ` ✓ data-ds="${table.slug}" found`
|
|
391
411
|
: ` ✗ no element carries data-ds="${table.slug}"`));
|
|
412
|
+
if (wiring.fontsWritten) {
|
|
413
|
+
console.log(body(wiring.fontsMapped
|
|
414
|
+
? " ✓ the type from fonts.ts is mapped onto the system"
|
|
415
|
+
: " ✗ fonts.ts exists but nothing maps it - the system's type is not being used"));
|
|
416
|
+
}
|
|
392
417
|
console.log("");
|
|
393
|
-
|
|
394
|
-
|
|
418
|
+
// Three requirements now, and they fail differently. Missing the import or
|
|
419
|
+
// the scope means NOTHING reaches the browser and the number below is
|
|
420
|
+
// noise. Missing only the type mapping means colour and spacing are
|
|
421
|
+
// working and the faces are not - saying "nothing reaches the browser"
|
|
422
|
+
// there would be false, and a report that overstates is one nobody trusts
|
|
423
|
+
// the next time.
|
|
424
|
+
const blocked = !wiring.imported || !wiring.scoped;
|
|
425
|
+
if (blocked) {
|
|
426
|
+
console.log(body(`Until the first two are true, none of the ${table.byName.size} tokens reach the`));
|
|
427
|
+
console.log(body("browser and the number below cannot mean anything."));
|
|
428
|
+
}
|
|
429
|
+
else {
|
|
430
|
+
console.log(body("Colour and spacing are working. Type is not: the system's faces"));
|
|
431
|
+
console.log(body("are declared and nothing points at them, so the page renders in"));
|
|
432
|
+
console.log(body("whatever the framework picked."));
|
|
433
|
+
}
|
|
395
434
|
console.log(body("The exact snippets are in the output of `init`."));
|
|
396
435
|
}
|
|
397
436
|
if (hasSystem && measurable) {
|
package/package.json
CHANGED