MCPcopy Create free account
hub / github.com/dailydotdev/apps / printReport

Function printReport

packages/world-cli/src/report.js:22–62  ·  view source on GitHub ↗
(r, { json, file })

Source from the content-addressed store, hash-verified

20const OFF = c(0);
21
22export function printReport(r, { json, file }) {
23 if (json) {
24 const { tiers, variants, ...rest } = r;
25 process.stdout.write(
26 `${JSON.stringify({
27 ...rest,
28 tierCount: tiers ? Object.keys(tiers).length : undefined,
29 variantCount:
30 variants?.length ??
31 (tiers ? Object.values(tiers)[0]?.length ?? 0 : 0),
32 }, null, 2)}\n`,
33 );
34 return;
35 }
36
37 const head = r.ok ? `${GRN}PASS${OFF}` : `${RED}FAIL${OFF}`;
38 const target = r.niche || 'entire realm';
39 const level = r.level ? ` - level ${r.level}` : ' - all tiers';
40 process.stdout.write(
41 `\n${head} ${file} ${DIM}${r.realm}/${target} - ${r.family}${level}${OFF}\n`,
42 );
43
44 if (r.budget) {
45 process.stdout.write(`${DIM}tier ${r.tier}, envelope ${r.budget.envelope.join(' x ')}${OFF}\n`);
46 }
47 if (r.usage) {
48 process.stdout.write(
49 `${DIM}shapes ${r.usage.ops}, triangles ${r.usage.triangles}, glow ${r.usage.glow}${OFF}\n`,
50 );
51 }
52 if (r.geometry) {
53 const g = r.geometry;
54 process.stdout.write(
55 `${DIM}size ${g.size.join(' x ')}, base y ${g.base}, fitted to ${Math.round(g.fit * 100)}%${OFF}\n`,
56 );
57 }
58
59 for (const e of r.errors ?? []) process.stdout.write(`${RED} error${OFF} ${e}\n`);
60 for (const w of r.warnings ?? []) process.stdout.write(`${YEL} warn ${OFF} ${w}\n`);
61 process.stdout.write('\n');
62}

Callers 2

installFunction · 0.90
runCheckFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected