@kinetixui/cli 0.13.0 → 0.14.0
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 +45 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import { Command } from "commander";
|
|
5
|
-
import
|
|
5
|
+
import pc7 from "picocolors";
|
|
6
6
|
|
|
7
7
|
// src/commands/add.ts
|
|
8
8
|
import { existsSync as existsSync4 } from "fs";
|
|
@@ -428,10 +428,40 @@ async function list(options) {
|
|
|
428
428
|
console.log(`Add everything: ${pc5.cyan("npx @kinetixui/cli add --all")}`);
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
+
// src/commands/parity.ts
|
|
432
|
+
import pc6 from "picocolors";
|
|
433
|
+
var PLATFORMS = ["React", "SwiftUI", "Compose", "Flutter"];
|
|
434
|
+
var PLATFORM_ABBR = {
|
|
435
|
+
React: "RE",
|
|
436
|
+
SwiftUI: "SW",
|
|
437
|
+
Compose: "JC",
|
|
438
|
+
Flutter: "FL"
|
|
439
|
+
};
|
|
440
|
+
async function parity(names, options) {
|
|
441
|
+
const items = await fetchRegistryIndex(options.registry);
|
|
442
|
+
const components = items.filter((item) => item.type === "registry:ui").sort((a, b) => a.name.localeCompare(b.name));
|
|
443
|
+
const rows = names.length ? names.map((name) => {
|
|
444
|
+
const item = components.find((c) => c.name === name);
|
|
445
|
+
if (!item) throw new Error(`"${name}" isn't in the registry. Run "kinetixui list" to see what's available.`);
|
|
446
|
+
return item;
|
|
447
|
+
}) : components;
|
|
448
|
+
const nameWidth = Math.max(9, ...rows.map((r) => r.name.length));
|
|
449
|
+
const header = `${"COMPONENT".padEnd(nameWidth)} ${PLATFORMS.map((p) => PLATFORM_ABBR[p]).join(" ")} STATUS`;
|
|
450
|
+
console.log(pc6.dim(header));
|
|
451
|
+
for (const item of rows) {
|
|
452
|
+
const on = new Set(item.platforms ?? PLATFORMS);
|
|
453
|
+
const marks = PLATFORMS.map((p) => on.has(p) ? pc6.green("\u2713 ") : pc6.dim("\u2014 "));
|
|
454
|
+
const status = item.status ? pc6.yellow(item.status) : "";
|
|
455
|
+
console.log(`${item.name.padEnd(nameWidth)} ${marks.join(" ")} ${status}`);
|
|
456
|
+
}
|
|
457
|
+
console.log();
|
|
458
|
+
console.log(`${rows.length} of ${components.length} component(s) shown.`);
|
|
459
|
+
}
|
|
460
|
+
|
|
431
461
|
// package.json
|
|
432
462
|
var package_default = {
|
|
433
463
|
name: "@kinetixui/cli",
|
|
434
|
-
version: "0.
|
|
464
|
+
version: "0.14.0",
|
|
435
465
|
description: "Add KinetixUI components and tokens to your project.",
|
|
436
466
|
type: "module",
|
|
437
467
|
license: "MIT",
|
|
@@ -475,7 +505,7 @@ program.command("init").description("Set up kinetixui.json and pull in the token
|
|
|
475
505
|
try {
|
|
476
506
|
await init({ registry: opts.registry, yes: opts.yes });
|
|
477
507
|
} catch (err) {
|
|
478
|
-
console.error(
|
|
508
|
+
console.error(pc7.red("\u2716"), err.message);
|
|
479
509
|
process.exitCode = 1;
|
|
480
510
|
}
|
|
481
511
|
});
|
|
@@ -483,7 +513,7 @@ program.command("add").description("Add one or more components to your project."
|
|
|
483
513
|
try {
|
|
484
514
|
await add(components, { registry: opts.registry, overwrite: opts.overwrite, all: opts.all });
|
|
485
515
|
} catch (err) {
|
|
486
|
-
console.error(
|
|
516
|
+
console.error(pc7.red("\u2716"), err.message);
|
|
487
517
|
process.exitCode = 1;
|
|
488
518
|
}
|
|
489
519
|
});
|
|
@@ -491,7 +521,7 @@ program.command("list").description("List every component available in the regis
|
|
|
491
521
|
try {
|
|
492
522
|
await list({ registry: opts.registry });
|
|
493
523
|
} catch (err) {
|
|
494
|
-
console.error(
|
|
524
|
+
console.error(pc7.red("\u2716"), err.message);
|
|
495
525
|
process.exitCode = 1;
|
|
496
526
|
}
|
|
497
527
|
});
|
|
@@ -499,7 +529,15 @@ program.command("inspect").description("Show everything the registry knows about
|
|
|
499
529
|
try {
|
|
500
530
|
await inspect(name, { registry: opts.registry });
|
|
501
531
|
} catch (err) {
|
|
502
|
-
console.error(
|
|
532
|
+
console.error(pc7.red("\u2716"), err.message);
|
|
533
|
+
process.exitCode = 1;
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
program.command("parity").description("Show which platforms carry each component (or one, by name).").argument("[components...]", "component names, e.g. button card \u2014 omit for the full matrix").option("-r, --registry <url>", "registry base URL", DEFAULT_REGISTRY).action(async (components, opts) => {
|
|
537
|
+
try {
|
|
538
|
+
await parity(components, { registry: opts.registry });
|
|
539
|
+
} catch (err) {
|
|
540
|
+
console.error(pc7.red("\u2716"), err.message);
|
|
503
541
|
process.exitCode = 1;
|
|
504
542
|
}
|
|
505
543
|
});
|
|
@@ -507,7 +545,7 @@ program.command("doctor").description("Check kinetixui.json, its aliases, and th
|
|
|
507
545
|
try {
|
|
508
546
|
await doctor();
|
|
509
547
|
} catch (err) {
|
|
510
|
-
console.error(
|
|
548
|
+
console.error(pc7.red("\u2716"), err.message);
|
|
511
549
|
process.exitCode = 1;
|
|
512
550
|
}
|
|
513
551
|
});
|