@contentful/experience-design-system-cli 2.37.1-dev-build-cf4224ad.0 → 2.37.1-dev-build-6935af44.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/app.js +149 -442
- package/dist/index.js +160 -483
- package/dist/package.json +1 -1
- package/dist/src/tui/import/steps/index.d.ts +0 -1
- package/legacy/package.json +1 -1
- package/package.json +2 -2
- package/dist/src/tui/import/resolve-user-path.d.ts +0 -1
- package/dist/src/tui/import/steps/03-path-validation/controls.d.ts +0 -13
- package/dist/src/tui/import/steps/03-path-validation/loader.d.ts +0 -2
- package/dist/src/tui/import/steps/03-path-validation/logic.d.ts +0 -42
- package/dist/src/tui/import/steps/03-path-validation/screen.d.ts +0 -9
package/dist/app.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// packages/experience-design-system-cli/app.tsx
|
|
2
|
-
import { useEffect as
|
|
2
|
+
import { useEffect as useEffect8, useState as useState11 } from "react";
|
|
3
3
|
|
|
4
4
|
// packages/experience-design-system-cli/src/tui/home/home.tsx
|
|
5
5
|
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
@@ -349,8 +349,6 @@ function useTokenInputControls(onBack) {
|
|
|
349
349
|
|
|
350
350
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts
|
|
351
351
|
import { statSync } from "node:fs";
|
|
352
|
-
|
|
353
|
-
// packages/experience-design-system-cli/src/tui/import/resolve-user-path.ts
|
|
354
352
|
import { homedir } from "node:os";
|
|
355
353
|
import { resolve } from "node:path";
|
|
356
354
|
function stripQuotes(value) {
|
|
@@ -360,13 +358,8 @@ function stripQuotes(value) {
|
|
|
360
358
|
function expandHome(value) {
|
|
361
359
|
return value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? homedir() + value.slice(1) : value;
|
|
362
360
|
}
|
|
363
|
-
function resolveUserPath(raw) {
|
|
364
|
-
return resolve(expandHome(stripQuotes(raw.trim())));
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts
|
|
368
361
|
function validateTokenPath(rawPath) {
|
|
369
|
-
const path =
|
|
362
|
+
const path = resolve(expandHome(stripQuotes(rawPath.trim())));
|
|
370
363
|
let stats;
|
|
371
364
|
try {
|
|
372
365
|
stats = statSync(path);
|
|
@@ -435,288 +428,18 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
|
|
|
435
428
|
] });
|
|
436
429
|
}
|
|
437
430
|
|
|
438
|
-
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
|
|
439
|
-
import { useEffect as useEffect3, useMemo, useState as useState5 } from "react";
|
|
440
|
-
import { Box as Box5, Text as Text6 } from "ink";
|
|
441
|
-
|
|
442
|
-
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/controls.ts
|
|
443
|
-
import { useInput as useInput5 } from "ink";
|
|
444
|
-
|
|
445
|
-
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/logic.ts
|
|
446
|
-
var IGNORED_DIRECTORIES = /* @__PURE__ */ new Set([
|
|
447
|
-
"node_modules",
|
|
448
|
-
"dist",
|
|
449
|
-
"build",
|
|
450
|
-
".next",
|
|
451
|
-
".nuxt",
|
|
452
|
-
"coverage",
|
|
453
|
-
"storybook-static",
|
|
454
|
-
"out",
|
|
455
|
-
".git"
|
|
456
|
-
]);
|
|
457
|
-
var CATEGORY_BY_EXTENSION = /* @__PURE__ */ new Map([
|
|
458
|
-
["tsx", "tsx"],
|
|
459
|
-
["ts", "ts"],
|
|
460
|
-
["vue", "vue"],
|
|
461
|
-
["astro", "astro"],
|
|
462
|
-
["jsx", "jsx"],
|
|
463
|
-
["js", "js"],
|
|
464
|
-
["json", "json"]
|
|
465
|
-
]);
|
|
466
|
-
var COMPONENT_CATEGORIES = ["tsx", "ts", "vue", "astro", "jsx", "js"];
|
|
467
|
-
var ROW_LABELS = {
|
|
468
|
-
tsx: ".tsx files",
|
|
469
|
-
ts: ".ts files",
|
|
470
|
-
vue: ".vue files",
|
|
471
|
-
astro: ".astro files",
|
|
472
|
-
jsx: ".jsx files",
|
|
473
|
-
js: ".js files",
|
|
474
|
-
json: ".json files (design tokens)",
|
|
475
|
-
other: "other (ignored)"
|
|
476
|
-
};
|
|
477
|
-
var ROW_ORDER = ["tsx", "ts", "vue", "astro", "jsx", "js", "json", "other"];
|
|
478
|
-
function categorize(fileName) {
|
|
479
|
-
if (fileName.endsWith(".d.ts")) return "other";
|
|
480
|
-
const dot = fileName.lastIndexOf(".");
|
|
481
|
-
const extension = dot === -1 ? "" : fileName.slice(dot + 1);
|
|
482
|
-
return CATEGORY_BY_EXTENSION.get(extension) ?? "other";
|
|
483
|
-
}
|
|
484
|
-
function emptyCounts() {
|
|
485
|
-
return { tsx: 0, ts: 0, vue: 0, astro: 0, jsx: 0, js: 0, json: 0, other: 0, total: 0 };
|
|
486
|
-
}
|
|
487
|
-
function addFile(counts, fileName) {
|
|
488
|
-
const category = categorize(fileName);
|
|
489
|
-
return { ...counts, [category]: counts[category] + 1, total: counts.total + 1 };
|
|
490
|
-
}
|
|
491
|
-
function mergeCounts(a, b) {
|
|
492
|
-
return {
|
|
493
|
-
tsx: a.tsx + b.tsx,
|
|
494
|
-
ts: a.ts + b.ts,
|
|
495
|
-
vue: a.vue + b.vue,
|
|
496
|
-
astro: a.astro + b.astro,
|
|
497
|
-
jsx: a.jsx + b.jsx,
|
|
498
|
-
js: a.js + b.js,
|
|
499
|
-
json: a.json + b.json,
|
|
500
|
-
other: a.other + b.other,
|
|
501
|
-
total: a.total + b.total
|
|
502
|
-
};
|
|
503
|
-
}
|
|
504
|
-
function failureFromErrorCode(code) {
|
|
505
|
-
if (code === "ENOENT") return "not-found";
|
|
506
|
-
if (code === "EACCES") return "permission-denied";
|
|
507
|
-
return "unreadable";
|
|
508
|
-
}
|
|
509
|
-
function describeFailure(failure, path) {
|
|
510
|
-
switch (failure) {
|
|
511
|
-
case "is-file":
|
|
512
|
-
return {
|
|
513
|
-
headline: "That's a file, not a directory.",
|
|
514
|
-
hints: [
|
|
515
|
-
"Provide the path to your component library's root folder, not a specific file.",
|
|
516
|
-
"Example: ~/projects/my-design-system"
|
|
517
|
-
]
|
|
518
|
-
};
|
|
519
|
-
case "not-found":
|
|
520
|
-
return {
|
|
521
|
-
headline: `Directory not found: ${path}`,
|
|
522
|
-
hints: ["Double-check the path and try again. Tip: you can use ~, relative, or absolute paths."]
|
|
523
|
-
};
|
|
524
|
-
case "permission-denied":
|
|
525
|
-
return {
|
|
526
|
-
headline: `Permission denied: ${path}`,
|
|
527
|
-
hints: ["You don't have read access to this directory."]
|
|
528
|
-
};
|
|
529
|
-
case "not-directory":
|
|
530
|
-
return { headline: `Not a directory: ${path}`, hints: [] };
|
|
531
|
-
case "unreadable":
|
|
532
|
-
return { headline: `Cannot access: ${path}`, hints: [] };
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
function summarize(counts) {
|
|
536
|
-
const rows = ROW_ORDER.filter((category) => counts[category] > 0).map((category) => {
|
|
537
|
-
const tone = category === "json" ? "accent" : category === "other" ? "muted" : "default";
|
|
538
|
-
return { label: ROW_LABELS[category], count: counts[category], tone };
|
|
539
|
-
});
|
|
540
|
-
const componentFiles = COMPONENT_CATEGORIES.reduce((sum, category) => sum + counts[category], 0);
|
|
541
|
-
if (componentFiles > 0) return { total: counts.total, rows };
|
|
542
|
-
if (counts.json > 0) {
|
|
543
|
-
return { total: counts.total, rows, warning: "No component files found \u2014 only token files detected." };
|
|
544
|
-
}
|
|
545
|
-
return {
|
|
546
|
-
total: counts.total,
|
|
547
|
-
rows,
|
|
548
|
-
warning: "No component or token files found. Try a different path."
|
|
549
|
-
};
|
|
550
|
-
}
|
|
551
|
-
function phaseOf(scan) {
|
|
552
|
-
if (scan === void 0) return "scanning";
|
|
553
|
-
return scan.ok ? "ready" : "failed";
|
|
554
|
-
}
|
|
555
|
-
function keyAction(phase, input, key) {
|
|
556
|
-
if (key.escape) return "back";
|
|
557
|
-
if (phase === "ready") {
|
|
558
|
-
if (key.return) return "confirm";
|
|
559
|
-
if (input === "e") return "change-path";
|
|
560
|
-
}
|
|
561
|
-
if (phase === "failed" && (key.return || input === "e")) return "change-path";
|
|
562
|
-
return void 0;
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/controls.ts
|
|
566
|
-
var CONTROLS = {
|
|
567
|
-
scanning: [{ keys: "Esc", label: "Back" }],
|
|
568
|
-
ready: [
|
|
569
|
-
{ keys: "Enter", label: "Yes, continue" },
|
|
570
|
-
{ keys: "e", label: "Change path" },
|
|
571
|
-
{ keys: "Esc", label: "Back" }
|
|
572
|
-
],
|
|
573
|
-
failed: [
|
|
574
|
-
{ keys: "Enter/e", label: "Try a different path" },
|
|
575
|
-
{ keys: "Esc", label: "Back" }
|
|
576
|
-
]
|
|
577
|
-
};
|
|
578
|
-
function controlsFor(phase) {
|
|
579
|
-
return CONTROLS[phase];
|
|
580
|
-
}
|
|
581
|
-
function usePathValidationControls(phase, handlers) {
|
|
582
|
-
useInput5((input, key) => {
|
|
583
|
-
const action = keyAction(phase, input, key);
|
|
584
|
-
if (action === "confirm") handlers.onConfirm();
|
|
585
|
-
else if (action === "change-path") handlers.onChangePath();
|
|
586
|
-
else if (action === "back") handlers.onBack();
|
|
587
|
-
});
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/loader.ts
|
|
591
|
-
import { readdir, stat } from "node:fs/promises";
|
|
592
|
-
import { join as join3 } from "node:path";
|
|
593
|
-
async function isFile(path) {
|
|
594
|
-
try {
|
|
595
|
-
return (await stat(path)).isFile();
|
|
596
|
-
} catch {
|
|
597
|
-
return false;
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
async function countEntry(directory, entry) {
|
|
601
|
-
const path = join3(directory, entry.name);
|
|
602
|
-
if (entry.isDirectory()) return countFiles(path);
|
|
603
|
-
if (entry.isFile() || entry.isSymbolicLink() && await isFile(path)) return addFile(emptyCounts(), entry.name);
|
|
604
|
-
return emptyCounts();
|
|
605
|
-
}
|
|
606
|
-
async function countFiles(directory) {
|
|
607
|
-
let entries;
|
|
608
|
-
try {
|
|
609
|
-
entries = await readdir(directory, { withFileTypes: true });
|
|
610
|
-
} catch {
|
|
611
|
-
return emptyCounts();
|
|
612
|
-
}
|
|
613
|
-
const counts = await Promise.all(
|
|
614
|
-
entries.filter((entry) => !IGNORED_DIRECTORIES.has(entry.name)).map((entry) => countEntry(directory, entry))
|
|
615
|
-
);
|
|
616
|
-
return counts.reduce(mergeCounts, emptyCounts());
|
|
617
|
-
}
|
|
618
|
-
async function scanProject(directory) {
|
|
619
|
-
try {
|
|
620
|
-
const stats = await stat(directory);
|
|
621
|
-
if (stats.isFile()) return { ok: false, failure: "is-file" };
|
|
622
|
-
if (!stats.isDirectory()) return { ok: false, failure: "not-directory" };
|
|
623
|
-
} catch (error) {
|
|
624
|
-
return { ok: false, failure: failureFromErrorCode(error.code) };
|
|
625
|
-
}
|
|
626
|
-
return { ok: true, counts: await countFiles(directory) };
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
|
|
630
|
-
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
631
|
-
function Row({ row }) {
|
|
632
|
-
return /* @__PURE__ */ jsxs5(Text6, { color: row.tone === "accent" ? PALETTE.accent : void 0, dimColor: row.tone === "muted", children: [
|
|
633
|
-
" \u2022 ",
|
|
634
|
-
String(row.count).padStart(3),
|
|
635
|
-
" ",
|
|
636
|
-
row.label
|
|
637
|
-
] });
|
|
638
|
-
}
|
|
639
|
-
function Failure({ scan, path }) {
|
|
640
|
-
const { headline, hints } = describeFailure(scan.failure, path);
|
|
641
|
-
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
|
|
642
|
-
/* @__PURE__ */ jsxs5(Text6, { color: PALETTE.error, children: [
|
|
643
|
-
"\u2717 ",
|
|
644
|
-
headline
|
|
645
|
-
] }),
|
|
646
|
-
hints.map((hint) => /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: hint }, hint))
|
|
647
|
-
] });
|
|
648
|
-
}
|
|
649
|
-
function Summary({ scan, path }) {
|
|
650
|
-
const { total, rows, warning } = summarize(scan.counts);
|
|
651
|
-
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", gap: 1, children: [
|
|
652
|
-
/* @__PURE__ */ jsxs5(Text6, { children: [
|
|
653
|
-
"Scanned ",
|
|
654
|
-
/* @__PURE__ */ jsx6(Text6, { bold: true, children: path })
|
|
655
|
-
] }),
|
|
656
|
-
/* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
|
|
657
|
-
/* @__PURE__ */ jsxs5(Text6, { color: PALETTE.success, children: [
|
|
658
|
-
"\u2713 Found ",
|
|
659
|
-
total,
|
|
660
|
-
" files:"
|
|
661
|
-
] }),
|
|
662
|
-
rows.map((row) => /* @__PURE__ */ jsx6(Row, { row }, row.label))
|
|
663
|
-
] }),
|
|
664
|
-
warning && /* @__PURE__ */ jsxs5(Text6, { color: PALETTE.warning, children: [
|
|
665
|
-
"\u26A0 ",
|
|
666
|
-
warning
|
|
667
|
-
] }),
|
|
668
|
-
/* @__PURE__ */ jsx6(Text6, { children: "Does this look right?" })
|
|
669
|
-
] });
|
|
670
|
-
}
|
|
671
|
-
function PathValidationScreen({
|
|
672
|
-
projectPath,
|
|
673
|
-
onConfirm,
|
|
674
|
-
onChangePath,
|
|
675
|
-
onBack
|
|
676
|
-
}) {
|
|
677
|
-
const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
|
|
678
|
-
const [scan, setScan] = useState5();
|
|
679
|
-
useEffect3(() => {
|
|
680
|
-
let cancelled = false;
|
|
681
|
-
setScan(void 0);
|
|
682
|
-
void scanProject(resolvedPath).then((result) => {
|
|
683
|
-
if (!cancelled) setScan(result);
|
|
684
|
-
});
|
|
685
|
-
return () => {
|
|
686
|
-
cancelled = true;
|
|
687
|
-
};
|
|
688
|
-
}, [resolvedPath]);
|
|
689
|
-
const phase = phaseOf(scan);
|
|
690
|
-
usePathValidationControls(phase, { onConfirm: () => onConfirm(resolvedPath), onChangePath, onBack });
|
|
691
|
-
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
692
|
-
scan === void 0 && /* @__PURE__ */ jsxs5(Text6, { dimColor: true, children: [
|
|
693
|
-
"Scanning ",
|
|
694
|
-
/* @__PURE__ */ jsx6(Text6, { bold: true, children: resolvedPath }),
|
|
695
|
-
"..."
|
|
696
|
-
] }),
|
|
697
|
-
scan?.ok === false && /* @__PURE__ */ jsx6(Failure, { scan, path: resolvedPath }),
|
|
698
|
-
scan?.ok === true && /* @__PURE__ */ jsx6(Summary, { scan, path: resolvedPath }),
|
|
699
|
-
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, gap: 3, children: controlsFor(phase).map((control) => /* @__PURE__ */ jsxs5(Text6, { dimColor: true, children: [
|
|
700
|
-
"[",
|
|
701
|
-
control.keys,
|
|
702
|
-
"] ",
|
|
703
|
-
control.label
|
|
704
|
-
] }, control.keys)) })
|
|
705
|
-
] });
|
|
706
|
-
}
|
|
707
|
-
|
|
708
431
|
// packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts
|
|
709
432
|
import { spawn } from "node:child_process";
|
|
710
433
|
|
|
711
434
|
// packages/experience-design-system-cli/src/legacy/legacy-cli-path.ts
|
|
712
435
|
import { existsSync as existsSync2 } from "node:fs";
|
|
713
|
-
import { join as
|
|
436
|
+
import { join as join3 } from "node:path";
|
|
714
437
|
var PACKAGE_NAME2 = "@contentful/experience-design-system-cli";
|
|
715
438
|
function findLegacyCliPath() {
|
|
716
439
|
const root = findPackageRoot(import.meta.url, PACKAGE_NAME2);
|
|
717
440
|
const candidates = [
|
|
718
|
-
|
|
719
|
-
|
|
441
|
+
join3(root, "legacy", "bin", "cli.js"),
|
|
442
|
+
join3(root, "..", "experience-design-system-cli-legacy", "bin", "cli.js")
|
|
720
443
|
];
|
|
721
444
|
const found = candidates.find((candidate) => existsSync2(candidate));
|
|
722
445
|
if (!found) {
|
|
@@ -772,24 +495,24 @@ function startReadingTerminal() {
|
|
|
772
495
|
}
|
|
773
496
|
|
|
774
497
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
775
|
-
import { useEffect as
|
|
776
|
-
import { Box as
|
|
498
|
+
import { useEffect as useEffect3, useState as useState5 } from "react";
|
|
499
|
+
import { Box as Box5, Text as Text6, useInput as useInput5 } from "ink";
|
|
777
500
|
|
|
778
501
|
// packages/experience-design-system-cli/src/tui/debug-store.ts
|
|
779
502
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
780
503
|
import { existsSync as existsSync3, readdirSync } from "node:fs";
|
|
781
|
-
import { join as
|
|
504
|
+
import { join as join5 } from "node:path";
|
|
782
505
|
|
|
783
506
|
// packages/experience-design-system-types/dist/src/config/index.js
|
|
784
507
|
import { randomBytes } from "node:crypto";
|
|
785
508
|
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
786
509
|
import { homedir as homedir2 } from "node:os";
|
|
787
|
-
import { dirname as dirname2, join as
|
|
510
|
+
import { dirname as dirname2, join as join4 } from "node:path";
|
|
788
511
|
function configRoot() {
|
|
789
|
-
return process.env["EDS_HOME"] ||
|
|
512
|
+
return process.env["EDS_HOME"] || join4(homedir2(), ".contentful", "experience-design-system-cli");
|
|
790
513
|
}
|
|
791
|
-
var configFilePath = () =>
|
|
792
|
-
var debugSessionsDir = () =>
|
|
514
|
+
var configFilePath = () => join4(configRoot(), "config.json");
|
|
515
|
+
var debugSessionsDir = () => join4(configRoot(), "debug", "sessions");
|
|
793
516
|
async function readSettings() {
|
|
794
517
|
try {
|
|
795
518
|
return JSON.parse(await readFile(configFilePath(), "utf8"));
|
|
@@ -848,7 +571,7 @@ function generateSessionId() {
|
|
|
848
571
|
}
|
|
849
572
|
var SESSION_ID = generateSessionId();
|
|
850
573
|
function sessionDebugDir() {
|
|
851
|
-
return
|
|
574
|
+
return join5(debugSessionsDir(), SESSION_ID);
|
|
852
575
|
}
|
|
853
576
|
function currentDebugSessionDir() {
|
|
854
577
|
return sessionDebugDir();
|
|
@@ -897,10 +620,10 @@ async function finishDebugRun({
|
|
|
897
620
|
const durationMs = Date.now() - run.startedAt;
|
|
898
621
|
const content = renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs });
|
|
899
622
|
const flowSegments = run.flow.split("/");
|
|
900
|
-
const dir =
|
|
623
|
+
const dir = join5(sessionDebugDir(), ...flowSegments);
|
|
901
624
|
await mkdir2(dir, { recursive: true });
|
|
902
625
|
const filename = nextAttemptFilename(dir, run.menuOption);
|
|
903
|
-
await writeFile2(
|
|
626
|
+
await writeFile2(join5(dir, filename), content, { mode: 384 });
|
|
904
627
|
}
|
|
905
628
|
function nextAttemptFilename(dir, menuOption) {
|
|
906
629
|
const today = datePrefix();
|
|
@@ -983,19 +706,19 @@ async function readHelpInfo() {
|
|
|
983
706
|
}
|
|
984
707
|
|
|
985
708
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
986
|
-
import { Fragment, jsx as
|
|
709
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
987
710
|
function Section({ title, rows }) {
|
|
988
|
-
return /* @__PURE__ */
|
|
989
|
-
/* @__PURE__ */
|
|
990
|
-
rows.map((row) => /* @__PURE__ */
|
|
991
|
-
/* @__PURE__ */
|
|
992
|
-
/* @__PURE__ */
|
|
711
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
|
|
712
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, color: PALETTE.accent, children: title }),
|
|
713
|
+
rows.map((row) => /* @__PURE__ */ jsxs5(Box5, { gap: 1, children: [
|
|
714
|
+
/* @__PURE__ */ jsx6(Box5, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: row.label }) }),
|
|
715
|
+
/* @__PURE__ */ jsx6(Text6, { children: row.value })
|
|
993
716
|
] }, row.label))
|
|
994
717
|
] });
|
|
995
718
|
}
|
|
996
719
|
function HelpScreen({ onDone }) {
|
|
997
|
-
const [info, setInfo] =
|
|
998
|
-
|
|
720
|
+
const [info, setInfo] = useState5();
|
|
721
|
+
useEffect3(() => {
|
|
999
722
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
1000
723
|
void readHelpInfo().then(setInfo);
|
|
1001
724
|
}, []);
|
|
@@ -1003,7 +726,7 @@ function HelpScreen({ onDone }) {
|
|
|
1003
726
|
void finishDebugRun({ outputs: {}, status: "success", exitMethod });
|
|
1004
727
|
onDone();
|
|
1005
728
|
};
|
|
1006
|
-
|
|
729
|
+
useInput5((input, key) => {
|
|
1007
730
|
if (key.return) {
|
|
1008
731
|
leave("saved");
|
|
1009
732
|
return;
|
|
@@ -1013,14 +736,14 @@ function HelpScreen({ onDone }) {
|
|
|
1013
736
|
return;
|
|
1014
737
|
}
|
|
1015
738
|
});
|
|
1016
|
-
return /* @__PURE__ */
|
|
1017
|
-
/* @__PURE__ */
|
|
1018
|
-
info ? /* @__PURE__ */
|
|
1019
|
-
/* @__PURE__ */
|
|
1020
|
-
/* @__PURE__ */
|
|
1021
|
-
/* @__PURE__ */
|
|
1022
|
-
] }) : /* @__PURE__ */
|
|
1023
|
-
/* @__PURE__ */
|
|
739
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", paddingX: 2, paddingY: 1, gap: 1, children: [
|
|
740
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: "Help" }),
|
|
741
|
+
info ? /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
742
|
+
/* @__PURE__ */ jsx6(Section, { title: "Where things are stored", rows: info.storage }),
|
|
743
|
+
/* @__PURE__ */ jsx6(Section, { title: "Troubleshooting", rows: info.troubleshooting }),
|
|
744
|
+
/* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "Hit a problem? Turn on Debug Mode in Settings, reproduce it, then share the session folder above. The CMA token is redacted from those logs." })
|
|
745
|
+
] }) : /* @__PURE__ */ jsx6(Text6, { color: PALETTE.accent, children: "Loading..." }),
|
|
746
|
+
/* @__PURE__ */ jsx6(
|
|
1024
747
|
ControlHints,
|
|
1025
748
|
{
|
|
1026
749
|
hints: [
|
|
@@ -1033,20 +756,20 @@ function HelpScreen({ onDone }) {
|
|
|
1033
756
|
}
|
|
1034
757
|
|
|
1035
758
|
// packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
|
|
1036
|
-
import { useState as
|
|
1037
|
-
import { Box as
|
|
1038
|
-
import { jsx as
|
|
759
|
+
import { useState as useState6 } from "react";
|
|
760
|
+
import { Box as Box6, Text as Text7, useInput as useInput6 } from "ink";
|
|
761
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1039
762
|
function SettingsScreen({
|
|
1040
763
|
onNavigate,
|
|
1041
764
|
onBack
|
|
1042
765
|
}) {
|
|
1043
|
-
const [focusIdx, setFocusIdx] =
|
|
766
|
+
const [focusIdx, setFocusIdx] = useState6(0);
|
|
1044
767
|
const items = [
|
|
1045
768
|
{ label: "Configuration", screen: "settings-configuration" },
|
|
1046
769
|
{ label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
|
|
1047
770
|
{ label: "Debug Mode", screen: "settings-debug-mode" }
|
|
1048
771
|
];
|
|
1049
|
-
|
|
772
|
+
useInput6((input, key) => {
|
|
1050
773
|
if (key.upArrow) {
|
|
1051
774
|
setFocusIdx((i) => (i - 1 + items.length) % items.length);
|
|
1052
775
|
return;
|
|
@@ -1066,15 +789,15 @@ function SettingsScreen({
|
|
|
1066
789
|
onBack();
|
|
1067
790
|
}
|
|
1068
791
|
});
|
|
1069
|
-
return /* @__PURE__ */
|
|
1070
|
-
/* @__PURE__ */
|
|
1071
|
-
/* @__PURE__ */
|
|
1072
|
-
items.map((item, i) => /* @__PURE__ */
|
|
792
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
793
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, children: "Settings" }),
|
|
794
|
+
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
795
|
+
items.map((item, i) => /* @__PURE__ */ jsxs6(Text7, { color: i === focusIdx ? "cyan" : void 0, children: [
|
|
1073
796
|
i === focusIdx ? "> " : " ",
|
|
1074
797
|
item.label
|
|
1075
798
|
] }, item.label)),
|
|
1076
|
-
/* @__PURE__ */
|
|
1077
|
-
/* @__PURE__ */
|
|
799
|
+
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
800
|
+
/* @__PURE__ */ jsx7(
|
|
1078
801
|
ControlHints,
|
|
1079
802
|
{
|
|
1080
803
|
hints: [
|
|
@@ -1088,8 +811,8 @@ function SettingsScreen({
|
|
|
1088
811
|
}
|
|
1089
812
|
|
|
1090
813
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
1091
|
-
import { useEffect as
|
|
1092
|
-
import { Box as
|
|
814
|
+
import { useEffect as useEffect4, useState as useState7 } from "react";
|
|
815
|
+
import { Box as Box7, Text as Text8, useInput as useInput7 } from "ink";
|
|
1093
816
|
import TextInput3 from "ink-text-input";
|
|
1094
817
|
|
|
1095
818
|
// packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
|
|
@@ -1121,7 +844,7 @@ async function writeCredentials(config) {
|
|
|
1121
844
|
}
|
|
1122
845
|
|
|
1123
846
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
1124
|
-
import { Fragment as Fragment2, jsx as
|
|
847
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1125
848
|
var FIELD_ORDER = [
|
|
1126
849
|
"spaceId",
|
|
1127
850
|
"environmentId",
|
|
@@ -1149,14 +872,14 @@ var FIELD_LABELS = {
|
|
|
1149
872
|
defaultTokenFile: "Default token file (optional)"
|
|
1150
873
|
};
|
|
1151
874
|
function ConfigurationScreen({ onDone }) {
|
|
1152
|
-
const [stage, setStage] =
|
|
1153
|
-
const [config, setConfig] =
|
|
1154
|
-
const [activeField, setActiveField] =
|
|
1155
|
-
const [notice, setNotice] =
|
|
1156
|
-
const [lastSaved, setLastSaved] =
|
|
1157
|
-
const [editing, setEditing] =
|
|
1158
|
-
const [valueBeforeEdit, setValueBeforeEdit] =
|
|
1159
|
-
|
|
875
|
+
const [stage, setStage] = useState7("loading");
|
|
876
|
+
const [config, setConfig] = useState7(null);
|
|
877
|
+
const [activeField, setActiveField] = useState7("spaceId");
|
|
878
|
+
const [notice, setNotice] = useState7(null);
|
|
879
|
+
const [lastSaved, setLastSaved] = useState7(null);
|
|
880
|
+
const [editing, setEditing] = useState7(false);
|
|
881
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState7("");
|
|
882
|
+
useEffect4(() => {
|
|
1160
883
|
readCredentials().then((cfg) => {
|
|
1161
884
|
setConfig(cfg);
|
|
1162
885
|
setStage("form");
|
|
@@ -1196,7 +919,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1196
919
|
);
|
|
1197
920
|
onDone();
|
|
1198
921
|
}
|
|
1199
|
-
|
|
922
|
+
useInput7((input, key) => {
|
|
1200
923
|
if (stage === "loading" || stage === "saving") return;
|
|
1201
924
|
if (editing) {
|
|
1202
925
|
if (key.escape) {
|
|
@@ -1233,26 +956,26 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1233
956
|
}
|
|
1234
957
|
});
|
|
1235
958
|
if (stage === "loading") {
|
|
1236
|
-
return /* @__PURE__ */
|
|
1237
|
-
/* @__PURE__ */
|
|
1238
|
-
/* @__PURE__ */
|
|
1239
|
-
/* @__PURE__ */
|
|
959
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
960
|
+
/* @__PURE__ */ jsx8(Text8, { bold: true, children: "Configuration" }),
|
|
961
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
962
|
+
/* @__PURE__ */ jsx8(Text8, { color: PALETTE.accent, children: "Loading..." })
|
|
1240
963
|
] });
|
|
1241
964
|
}
|
|
1242
|
-
return /* @__PURE__ */
|
|
1243
|
-
/* @__PURE__ */
|
|
1244
|
-
/* @__PURE__ */
|
|
1245
|
-
/* @__PURE__ */
|
|
965
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
966
|
+
/* @__PURE__ */ jsx8(Text8, { bold: true, children: "Configuration" }),
|
|
967
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
968
|
+
/* @__PURE__ */ jsx8(Box7, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
|
|
1246
969
|
const isActive = activeField === field;
|
|
1247
970
|
const value = fieldValue(field);
|
|
1248
971
|
const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
|
|
1249
|
-
return /* @__PURE__ */
|
|
1250
|
-
/* @__PURE__ */
|
|
1251
|
-
/* @__PURE__ */
|
|
972
|
+
return /* @__PURE__ */ jsxs7(Box7, { gap: 1, children: [
|
|
973
|
+
/* @__PURE__ */ jsx8(Text8, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
974
|
+
/* @__PURE__ */ jsxs7(Text8, { bold: isActive, children: [
|
|
1252
975
|
FIELD_LABELS[field],
|
|
1253
976
|
":"
|
|
1254
977
|
] }),
|
|
1255
|
-
isActive && editing ? /* @__PURE__ */
|
|
978
|
+
isActive && editing ? /* @__PURE__ */ jsx8(
|
|
1256
979
|
TextInput3,
|
|
1257
980
|
{
|
|
1258
981
|
value,
|
|
@@ -1260,19 +983,19 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1260
983
|
onSubmit: () => setEditing(false),
|
|
1261
984
|
mask: field === "cmaToken" ? "\u2022" : void 0
|
|
1262
985
|
}
|
|
1263
|
-
) : /* @__PURE__ */
|
|
986
|
+
) : /* @__PURE__ */ jsx8(Text8, { children: display || /* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "(empty)" }) })
|
|
1264
987
|
] }, field);
|
|
1265
988
|
}) }),
|
|
1266
|
-
notice && /* @__PURE__ */
|
|
1267
|
-
/* @__PURE__ */
|
|
1268
|
-
/* @__PURE__ */
|
|
989
|
+
notice && /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
990
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
991
|
+
/* @__PURE__ */ jsxs7(Text8, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
1269
992
|
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
1270
993
|
" ",
|
|
1271
994
|
notice.text
|
|
1272
995
|
] })
|
|
1273
996
|
] }),
|
|
1274
|
-
/* @__PURE__ */
|
|
1275
|
-
/* @__PURE__ */
|
|
997
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
998
|
+
/* @__PURE__ */ jsx8(
|
|
1276
999
|
ControlHints,
|
|
1277
1000
|
{
|
|
1278
1001
|
hints: editing ? [
|
|
@@ -1293,8 +1016,8 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1293
1016
|
}
|
|
1294
1017
|
|
|
1295
1018
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
1296
|
-
import { useEffect as
|
|
1297
|
-
import { Box as
|
|
1019
|
+
import { useEffect as useEffect5, useState as useState8 } from "react";
|
|
1020
|
+
import { Box as Box8, Text as Text9, useInput as useInput8 } from "ink";
|
|
1298
1021
|
|
|
1299
1022
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
|
|
1300
1023
|
async function readAnalyticsSetting() {
|
|
@@ -1312,11 +1035,11 @@ async function writeAnalyticsSetting(setting) {
|
|
|
1312
1035
|
}
|
|
1313
1036
|
|
|
1314
1037
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
1315
|
-
import { Fragment as Fragment3, jsx as
|
|
1038
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1316
1039
|
function OptInAnalyticsScreen({ onDone }) {
|
|
1317
|
-
const [loading, setLoading] =
|
|
1318
|
-
const [enabled, setEnabled] =
|
|
1319
|
-
|
|
1040
|
+
const [loading, setLoading] = useState8(true);
|
|
1041
|
+
const [enabled, setEnabled] = useState8(true);
|
|
1042
|
+
useEffect5(() => {
|
|
1320
1043
|
readAnalyticsSetting().then((setting) => {
|
|
1321
1044
|
setEnabled(setting.enabled);
|
|
1322
1045
|
setLoading(false);
|
|
@@ -1328,7 +1051,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1328
1051
|
});
|
|
1329
1052
|
});
|
|
1330
1053
|
}, []);
|
|
1331
|
-
|
|
1054
|
+
useInput8((input, key) => {
|
|
1332
1055
|
if (loading) return;
|
|
1333
1056
|
if (key.return || input === " ") {
|
|
1334
1057
|
setEnabled((current) => {
|
|
@@ -1343,21 +1066,21 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1343
1066
|
onDone();
|
|
1344
1067
|
}
|
|
1345
1068
|
});
|
|
1346
|
-
return /* @__PURE__ */
|
|
1347
|
-
/* @__PURE__ */
|
|
1348
|
-
/* @__PURE__ */
|
|
1349
|
-
loading ? /* @__PURE__ */
|
|
1350
|
-
/* @__PURE__ */
|
|
1069
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1070
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
|
|
1071
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1072
|
+
loading ? /* @__PURE__ */ jsx9(Text9, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
1073
|
+
/* @__PURE__ */ jsxs8(Text9, { children: [
|
|
1351
1074
|
"Share anonymous usage data:",
|
|
1352
1075
|
" ",
|
|
1353
|
-
/* @__PURE__ */
|
|
1076
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
1354
1077
|
] }),
|
|
1355
|
-
/* @__PURE__ */
|
|
1356
|
-
/* @__PURE__ */
|
|
1357
|
-
/* @__PURE__ */
|
|
1078
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1079
|
+
/* @__PURE__ */ jsx9(Text9, { dimColor: true, children: "Shares which CLI commands are used and where imports succeed or fail." }),
|
|
1080
|
+
/* @__PURE__ */ jsx9(Text9, { dimColor: true, children: "Never includes source code, file paths, credentials, or authored content." })
|
|
1358
1081
|
] }),
|
|
1359
|
-
/* @__PURE__ */
|
|
1360
|
-
/* @__PURE__ */
|
|
1082
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1083
|
+
/* @__PURE__ */ jsx9(
|
|
1361
1084
|
ControlHints,
|
|
1362
1085
|
{
|
|
1363
1086
|
hints: [
|
|
@@ -1370,13 +1093,13 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1370
1093
|
}
|
|
1371
1094
|
|
|
1372
1095
|
// packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
|
|
1373
|
-
import { useEffect as
|
|
1374
|
-
import { Box as
|
|
1375
|
-
import { jsx as
|
|
1096
|
+
import { useEffect as useEffect6, useState as useState9 } from "react";
|
|
1097
|
+
import { Box as Box9, Text as Text10, useInput as useInput9 } from "ink";
|
|
1098
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1376
1099
|
var UPGRADE_COMMANDS = ["git pull", "pnpm install", "pnpm build"];
|
|
1377
1100
|
function UpgradeScreen({ onDone }) {
|
|
1378
|
-
const [upgradeCheck, setUpgradeCheck] =
|
|
1379
|
-
|
|
1101
|
+
const [upgradeCheck, setUpgradeCheck] = useState9();
|
|
1102
|
+
useEffect6(() => {
|
|
1380
1103
|
startDebugRun({
|
|
1381
1104
|
flow: "upgrade",
|
|
1382
1105
|
step: "01-upgrade",
|
|
@@ -1385,7 +1108,7 @@ function UpgradeScreen({ onDone }) {
|
|
|
1385
1108
|
});
|
|
1386
1109
|
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
1387
1110
|
}, []);
|
|
1388
|
-
|
|
1111
|
+
useInput9((_input, key) => {
|
|
1389
1112
|
if (key.return) {
|
|
1390
1113
|
void finishDebugRun({
|
|
1391
1114
|
outputs: upgradeCheck ?? {},
|
|
@@ -1396,12 +1119,12 @@ function UpgradeScreen({ onDone }) {
|
|
|
1396
1119
|
return;
|
|
1397
1120
|
}
|
|
1398
1121
|
});
|
|
1399
|
-
return /* @__PURE__ */
|
|
1400
|
-
/* @__PURE__ */
|
|
1401
|
-
/* @__PURE__ */
|
|
1122
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1123
|
+
/* @__PURE__ */ jsx10(Text10, { bold: true, children: "Upgrade" }),
|
|
1124
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1402
1125
|
renderBody(upgradeCheck),
|
|
1403
|
-
/* @__PURE__ */
|
|
1404
|
-
/* @__PURE__ */
|
|
1126
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1127
|
+
/* @__PURE__ */ jsxs9(Text10, { bold: true, color: PALETTE.accent, children: [
|
|
1405
1128
|
FOCUS_MARKER,
|
|
1406
1129
|
" Go Back"
|
|
1407
1130
|
] })
|
|
@@ -1409,45 +1132,45 @@ function UpgradeScreen({ onDone }) {
|
|
|
1409
1132
|
}
|
|
1410
1133
|
function renderBody(upgradeCheck) {
|
|
1411
1134
|
if (!upgradeCheck) {
|
|
1412
|
-
return /* @__PURE__ */
|
|
1135
|
+
return /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "Checking for updates\u2026" });
|
|
1413
1136
|
}
|
|
1414
1137
|
if (upgradeCheck.status === "error") {
|
|
1415
|
-
return /* @__PURE__ */
|
|
1138
|
+
return /* @__PURE__ */ jsx10(Text10, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
|
|
1416
1139
|
}
|
|
1417
1140
|
if (upgradeCheck.status === "up-to-date") {
|
|
1418
|
-
return /* @__PURE__ */
|
|
1141
|
+
return /* @__PURE__ */ jsxs9(Text10, { color: PALETTE.success, children: [
|
|
1419
1142
|
"You're already on the latest version (v",
|
|
1420
1143
|
upgradeCheck.current,
|
|
1421
1144
|
")."
|
|
1422
1145
|
] });
|
|
1423
1146
|
}
|
|
1424
|
-
return /* @__PURE__ */
|
|
1425
|
-
/* @__PURE__ */
|
|
1426
|
-
/* @__PURE__ */
|
|
1147
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", children: [
|
|
1148
|
+
/* @__PURE__ */ jsxs9(Text10, { color: PALETTE.muted, children: [
|
|
1149
|
+
/* @__PURE__ */ jsxs9(Text10, { bold: true, color: PALETTE.success, children: [
|
|
1427
1150
|
"v",
|
|
1428
1151
|
upgradeCheck.latest
|
|
1429
1152
|
] }),
|
|
1430
1153
|
" ",
|
|
1431
1154
|
"is available (you're on ",
|
|
1432
|
-
/* @__PURE__ */
|
|
1155
|
+
/* @__PURE__ */ jsxs9(Text10, { bold: true, children: [
|
|
1433
1156
|
"v",
|
|
1434
1157
|
upgradeCheck.current
|
|
1435
1158
|
] }),
|
|
1436
1159
|
"). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
|
|
1437
1160
|
] }),
|
|
1438
|
-
/* @__PURE__ */
|
|
1439
|
-
/* @__PURE__ */
|
|
1161
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1162
|
+
/* @__PURE__ */ jsx10(Box9, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx10(Text10, { bold: true, children: cmd }, cmd)) })
|
|
1440
1163
|
] });
|
|
1441
1164
|
}
|
|
1442
1165
|
|
|
1443
1166
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
1444
|
-
import { useEffect as
|
|
1445
|
-
import { Box as
|
|
1446
|
-
import { jsx as
|
|
1167
|
+
import { useEffect as useEffect7, useState as useState10 } from "react";
|
|
1168
|
+
import { Box as Box10, Text as Text11, useInput as useInput10 } from "ink";
|
|
1169
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1447
1170
|
function DebugModeScreen({ onDone }) {
|
|
1448
|
-
const [loading, setLoading] =
|
|
1449
|
-
const [enabled, setEnabled] =
|
|
1450
|
-
|
|
1171
|
+
const [loading, setLoading] = useState10(true);
|
|
1172
|
+
const [enabled, setEnabled] = useState10(true);
|
|
1173
|
+
useEffect7(() => {
|
|
1451
1174
|
readDebugModeSetting().then((setting) => {
|
|
1452
1175
|
setEnabled(setting.enabled);
|
|
1453
1176
|
setLoading(false);
|
|
@@ -1459,7 +1182,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
1459
1182
|
});
|
|
1460
1183
|
});
|
|
1461
1184
|
}, []);
|
|
1462
|
-
|
|
1185
|
+
useInput10((input, key) => {
|
|
1463
1186
|
if (loading) return;
|
|
1464
1187
|
if (key.return || input === " ") {
|
|
1465
1188
|
setEnabled((current) => {
|
|
@@ -1474,16 +1197,16 @@ function DebugModeScreen({ onDone }) {
|
|
|
1474
1197
|
onDone();
|
|
1475
1198
|
}
|
|
1476
1199
|
});
|
|
1477
|
-
return /* @__PURE__ */
|
|
1478
|
-
/* @__PURE__ */
|
|
1479
|
-
/* @__PURE__ */
|
|
1480
|
-
loading ? /* @__PURE__ */
|
|
1200
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1201
|
+
/* @__PURE__ */ jsx11(Text11, { bold: true, children: "Settings \u203A Debug Mode" }),
|
|
1202
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1203
|
+
loading ? /* @__PURE__ */ jsx11(Text11, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs10(Text11, { children: [
|
|
1481
1204
|
"Debug logging:",
|
|
1482
1205
|
" ",
|
|
1483
|
-
/* @__PURE__ */
|
|
1206
|
+
/* @__PURE__ */ jsx11(Text11, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
1484
1207
|
] }),
|
|
1485
|
-
/* @__PURE__ */
|
|
1486
|
-
/* @__PURE__ */
|
|
1208
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1209
|
+
/* @__PURE__ */ jsx11(
|
|
1487
1210
|
ControlHints,
|
|
1488
1211
|
{
|
|
1489
1212
|
hints: [
|
|
@@ -1496,15 +1219,14 @@ function DebugModeScreen({ onDone }) {
|
|
|
1496
1219
|
}
|
|
1497
1220
|
|
|
1498
1221
|
// packages/experience-design-system-cli/app.tsx
|
|
1499
|
-
import { Fragment as Fragment4, jsx as
|
|
1222
|
+
import { Fragment as Fragment4, jsx as jsx12 } from "react/jsx-runtime";
|
|
1500
1223
|
function App({ onLaunchImport, importExitCode }) {
|
|
1501
1224
|
const returnedFromImport = importExitCode !== void 0;
|
|
1502
|
-
const [screen, setScreen] =
|
|
1503
|
-
const [showImportResult, setShowImportResult] =
|
|
1504
|
-
const [projectPath, setProjectPath] =
|
|
1505
|
-
const [
|
|
1506
|
-
|
|
1507
|
-
useEffect9(() => {
|
|
1225
|
+
const [screen, setScreen] = useState11(returnedFromImport ? "import" : "start");
|
|
1226
|
+
const [showImportResult, setShowImportResult] = useState11(returnedFromImport);
|
|
1227
|
+
const [projectPath, setProjectPath] = useState11();
|
|
1228
|
+
const [importDefaults, setImportDefaults] = useState11();
|
|
1229
|
+
useEffect8(() => {
|
|
1508
1230
|
if (screen !== "import") {
|
|
1509
1231
|
setImportDefaults(void 0);
|
|
1510
1232
|
return;
|
|
@@ -1515,66 +1237,51 @@ function App({ onLaunchImport, importExitCode }) {
|
|
|
1515
1237
|
}, [screen]);
|
|
1516
1238
|
const goToStart = () => setScreen("start");
|
|
1517
1239
|
const goToSettings = () => setScreen("settings");
|
|
1518
|
-
const resetImport = () => {
|
|
1519
|
-
setProjectPath(void 0);
|
|
1520
|
-
setTokensPath(void 0);
|
|
1521
|
-
};
|
|
1522
1240
|
const finishImportResult = () => {
|
|
1523
1241
|
setShowImportResult(false);
|
|
1524
|
-
|
|
1242
|
+
setProjectPath(void 0);
|
|
1525
1243
|
goToStart();
|
|
1526
1244
|
};
|
|
1527
1245
|
const leaveImport = () => {
|
|
1528
|
-
|
|
1246
|
+
setProjectPath(void 0);
|
|
1529
1247
|
goToStart();
|
|
1530
1248
|
};
|
|
1531
1249
|
switch (screen) {
|
|
1532
1250
|
case "import":
|
|
1533
|
-
if (showImportResult) return /* @__PURE__ */
|
|
1534
|
-
if (importDefaults === void 0) return /* @__PURE__ */
|
|
1251
|
+
if (showImportResult) return /* @__PURE__ */ jsx12(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
|
|
1252
|
+
if (importDefaults === void 0) return /* @__PURE__ */ jsx12(Fragment4, {});
|
|
1535
1253
|
if (projectPath === void 0) {
|
|
1536
|
-
return /* @__PURE__ */
|
|
1254
|
+
return /* @__PURE__ */ jsx12(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
|
|
1537
1255
|
}
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
TokenInputScreen,
|
|
1541
|
-
{
|
|
1542
|
-
initialPath: importDefaults.tokenFile,
|
|
1543
|
-
onConfirm: setTokensPath,
|
|
1544
|
-
onBack: () => setProjectPath(void 0)
|
|
1545
|
-
}
|
|
1546
|
-
);
|
|
1547
|
-
}
|
|
1548
|
-
return /* @__PURE__ */ jsx13(
|
|
1549
|
-
PathValidationScreen,
|
|
1256
|
+
return /* @__PURE__ */ jsx12(
|
|
1257
|
+
TokenInputScreen,
|
|
1550
1258
|
{
|
|
1551
|
-
|
|
1552
|
-
onConfirm: (
|
|
1553
|
-
|
|
1554
|
-
onBack: () => setTokensPath(void 0)
|
|
1259
|
+
initialPath: importDefaults.tokenFile,
|
|
1260
|
+
onConfirm: (tokens) => onLaunchImport?.({ project: projectPath, tokens }),
|
|
1261
|
+
onBack: () => setProjectPath(void 0)
|
|
1555
1262
|
}
|
|
1556
1263
|
);
|
|
1557
1264
|
case "help":
|
|
1558
|
-
return /* @__PURE__ */
|
|
1265
|
+
return /* @__PURE__ */ jsx12(HelpScreen, { onDone: goToStart });
|
|
1559
1266
|
case "upgrade":
|
|
1560
|
-
return /* @__PURE__ */
|
|
1267
|
+
return /* @__PURE__ */ jsx12(UpgradeScreen, { onDone: goToStart });
|
|
1561
1268
|
case "settings":
|
|
1562
|
-
return /* @__PURE__ */
|
|
1269
|
+
return /* @__PURE__ */ jsx12(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
1563
1270
|
case "settings-configuration":
|
|
1564
|
-
return /* @__PURE__ */
|
|
1271
|
+
return /* @__PURE__ */ jsx12(ConfigurationScreen, { onDone: goToSettings });
|
|
1565
1272
|
case "settings-opt-in-analytics":
|
|
1566
|
-
return /* @__PURE__ */
|
|
1273
|
+
return /* @__PURE__ */ jsx12(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
1567
1274
|
case "settings-debug-mode":
|
|
1568
|
-
return /* @__PURE__ */
|
|
1275
|
+
return /* @__PURE__ */ jsx12(DebugModeScreen, { onDone: goToSettings });
|
|
1569
1276
|
case "start":
|
|
1570
|
-
return /* @__PURE__ */
|
|
1277
|
+
return /* @__PURE__ */ jsx12(HomeScreen, { onNavigate: setScreen });
|
|
1571
1278
|
}
|
|
1572
1279
|
}
|
|
1573
1280
|
var CLEAR_SCREEN = "\x1B[2J\x1B[H";
|
|
1574
1281
|
async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
|
|
1575
1282
|
let requestedImport;
|
|
1576
1283
|
const instance = renderApp(
|
|
1577
|
-
/* @__PURE__ */
|
|
1284
|
+
/* @__PURE__ */ jsx12(
|
|
1578
1285
|
App,
|
|
1579
1286
|
{
|
|
1580
1287
|
importExitCode,
|