@mutmutco/installer-face 0.2.0 → 0.2.1
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/index.js +9 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -118,9 +118,10 @@ function createFace({ product, color = false, columns }) {
|
|
|
118
118
|
const content = Math.min(width - 6, Math.max(...body.map(visibleWidth)));
|
|
119
119
|
const rule = paint(identity.accent, GLYPH.rule.repeat(content + 4));
|
|
120
120
|
const frame = (left, right) => `${paint(identity.accent, left)}${rule}${paint(identity.accent, right)}`;
|
|
121
|
+
const bodyRow = (line) => line.startsWith(GLYPH.check) ? `${paint(PALETTE.green, GLYPH.check)}${line.slice(1)}` : line;
|
|
121
122
|
return [
|
|
122
123
|
frame(GLYPH.boxTop, GLYPH.boxTopEnd),
|
|
123
|
-
...body.map((line) => `${paint(identity.accent, GLYPH.bar)} ${line}${" ".repeat(Math.max(0, content - visibleWidth(line)))} ${paint(identity.accent, GLYPH.bar)}`),
|
|
124
|
+
...body.map((line) => `${paint(identity.accent, GLYPH.bar)} ${bodyRow(line)}${" ".repeat(Math.max(0, content - visibleWidth(line)))} ${paint(identity.accent, GLYPH.bar)}`),
|
|
124
125
|
frame(GLYPH.boxBottom, GLYPH.boxBottomEnd)
|
|
125
126
|
];
|
|
126
127
|
};
|
|
@@ -391,8 +392,8 @@ function renderRows(face, rows) {
|
|
|
391
392
|
const body = `${clip(subject, column).padEnd(column)} ${row.mark ? `${markGlyph(face, row.mark)} ` : ""}${tail}`;
|
|
392
393
|
lines.push(...face.relay(body).split("\n"));
|
|
393
394
|
if (row.note) {
|
|
394
|
-
for (const part of wrapWords(row.note, Math.max(16, face.width -
|
|
395
|
-
lines.push(...face.relay(
|
|
395
|
+
for (const part of wrapWords(row.note, Math.max(16, face.width - TITLE_COLUMN))) {
|
|
396
|
+
lines.push(...face.relay(part).split("\n"));
|
|
396
397
|
}
|
|
397
398
|
}
|
|
398
399
|
}
|
|
@@ -461,6 +462,9 @@ function assertFaceConformance(lines, options) {
|
|
|
461
462
|
const width = options.columns ?? 100;
|
|
462
463
|
const rendered = lines.flatMap((line) => String(line).split("\n"));
|
|
463
464
|
const plain = rendered.map(stripColor);
|
|
465
|
+
const head = plain[0] ?? "";
|
|
466
|
+
const signOffLine = `${GLYPH.diamond} ${identity.name} \xB7 Mutatis Mutandis`;
|
|
467
|
+
const opensWithWelcome = head.startsWith(GLYPH.diamond) && head !== signOffLine;
|
|
464
468
|
if (rendered.length === 0) fail("R7 render before you ship", "no rendered lines were given to the guard");
|
|
465
469
|
if (options.tty === false) {
|
|
466
470
|
for (const line of plain) {
|
|
@@ -494,7 +498,7 @@ function assertFaceConformance(lines, options) {
|
|
|
494
498
|
if (widths.size !== 1) fail("R5 receipt frame", `the box is ragged: widths ${[...widths].join(", ")}`);
|
|
495
499
|
}
|
|
496
500
|
const inReceipt = (index) => top !== -1 && index >= top && index <= plain.findIndex((line, at) => at > top && line.startsWith(GLYPH.boxBottom));
|
|
497
|
-
const welcomeEnd =
|
|
501
|
+
const welcomeEnd = opensWithWelcome ? 4 : 0;
|
|
498
502
|
for (const [index, line] of plain.entries()) {
|
|
499
503
|
if (index < welcomeEnd || inReceipt(index)) continue;
|
|
500
504
|
if (!line.startsWith(GLYPH.bar) || line.trim() === GLYPH.bar) continue;
|
|
@@ -522,8 +526,7 @@ function assertFaceConformance(lines, options) {
|
|
|
522
526
|
fail("width cap", `a line is ${visibleWidth(line)} columns wide, cap ${width}: ${JSON.stringify(line)}`);
|
|
523
527
|
}
|
|
524
528
|
}
|
|
525
|
-
|
|
526
|
-
if (head.startsWith(GLYPH.diamond)) {
|
|
529
|
+
if (opensWithWelcome) {
|
|
527
530
|
const expected = `${GLYPH.diamond} ${identity.name} \u2014 Mutatis Mutandis`;
|
|
528
531
|
if (head !== expected) fail("welcome is the product table's", `expected ${JSON.stringify(expected)}, got ${JSON.stringify(head)}`);
|
|
529
532
|
const warm = plain.slice(1, 4).find((line) => line.includes(identity.warm));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mutmutco/installer-face",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "The MM Terminal Line installer face: one renderer, the canonical product table, shell/PowerShell fragments for served one-liners, and the drift guard every surface runs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|