@contentful/experience-design-system-cli 2.37.1-dev-build-049f8d38.0 → 2.37.1-dev-build-cf4224ad.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 +442 -149
- package/dist/index.js +483 -160
- package/dist/package.json +1 -1
- package/dist/src/tui/import/resolve-user-path.d.ts +1 -0
- package/dist/src/tui/import/steps/03-path-validation/controls.d.ts +13 -0
- package/dist/src/tui/import/steps/03-path-validation/loader.d.ts +2 -0
- package/dist/src/tui/import/steps/03-path-validation/logic.d.ts +42 -0
- package/dist/src/tui/import/steps/03-path-validation/screen.d.ts +9 -0
- package/dist/src/tui/import/steps/index.d.ts +1 -0
- package/legacy/package.json +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -443,8 +443,7 @@ var init_controls2 = __esm({
|
|
|
443
443
|
}
|
|
444
444
|
});
|
|
445
445
|
|
|
446
|
-
// packages/experience-design-system-cli/src/tui/import/
|
|
447
|
-
import { statSync } from "node:fs";
|
|
446
|
+
// packages/experience-design-system-cli/src/tui/import/resolve-user-path.ts
|
|
448
447
|
import { homedir } from "node:os";
|
|
449
448
|
import { resolve } from "node:path";
|
|
450
449
|
function stripQuotes(value) {
|
|
@@ -454,8 +453,19 @@ function stripQuotes(value) {
|
|
|
454
453
|
function expandHome(value) {
|
|
455
454
|
return value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? homedir() + value.slice(1) : value;
|
|
456
455
|
}
|
|
456
|
+
function resolveUserPath(raw) {
|
|
457
|
+
return resolve(expandHome(stripQuotes(raw.trim())));
|
|
458
|
+
}
|
|
459
|
+
var init_resolve_user_path = __esm({
|
|
460
|
+
"packages/experience-design-system-cli/src/tui/import/resolve-user-path.ts"() {
|
|
461
|
+
"use strict";
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts
|
|
466
|
+
import { statSync } from "node:fs";
|
|
457
467
|
function validateTokenPath(rawPath) {
|
|
458
|
-
const path =
|
|
468
|
+
const path = resolveUserPath(rawPath);
|
|
459
469
|
let stats;
|
|
460
470
|
try {
|
|
461
471
|
stats = statSync(path);
|
|
@@ -477,6 +487,7 @@ function validateTokenPath(rawPath) {
|
|
|
477
487
|
var init_validate_path = __esm({
|
|
478
488
|
"packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts"() {
|
|
479
489
|
"use strict";
|
|
490
|
+
init_resolve_user_path();
|
|
480
491
|
}
|
|
481
492
|
});
|
|
482
493
|
|
|
@@ -541,12 +552,308 @@ var init_screen2 = __esm({
|
|
|
541
552
|
}
|
|
542
553
|
});
|
|
543
554
|
|
|
555
|
+
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/logic.ts
|
|
556
|
+
function categorize(fileName) {
|
|
557
|
+
if (fileName.endsWith(".d.ts")) return "other";
|
|
558
|
+
const dot = fileName.lastIndexOf(".");
|
|
559
|
+
const extension = dot === -1 ? "" : fileName.slice(dot + 1);
|
|
560
|
+
return CATEGORY_BY_EXTENSION.get(extension) ?? "other";
|
|
561
|
+
}
|
|
562
|
+
function emptyCounts() {
|
|
563
|
+
return { tsx: 0, ts: 0, vue: 0, astro: 0, jsx: 0, js: 0, json: 0, other: 0, total: 0 };
|
|
564
|
+
}
|
|
565
|
+
function addFile(counts, fileName) {
|
|
566
|
+
const category = categorize(fileName);
|
|
567
|
+
return { ...counts, [category]: counts[category] + 1, total: counts.total + 1 };
|
|
568
|
+
}
|
|
569
|
+
function mergeCounts(a, b) {
|
|
570
|
+
return {
|
|
571
|
+
tsx: a.tsx + b.tsx,
|
|
572
|
+
ts: a.ts + b.ts,
|
|
573
|
+
vue: a.vue + b.vue,
|
|
574
|
+
astro: a.astro + b.astro,
|
|
575
|
+
jsx: a.jsx + b.jsx,
|
|
576
|
+
js: a.js + b.js,
|
|
577
|
+
json: a.json + b.json,
|
|
578
|
+
other: a.other + b.other,
|
|
579
|
+
total: a.total + b.total
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
function failureFromErrorCode(code) {
|
|
583
|
+
if (code === "ENOENT") return "not-found";
|
|
584
|
+
if (code === "EACCES") return "permission-denied";
|
|
585
|
+
return "unreadable";
|
|
586
|
+
}
|
|
587
|
+
function describeFailure(failure, path) {
|
|
588
|
+
switch (failure) {
|
|
589
|
+
case "is-file":
|
|
590
|
+
return {
|
|
591
|
+
headline: "That's a file, not a directory.",
|
|
592
|
+
hints: [
|
|
593
|
+
"Provide the path to your component library's root folder, not a specific file.",
|
|
594
|
+
"Example: ~/projects/my-design-system"
|
|
595
|
+
]
|
|
596
|
+
};
|
|
597
|
+
case "not-found":
|
|
598
|
+
return {
|
|
599
|
+
headline: `Directory not found: ${path}`,
|
|
600
|
+
hints: ["Double-check the path and try again. Tip: you can use ~, relative, or absolute paths."]
|
|
601
|
+
};
|
|
602
|
+
case "permission-denied":
|
|
603
|
+
return {
|
|
604
|
+
headline: `Permission denied: ${path}`,
|
|
605
|
+
hints: ["You don't have read access to this directory."]
|
|
606
|
+
};
|
|
607
|
+
case "not-directory":
|
|
608
|
+
return { headline: `Not a directory: ${path}`, hints: [] };
|
|
609
|
+
case "unreadable":
|
|
610
|
+
return { headline: `Cannot access: ${path}`, hints: [] };
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
function summarize(counts) {
|
|
614
|
+
const rows = ROW_ORDER.filter((category) => counts[category] > 0).map((category) => {
|
|
615
|
+
const tone = category === "json" ? "accent" : category === "other" ? "muted" : "default";
|
|
616
|
+
return { label: ROW_LABELS[category], count: counts[category], tone };
|
|
617
|
+
});
|
|
618
|
+
const componentFiles = COMPONENT_CATEGORIES.reduce((sum, category) => sum + counts[category], 0);
|
|
619
|
+
if (componentFiles > 0) return { total: counts.total, rows };
|
|
620
|
+
if (counts.json > 0) {
|
|
621
|
+
return { total: counts.total, rows, warning: "No component files found \u2014 only token files detected." };
|
|
622
|
+
}
|
|
623
|
+
return {
|
|
624
|
+
total: counts.total,
|
|
625
|
+
rows,
|
|
626
|
+
warning: "No component or token files found. Try a different path."
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
function phaseOf(scan) {
|
|
630
|
+
if (scan === void 0) return "scanning";
|
|
631
|
+
return scan.ok ? "ready" : "failed";
|
|
632
|
+
}
|
|
633
|
+
function keyAction(phase, input, key) {
|
|
634
|
+
if (key.escape) return "back";
|
|
635
|
+
if (phase === "ready") {
|
|
636
|
+
if (key.return) return "confirm";
|
|
637
|
+
if (input === "e") return "change-path";
|
|
638
|
+
}
|
|
639
|
+
if (phase === "failed" && (key.return || input === "e")) return "change-path";
|
|
640
|
+
return void 0;
|
|
641
|
+
}
|
|
642
|
+
var IGNORED_DIRECTORIES, CATEGORY_BY_EXTENSION, COMPONENT_CATEGORIES, ROW_LABELS, ROW_ORDER;
|
|
643
|
+
var init_logic3 = __esm({
|
|
644
|
+
"packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/logic.ts"() {
|
|
645
|
+
"use strict";
|
|
646
|
+
IGNORED_DIRECTORIES = /* @__PURE__ */ new Set([
|
|
647
|
+
"node_modules",
|
|
648
|
+
"dist",
|
|
649
|
+
"build",
|
|
650
|
+
".next",
|
|
651
|
+
".nuxt",
|
|
652
|
+
"coverage",
|
|
653
|
+
"storybook-static",
|
|
654
|
+
"out",
|
|
655
|
+
".git"
|
|
656
|
+
]);
|
|
657
|
+
CATEGORY_BY_EXTENSION = /* @__PURE__ */ new Map([
|
|
658
|
+
["tsx", "tsx"],
|
|
659
|
+
["ts", "ts"],
|
|
660
|
+
["vue", "vue"],
|
|
661
|
+
["astro", "astro"],
|
|
662
|
+
["jsx", "jsx"],
|
|
663
|
+
["js", "js"],
|
|
664
|
+
["json", "json"]
|
|
665
|
+
]);
|
|
666
|
+
COMPONENT_CATEGORIES = ["tsx", "ts", "vue", "astro", "jsx", "js"];
|
|
667
|
+
ROW_LABELS = {
|
|
668
|
+
tsx: ".tsx files",
|
|
669
|
+
ts: ".ts files",
|
|
670
|
+
vue: ".vue files",
|
|
671
|
+
astro: ".astro files",
|
|
672
|
+
jsx: ".jsx files",
|
|
673
|
+
js: ".js files",
|
|
674
|
+
json: ".json files (design tokens)",
|
|
675
|
+
other: "other (ignored)"
|
|
676
|
+
};
|
|
677
|
+
ROW_ORDER = ["tsx", "ts", "vue", "astro", "jsx", "js", "json", "other"];
|
|
678
|
+
}
|
|
679
|
+
});
|
|
680
|
+
|
|
681
|
+
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/controls.ts
|
|
682
|
+
import { useInput as useInput5 } from "ink";
|
|
683
|
+
function controlsFor(phase) {
|
|
684
|
+
return CONTROLS[phase];
|
|
685
|
+
}
|
|
686
|
+
function usePathValidationControls(phase, handlers) {
|
|
687
|
+
useInput5((input, key) => {
|
|
688
|
+
const action = keyAction(phase, input, key);
|
|
689
|
+
if (action === "confirm") handlers.onConfirm();
|
|
690
|
+
else if (action === "change-path") handlers.onChangePath();
|
|
691
|
+
else if (action === "back") handlers.onBack();
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
var CONTROLS;
|
|
695
|
+
var init_controls3 = __esm({
|
|
696
|
+
"packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/controls.ts"() {
|
|
697
|
+
"use strict";
|
|
698
|
+
init_logic3();
|
|
699
|
+
CONTROLS = {
|
|
700
|
+
scanning: [{ keys: "Esc", label: "Back" }],
|
|
701
|
+
ready: [
|
|
702
|
+
{ keys: "Enter", label: "Yes, continue" },
|
|
703
|
+
{ keys: "e", label: "Change path" },
|
|
704
|
+
{ keys: "Esc", label: "Back" }
|
|
705
|
+
],
|
|
706
|
+
failed: [
|
|
707
|
+
{ keys: "Enter/e", label: "Try a different path" },
|
|
708
|
+
{ keys: "Esc", label: "Back" }
|
|
709
|
+
]
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
|
|
714
|
+
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/loader.ts
|
|
715
|
+
import { readdir, stat } from "node:fs/promises";
|
|
716
|
+
import { join as join5 } from "node:path";
|
|
717
|
+
async function isFile(path) {
|
|
718
|
+
try {
|
|
719
|
+
return (await stat(path)).isFile();
|
|
720
|
+
} catch {
|
|
721
|
+
return false;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
async function countEntry(directory, entry) {
|
|
725
|
+
const path = join5(directory, entry.name);
|
|
726
|
+
if (entry.isDirectory()) return countFiles(path);
|
|
727
|
+
if (entry.isFile() || entry.isSymbolicLink() && await isFile(path)) return addFile(emptyCounts(), entry.name);
|
|
728
|
+
return emptyCounts();
|
|
729
|
+
}
|
|
730
|
+
async function countFiles(directory) {
|
|
731
|
+
let entries;
|
|
732
|
+
try {
|
|
733
|
+
entries = await readdir(directory, { withFileTypes: true });
|
|
734
|
+
} catch {
|
|
735
|
+
return emptyCounts();
|
|
736
|
+
}
|
|
737
|
+
const counts = await Promise.all(
|
|
738
|
+
entries.filter((entry) => !IGNORED_DIRECTORIES.has(entry.name)).map((entry) => countEntry(directory, entry))
|
|
739
|
+
);
|
|
740
|
+
return counts.reduce(mergeCounts, emptyCounts());
|
|
741
|
+
}
|
|
742
|
+
async function scanProject(directory) {
|
|
743
|
+
try {
|
|
744
|
+
const stats = await stat(directory);
|
|
745
|
+
if (stats.isFile()) return { ok: false, failure: "is-file" };
|
|
746
|
+
if (!stats.isDirectory()) return { ok: false, failure: "not-directory" };
|
|
747
|
+
} catch (error) {
|
|
748
|
+
return { ok: false, failure: failureFromErrorCode(error.code) };
|
|
749
|
+
}
|
|
750
|
+
return { ok: true, counts: await countFiles(directory) };
|
|
751
|
+
}
|
|
752
|
+
var init_loader = __esm({
|
|
753
|
+
"packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/loader.ts"() {
|
|
754
|
+
"use strict";
|
|
755
|
+
init_logic3();
|
|
756
|
+
}
|
|
757
|
+
});
|
|
758
|
+
|
|
759
|
+
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
|
|
760
|
+
import { useEffect as useEffect3, useMemo, useState as useState5 } from "react";
|
|
761
|
+
import { Box as Box5, Text as Text6 } from "ink";
|
|
762
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
763
|
+
function Row({ row }) {
|
|
764
|
+
return /* @__PURE__ */ jsxs5(Text6, { color: row.tone === "accent" ? PALETTE.accent : void 0, dimColor: row.tone === "muted", children: [
|
|
765
|
+
" \u2022 ",
|
|
766
|
+
String(row.count).padStart(3),
|
|
767
|
+
" ",
|
|
768
|
+
row.label
|
|
769
|
+
] });
|
|
770
|
+
}
|
|
771
|
+
function Failure({ scan, path }) {
|
|
772
|
+
const { headline, hints } = describeFailure(scan.failure, path);
|
|
773
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
|
|
774
|
+
/* @__PURE__ */ jsxs5(Text6, { color: PALETTE.error, children: [
|
|
775
|
+
"\u2717 ",
|
|
776
|
+
headline
|
|
777
|
+
] }),
|
|
778
|
+
hints.map((hint) => /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: hint }, hint))
|
|
779
|
+
] });
|
|
780
|
+
}
|
|
781
|
+
function Summary({ scan, path }) {
|
|
782
|
+
const { total, rows, warning } = summarize(scan.counts);
|
|
783
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", gap: 1, children: [
|
|
784
|
+
/* @__PURE__ */ jsxs5(Text6, { children: [
|
|
785
|
+
"Scanned ",
|
|
786
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: path })
|
|
787
|
+
] }),
|
|
788
|
+
/* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
|
|
789
|
+
/* @__PURE__ */ jsxs5(Text6, { color: PALETTE.success, children: [
|
|
790
|
+
"\u2713 Found ",
|
|
791
|
+
total,
|
|
792
|
+
" files:"
|
|
793
|
+
] }),
|
|
794
|
+
rows.map((row) => /* @__PURE__ */ jsx6(Row, { row }, row.label))
|
|
795
|
+
] }),
|
|
796
|
+
warning && /* @__PURE__ */ jsxs5(Text6, { color: PALETTE.warning, children: [
|
|
797
|
+
"\u26A0 ",
|
|
798
|
+
warning
|
|
799
|
+
] }),
|
|
800
|
+
/* @__PURE__ */ jsx6(Text6, { children: "Does this look right?" })
|
|
801
|
+
] });
|
|
802
|
+
}
|
|
803
|
+
function PathValidationScreen({
|
|
804
|
+
projectPath,
|
|
805
|
+
onConfirm,
|
|
806
|
+
onChangePath,
|
|
807
|
+
onBack
|
|
808
|
+
}) {
|
|
809
|
+
const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
|
|
810
|
+
const [scan, setScan] = useState5();
|
|
811
|
+
useEffect3(() => {
|
|
812
|
+
let cancelled = false;
|
|
813
|
+
setScan(void 0);
|
|
814
|
+
void scanProject(resolvedPath).then((result) => {
|
|
815
|
+
if (!cancelled) setScan(result);
|
|
816
|
+
});
|
|
817
|
+
return () => {
|
|
818
|
+
cancelled = true;
|
|
819
|
+
};
|
|
820
|
+
}, [resolvedPath]);
|
|
821
|
+
const phase = phaseOf(scan);
|
|
822
|
+
usePathValidationControls(phase, { onConfirm: () => onConfirm(resolvedPath), onChangePath, onBack });
|
|
823
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
824
|
+
scan === void 0 && /* @__PURE__ */ jsxs5(Text6, { dimColor: true, children: [
|
|
825
|
+
"Scanning ",
|
|
826
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: resolvedPath }),
|
|
827
|
+
"..."
|
|
828
|
+
] }),
|
|
829
|
+
scan?.ok === false && /* @__PURE__ */ jsx6(Failure, { scan, path: resolvedPath }),
|
|
830
|
+
scan?.ok === true && /* @__PURE__ */ jsx6(Summary, { scan, path: resolvedPath }),
|
|
831
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, gap: 3, children: controlsFor(phase).map((control) => /* @__PURE__ */ jsxs5(Text6, { dimColor: true, children: [
|
|
832
|
+
"[",
|
|
833
|
+
control.keys,
|
|
834
|
+
"] ",
|
|
835
|
+
control.label
|
|
836
|
+
] }, control.keys)) })
|
|
837
|
+
] });
|
|
838
|
+
}
|
|
839
|
+
var init_screen3 = __esm({
|
|
840
|
+
"packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx"() {
|
|
841
|
+
"use strict";
|
|
842
|
+
init_home_theme();
|
|
843
|
+
init_resolve_user_path();
|
|
844
|
+
init_controls3();
|
|
845
|
+
init_loader();
|
|
846
|
+
init_logic3();
|
|
847
|
+
}
|
|
848
|
+
});
|
|
849
|
+
|
|
544
850
|
// packages/experience-design-system-cli/src/tui/import/steps/index.ts
|
|
545
851
|
var init_steps = __esm({
|
|
546
852
|
"packages/experience-design-system-cli/src/tui/import/steps/index.ts"() {
|
|
547
853
|
"use strict";
|
|
548
854
|
init_screen();
|
|
549
855
|
init_screen2();
|
|
856
|
+
init_screen3();
|
|
550
857
|
}
|
|
551
858
|
});
|
|
552
859
|
|
|
@@ -611,9 +918,9 @@ var init_terminal_input = __esm({
|
|
|
611
918
|
import { randomBytes } from "node:crypto";
|
|
612
919
|
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
613
920
|
import { homedir as homedir2 } from "node:os";
|
|
614
|
-
import { dirname as dirname2, join as
|
|
921
|
+
import { dirname as dirname2, join as join6 } from "node:path";
|
|
615
922
|
function configRoot() {
|
|
616
|
-
return process.env["EDS_HOME"] ||
|
|
923
|
+
return process.env["EDS_HOME"] || join6(homedir2(), ".contentful", "experience-design-system-cli");
|
|
617
924
|
}
|
|
618
925
|
async function readSettings() {
|
|
619
926
|
try {
|
|
@@ -637,10 +944,10 @@ var configFilePath, runsFilePath, debugSessionsDir, oldConfigDir;
|
|
|
637
944
|
var init_config = __esm({
|
|
638
945
|
"packages/experience-design-system-types/dist/src/config/index.js"() {
|
|
639
946
|
"use strict";
|
|
640
|
-
configFilePath = () =>
|
|
641
|
-
runsFilePath = () =>
|
|
642
|
-
debugSessionsDir = () =>
|
|
643
|
-
oldConfigDir = () =>
|
|
947
|
+
configFilePath = () => join6(configRoot(), "config.json");
|
|
948
|
+
runsFilePath = () => join6(configRoot(), "state", "runs.json");
|
|
949
|
+
debugSessionsDir = () => join6(configRoot(), "debug", "sessions");
|
|
950
|
+
oldConfigDir = () => join6(homedir2(), ".config", "experiences");
|
|
644
951
|
}
|
|
645
952
|
});
|
|
646
953
|
|
|
@@ -666,7 +973,7 @@ var init_debug_mode_store = __esm({
|
|
|
666
973
|
// packages/experience-design-system-cli/src/tui/debug-store.ts
|
|
667
974
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
668
975
|
import { existsSync as existsSync4, readdirSync } from "node:fs";
|
|
669
|
-
import { join as
|
|
976
|
+
import { join as join7 } from "node:path";
|
|
670
977
|
function generateRunId() {
|
|
671
978
|
const now = /* @__PURE__ */ new Date();
|
|
672
979
|
const pad = (n) => String(n).padStart(2, "0");
|
|
@@ -691,7 +998,7 @@ function generateSessionId() {
|
|
|
691
998
|
return `${today}-session-${maxSeq + 1}`;
|
|
692
999
|
}
|
|
693
1000
|
function sessionDebugDir() {
|
|
694
|
-
return
|
|
1001
|
+
return join7(debugSessionsDir(), SESSION_ID);
|
|
695
1002
|
}
|
|
696
1003
|
function currentDebugSessionDir() {
|
|
697
1004
|
return sessionDebugDir();
|
|
@@ -736,10 +1043,10 @@ async function finishDebugRun({
|
|
|
736
1043
|
const durationMs = Date.now() - run.startedAt;
|
|
737
1044
|
const content = renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs });
|
|
738
1045
|
const flowSegments = run.flow.split("/");
|
|
739
|
-
const dir =
|
|
1046
|
+
const dir = join7(sessionDebugDir(), ...flowSegments);
|
|
740
1047
|
await mkdir2(dir, { recursive: true });
|
|
741
1048
|
const filename = nextAttemptFilename(dir, run.menuOption);
|
|
742
|
-
await writeFile2(
|
|
1049
|
+
await writeFile2(join7(dir, filename), content, { mode: 384 });
|
|
743
1050
|
}
|
|
744
1051
|
function nextAttemptFilename(dir, menuOption) {
|
|
745
1052
|
const today = datePrefix();
|
|
@@ -845,21 +1152,21 @@ var init_help_info = __esm({
|
|
|
845
1152
|
});
|
|
846
1153
|
|
|
847
1154
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
848
|
-
import { useEffect as
|
|
849
|
-
import { Box as
|
|
850
|
-
import { Fragment, jsx as
|
|
1155
|
+
import { useEffect as useEffect4, useState as useState6 } from "react";
|
|
1156
|
+
import { Box as Box6, Text as Text7, useInput as useInput6 } from "ink";
|
|
1157
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
851
1158
|
function Section({ title, rows }) {
|
|
852
|
-
return /* @__PURE__ */
|
|
853
|
-
/* @__PURE__ */
|
|
854
|
-
rows.map((row) => /* @__PURE__ */
|
|
855
|
-
/* @__PURE__ */
|
|
856
|
-
/* @__PURE__ */
|
|
1159
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
|
|
1160
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, color: PALETTE.accent, children: title }),
|
|
1161
|
+
rows.map((row) => /* @__PURE__ */ jsxs6(Box6, { gap: 1, children: [
|
|
1162
|
+
/* @__PURE__ */ jsx7(Box6, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: row.label }) }),
|
|
1163
|
+
/* @__PURE__ */ jsx7(Text7, { children: row.value })
|
|
857
1164
|
] }, row.label))
|
|
858
1165
|
] });
|
|
859
1166
|
}
|
|
860
1167
|
function HelpScreen({ onDone }) {
|
|
861
|
-
const [info, setInfo] =
|
|
862
|
-
|
|
1168
|
+
const [info, setInfo] = useState6();
|
|
1169
|
+
useEffect4(() => {
|
|
863
1170
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
864
1171
|
void readHelpInfo().then(setInfo);
|
|
865
1172
|
}, []);
|
|
@@ -867,7 +1174,7 @@ function HelpScreen({ onDone }) {
|
|
|
867
1174
|
void finishDebugRun({ outputs: {}, status: "success", exitMethod });
|
|
868
1175
|
onDone();
|
|
869
1176
|
};
|
|
870
|
-
|
|
1177
|
+
useInput6((input, key) => {
|
|
871
1178
|
if (key.return) {
|
|
872
1179
|
leave("saved");
|
|
873
1180
|
return;
|
|
@@ -877,14 +1184,14 @@ function HelpScreen({ onDone }) {
|
|
|
877
1184
|
return;
|
|
878
1185
|
}
|
|
879
1186
|
});
|
|
880
|
-
return /* @__PURE__ */
|
|
881
|
-
/* @__PURE__ */
|
|
882
|
-
info ? /* @__PURE__ */
|
|
883
|
-
/* @__PURE__ */
|
|
884
|
-
/* @__PURE__ */
|
|
885
|
-
/* @__PURE__ */
|
|
886
|
-
] }) : /* @__PURE__ */
|
|
887
|
-
/* @__PURE__ */
|
|
1187
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, gap: 1, children: [
|
|
1188
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, children: "Help" }),
|
|
1189
|
+
info ? /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
1190
|
+
/* @__PURE__ */ jsx7(Section, { title: "Where things are stored", rows: info.storage }),
|
|
1191
|
+
/* @__PURE__ */ jsx7(Section, { title: "Troubleshooting", rows: info.troubleshooting }),
|
|
1192
|
+
/* @__PURE__ */ jsx7(Text7, { 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." })
|
|
1193
|
+
] }) : /* @__PURE__ */ jsx7(Text7, { color: PALETTE.accent, children: "Loading..." }),
|
|
1194
|
+
/* @__PURE__ */ jsx7(
|
|
888
1195
|
ControlHints,
|
|
889
1196
|
{
|
|
890
1197
|
hints: [
|
|
@@ -906,20 +1213,20 @@ var init_PageContainer2 = __esm({
|
|
|
906
1213
|
});
|
|
907
1214
|
|
|
908
1215
|
// packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
|
|
909
|
-
import { useState as
|
|
910
|
-
import { Box as
|
|
911
|
-
import { jsx as
|
|
1216
|
+
import { useState as useState7 } from "react";
|
|
1217
|
+
import { Box as Box7, Text as Text8, useInput as useInput7 } from "ink";
|
|
1218
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
912
1219
|
function SettingsScreen({
|
|
913
1220
|
onNavigate,
|
|
914
1221
|
onBack
|
|
915
1222
|
}) {
|
|
916
|
-
const [focusIdx, setFocusIdx] =
|
|
1223
|
+
const [focusIdx, setFocusIdx] = useState7(0);
|
|
917
1224
|
const items = [
|
|
918
1225
|
{ label: "Configuration", screen: "settings-configuration" },
|
|
919
1226
|
{ label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
|
|
920
1227
|
{ label: "Debug Mode", screen: "settings-debug-mode" }
|
|
921
1228
|
];
|
|
922
|
-
|
|
1229
|
+
useInput7((input, key) => {
|
|
923
1230
|
if (key.upArrow) {
|
|
924
1231
|
setFocusIdx((i) => (i - 1 + items.length) % items.length);
|
|
925
1232
|
return;
|
|
@@ -939,15 +1246,15 @@ function SettingsScreen({
|
|
|
939
1246
|
onBack();
|
|
940
1247
|
}
|
|
941
1248
|
});
|
|
942
|
-
return /* @__PURE__ */
|
|
943
|
-
/* @__PURE__ */
|
|
944
|
-
/* @__PURE__ */
|
|
945
|
-
items.map((item, i) => /* @__PURE__ */
|
|
1249
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1250
|
+
/* @__PURE__ */ jsx8(Text8, { bold: true, children: "Settings" }),
|
|
1251
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
1252
|
+
items.map((item, i) => /* @__PURE__ */ jsxs7(Text8, { color: i === focusIdx ? "cyan" : void 0, children: [
|
|
946
1253
|
i === focusIdx ? "> " : " ",
|
|
947
1254
|
item.label
|
|
948
1255
|
] }, item.label)),
|
|
949
|
-
/* @__PURE__ */
|
|
950
|
-
/* @__PURE__ */
|
|
1256
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
1257
|
+
/* @__PURE__ */ jsx8(
|
|
951
1258
|
ControlHints,
|
|
952
1259
|
{
|
|
953
1260
|
hints: [
|
|
@@ -1008,10 +1315,10 @@ var init_config_store = __esm({
|
|
|
1008
1315
|
});
|
|
1009
1316
|
|
|
1010
1317
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
1011
|
-
import { useEffect as
|
|
1012
|
-
import { Box as
|
|
1318
|
+
import { useEffect as useEffect5, useState as useState8 } from "react";
|
|
1319
|
+
import { Box as Box8, Text as Text9, useInput as useInput8 } from "ink";
|
|
1013
1320
|
import TextInput3 from "ink-text-input";
|
|
1014
|
-
import { Fragment as Fragment2, jsx as
|
|
1321
|
+
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1015
1322
|
function debugFields(config) {
|
|
1016
1323
|
return {
|
|
1017
1324
|
space_id: config?.spaceId ?? "",
|
|
@@ -1023,14 +1330,14 @@ function debugFields(config) {
|
|
|
1023
1330
|
};
|
|
1024
1331
|
}
|
|
1025
1332
|
function ConfigurationScreen({ onDone }) {
|
|
1026
|
-
const [stage, setStage] =
|
|
1027
|
-
const [config, setConfig] =
|
|
1028
|
-
const [activeField, setActiveField] =
|
|
1029
|
-
const [notice, setNotice] =
|
|
1030
|
-
const [lastSaved, setLastSaved] =
|
|
1031
|
-
const [editing, setEditing] =
|
|
1032
|
-
const [valueBeforeEdit, setValueBeforeEdit] =
|
|
1033
|
-
|
|
1333
|
+
const [stage, setStage] = useState8("loading");
|
|
1334
|
+
const [config, setConfig] = useState8(null);
|
|
1335
|
+
const [activeField, setActiveField] = useState8("spaceId");
|
|
1336
|
+
const [notice, setNotice] = useState8(null);
|
|
1337
|
+
const [lastSaved, setLastSaved] = useState8(null);
|
|
1338
|
+
const [editing, setEditing] = useState8(false);
|
|
1339
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState8("");
|
|
1340
|
+
useEffect5(() => {
|
|
1034
1341
|
readCredentials().then((cfg) => {
|
|
1035
1342
|
setConfig(cfg);
|
|
1036
1343
|
setStage("form");
|
|
@@ -1070,7 +1377,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1070
1377
|
);
|
|
1071
1378
|
onDone();
|
|
1072
1379
|
}
|
|
1073
|
-
|
|
1380
|
+
useInput8((input, key) => {
|
|
1074
1381
|
if (stage === "loading" || stage === "saving") return;
|
|
1075
1382
|
if (editing) {
|
|
1076
1383
|
if (key.escape) {
|
|
@@ -1107,26 +1414,26 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1107
1414
|
}
|
|
1108
1415
|
});
|
|
1109
1416
|
if (stage === "loading") {
|
|
1110
|
-
return /* @__PURE__ */
|
|
1111
|
-
/* @__PURE__ */
|
|
1112
|
-
/* @__PURE__ */
|
|
1113
|
-
/* @__PURE__ */
|
|
1417
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1418
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, children: "Configuration" }),
|
|
1419
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1420
|
+
/* @__PURE__ */ jsx9(Text9, { color: PALETTE.accent, children: "Loading..." })
|
|
1114
1421
|
] });
|
|
1115
1422
|
}
|
|
1116
|
-
return /* @__PURE__ */
|
|
1117
|
-
/* @__PURE__ */
|
|
1118
|
-
/* @__PURE__ */
|
|
1119
|
-
/* @__PURE__ */
|
|
1423
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1424
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, children: "Configuration" }),
|
|
1425
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1426
|
+
/* @__PURE__ */ jsx9(Box8, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
|
|
1120
1427
|
const isActive = activeField === field;
|
|
1121
1428
|
const value = fieldValue(field);
|
|
1122
1429
|
const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
|
|
1123
|
-
return /* @__PURE__ */
|
|
1124
|
-
/* @__PURE__ */
|
|
1125
|
-
/* @__PURE__ */
|
|
1430
|
+
return /* @__PURE__ */ jsxs8(Box8, { gap: 1, children: [
|
|
1431
|
+
/* @__PURE__ */ jsx9(Text9, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
1432
|
+
/* @__PURE__ */ jsxs8(Text9, { bold: isActive, children: [
|
|
1126
1433
|
FIELD_LABELS[field],
|
|
1127
1434
|
":"
|
|
1128
1435
|
] }),
|
|
1129
|
-
isActive && editing ? /* @__PURE__ */
|
|
1436
|
+
isActive && editing ? /* @__PURE__ */ jsx9(
|
|
1130
1437
|
TextInput3,
|
|
1131
1438
|
{
|
|
1132
1439
|
value,
|
|
@@ -1134,19 +1441,19 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1134
1441
|
onSubmit: () => setEditing(false),
|
|
1135
1442
|
mask: field === "cmaToken" ? "\u2022" : void 0
|
|
1136
1443
|
}
|
|
1137
|
-
) : /* @__PURE__ */
|
|
1444
|
+
) : /* @__PURE__ */ jsx9(Text9, { children: display || /* @__PURE__ */ jsx9(Text9, { dimColor: true, children: "(empty)" }) })
|
|
1138
1445
|
] }, field);
|
|
1139
1446
|
}) }),
|
|
1140
|
-
notice && /* @__PURE__ */
|
|
1141
|
-
/* @__PURE__ */
|
|
1142
|
-
/* @__PURE__ */
|
|
1447
|
+
notice && /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
1448
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1449
|
+
/* @__PURE__ */ jsxs8(Text9, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
1143
1450
|
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
1144
1451
|
" ",
|
|
1145
1452
|
notice.text
|
|
1146
1453
|
] })
|
|
1147
1454
|
] }),
|
|
1148
|
-
/* @__PURE__ */
|
|
1149
|
-
/* @__PURE__ */
|
|
1455
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1456
|
+
/* @__PURE__ */ jsx9(
|
|
1150
1457
|
ControlHints,
|
|
1151
1458
|
{
|
|
1152
1459
|
hints: editing ? [
|
|
@@ -1214,13 +1521,13 @@ var init_analytics_store = __esm({
|
|
|
1214
1521
|
});
|
|
1215
1522
|
|
|
1216
1523
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
1217
|
-
import { useEffect as
|
|
1218
|
-
import { Box as
|
|
1219
|
-
import { Fragment as Fragment3, jsx as
|
|
1524
|
+
import { useEffect as useEffect6, useState as useState9 } from "react";
|
|
1525
|
+
import { Box as Box9, Text as Text10, useInput as useInput9 } from "ink";
|
|
1526
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1220
1527
|
function OptInAnalyticsScreen({ onDone }) {
|
|
1221
|
-
const [loading, setLoading] =
|
|
1222
|
-
const [enabled, setEnabled] =
|
|
1223
|
-
|
|
1528
|
+
const [loading, setLoading] = useState9(true);
|
|
1529
|
+
const [enabled, setEnabled] = useState9(true);
|
|
1530
|
+
useEffect6(() => {
|
|
1224
1531
|
readAnalyticsSetting().then((setting) => {
|
|
1225
1532
|
setEnabled(setting.enabled);
|
|
1226
1533
|
setLoading(false);
|
|
@@ -1232,7 +1539,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1232
1539
|
});
|
|
1233
1540
|
});
|
|
1234
1541
|
}, []);
|
|
1235
|
-
|
|
1542
|
+
useInput9((input, key) => {
|
|
1236
1543
|
if (loading) return;
|
|
1237
1544
|
if (key.return || input === " ") {
|
|
1238
1545
|
setEnabled((current) => {
|
|
@@ -1247,21 +1554,21 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1247
1554
|
onDone();
|
|
1248
1555
|
}
|
|
1249
1556
|
});
|
|
1250
|
-
return /* @__PURE__ */
|
|
1251
|
-
/* @__PURE__ */
|
|
1252
|
-
/* @__PURE__ */
|
|
1253
|
-
loading ? /* @__PURE__ */
|
|
1254
|
-
/* @__PURE__ */
|
|
1557
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1558
|
+
/* @__PURE__ */ jsx10(Text10, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
|
|
1559
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1560
|
+
loading ? /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
1561
|
+
/* @__PURE__ */ jsxs9(Text10, { children: [
|
|
1255
1562
|
"Share anonymous usage data:",
|
|
1256
1563
|
" ",
|
|
1257
|
-
/* @__PURE__ */
|
|
1564
|
+
/* @__PURE__ */ jsx10(Text10, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
1258
1565
|
] }),
|
|
1259
|
-
/* @__PURE__ */
|
|
1260
|
-
/* @__PURE__ */
|
|
1261
|
-
/* @__PURE__ */
|
|
1566
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1567
|
+
/* @__PURE__ */ jsx10(Text10, { dimColor: true, children: "Shares which CLI commands are used and where imports succeed or fail." }),
|
|
1568
|
+
/* @__PURE__ */ jsx10(Text10, { dimColor: true, children: "Never includes source code, file paths, credentials, or authored content." })
|
|
1262
1569
|
] }),
|
|
1263
|
-
/* @__PURE__ */
|
|
1264
|
-
/* @__PURE__ */
|
|
1570
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1571
|
+
/* @__PURE__ */ jsx10(
|
|
1265
1572
|
ControlHints,
|
|
1266
1573
|
{
|
|
1267
1574
|
hints: [
|
|
@@ -1272,7 +1579,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1272
1579
|
)
|
|
1273
1580
|
] });
|
|
1274
1581
|
}
|
|
1275
|
-
var
|
|
1582
|
+
var init_screen4 = __esm({
|
|
1276
1583
|
"packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx"() {
|
|
1277
1584
|
"use strict";
|
|
1278
1585
|
init_home_theme();
|
|
@@ -1283,12 +1590,12 @@ var init_screen3 = __esm({
|
|
|
1283
1590
|
});
|
|
1284
1591
|
|
|
1285
1592
|
// packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
|
|
1286
|
-
import { useEffect as
|
|
1287
|
-
import { Box as
|
|
1288
|
-
import { jsx as
|
|
1593
|
+
import { useEffect as useEffect7, useState as useState10 } from "react";
|
|
1594
|
+
import { Box as Box10, Text as Text11, useInput as useInput10 } from "ink";
|
|
1595
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1289
1596
|
function UpgradeScreen({ onDone }) {
|
|
1290
|
-
const [upgradeCheck, setUpgradeCheck] =
|
|
1291
|
-
|
|
1597
|
+
const [upgradeCheck, setUpgradeCheck] = useState10();
|
|
1598
|
+
useEffect7(() => {
|
|
1292
1599
|
startDebugRun({
|
|
1293
1600
|
flow: "upgrade",
|
|
1294
1601
|
step: "01-upgrade",
|
|
@@ -1297,7 +1604,7 @@ function UpgradeScreen({ onDone }) {
|
|
|
1297
1604
|
});
|
|
1298
1605
|
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
1299
1606
|
}, []);
|
|
1300
|
-
|
|
1607
|
+
useInput10((_input, key) => {
|
|
1301
1608
|
if (key.return) {
|
|
1302
1609
|
void finishDebugRun({
|
|
1303
1610
|
outputs: upgradeCheck ?? {},
|
|
@@ -1308,12 +1615,12 @@ function UpgradeScreen({ onDone }) {
|
|
|
1308
1615
|
return;
|
|
1309
1616
|
}
|
|
1310
1617
|
});
|
|
1311
|
-
return /* @__PURE__ */
|
|
1312
|
-
/* @__PURE__ */
|
|
1313
|
-
/* @__PURE__ */
|
|
1618
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1619
|
+
/* @__PURE__ */ jsx11(Text11, { bold: true, children: "Upgrade" }),
|
|
1620
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1314
1621
|
renderBody(upgradeCheck),
|
|
1315
|
-
/* @__PURE__ */
|
|
1316
|
-
/* @__PURE__ */
|
|
1622
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1623
|
+
/* @__PURE__ */ jsxs10(Text11, { bold: true, color: PALETTE.accent, children: [
|
|
1317
1624
|
FOCUS_MARKER,
|
|
1318
1625
|
" Go Back"
|
|
1319
1626
|
] })
|
|
@@ -1321,34 +1628,34 @@ function UpgradeScreen({ onDone }) {
|
|
|
1321
1628
|
}
|
|
1322
1629
|
function renderBody(upgradeCheck) {
|
|
1323
1630
|
if (!upgradeCheck) {
|
|
1324
|
-
return /* @__PURE__ */
|
|
1631
|
+
return /* @__PURE__ */ jsx11(Text11, { color: PALETTE.muted, children: "Checking for updates\u2026" });
|
|
1325
1632
|
}
|
|
1326
1633
|
if (upgradeCheck.status === "error") {
|
|
1327
|
-
return /* @__PURE__ */
|
|
1634
|
+
return /* @__PURE__ */ jsx11(Text11, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
|
|
1328
1635
|
}
|
|
1329
1636
|
if (upgradeCheck.status === "up-to-date") {
|
|
1330
|
-
return /* @__PURE__ */
|
|
1637
|
+
return /* @__PURE__ */ jsxs10(Text11, { color: PALETTE.success, children: [
|
|
1331
1638
|
"You're already on the latest version (v",
|
|
1332
1639
|
upgradeCheck.current,
|
|
1333
1640
|
")."
|
|
1334
1641
|
] });
|
|
1335
1642
|
}
|
|
1336
|
-
return /* @__PURE__ */
|
|
1337
|
-
/* @__PURE__ */
|
|
1338
|
-
/* @__PURE__ */
|
|
1643
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", children: [
|
|
1644
|
+
/* @__PURE__ */ jsxs10(Text11, { color: PALETTE.muted, children: [
|
|
1645
|
+
/* @__PURE__ */ jsxs10(Text11, { bold: true, color: PALETTE.success, children: [
|
|
1339
1646
|
"v",
|
|
1340
1647
|
upgradeCheck.latest
|
|
1341
1648
|
] }),
|
|
1342
1649
|
" ",
|
|
1343
1650
|
"is available (you're on ",
|
|
1344
|
-
/* @__PURE__ */
|
|
1651
|
+
/* @__PURE__ */ jsxs10(Text11, { bold: true, children: [
|
|
1345
1652
|
"v",
|
|
1346
1653
|
upgradeCheck.current
|
|
1347
1654
|
] }),
|
|
1348
1655
|
"). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
|
|
1349
1656
|
] }),
|
|
1350
|
-
/* @__PURE__ */
|
|
1351
|
-
/* @__PURE__ */
|
|
1657
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1658
|
+
/* @__PURE__ */ jsx11(Box10, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx11(Text11, { bold: true, children: cmd }, cmd)) })
|
|
1352
1659
|
] });
|
|
1353
1660
|
}
|
|
1354
1661
|
var UPGRADE_COMMANDS;
|
|
@@ -1363,13 +1670,13 @@ var init_PageContainer4 = __esm({
|
|
|
1363
1670
|
});
|
|
1364
1671
|
|
|
1365
1672
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
1366
|
-
import { useEffect as
|
|
1367
|
-
import { Box as
|
|
1368
|
-
import { jsx as
|
|
1673
|
+
import { useEffect as useEffect8, useState as useState11 } from "react";
|
|
1674
|
+
import { Box as Box11, Text as Text12, useInput as useInput11 } from "ink";
|
|
1675
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1369
1676
|
function DebugModeScreen({ onDone }) {
|
|
1370
|
-
const [loading, setLoading] =
|
|
1371
|
-
const [enabled, setEnabled] =
|
|
1372
|
-
|
|
1677
|
+
const [loading, setLoading] = useState11(true);
|
|
1678
|
+
const [enabled, setEnabled] = useState11(true);
|
|
1679
|
+
useEffect8(() => {
|
|
1373
1680
|
readDebugModeSetting().then((setting) => {
|
|
1374
1681
|
setEnabled(setting.enabled);
|
|
1375
1682
|
setLoading(false);
|
|
@@ -1381,7 +1688,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
1381
1688
|
});
|
|
1382
1689
|
});
|
|
1383
1690
|
}, []);
|
|
1384
|
-
|
|
1691
|
+
useInput11((input, key) => {
|
|
1385
1692
|
if (loading) return;
|
|
1386
1693
|
if (key.return || input === " ") {
|
|
1387
1694
|
setEnabled((current) => {
|
|
@@ -1396,16 +1703,16 @@ function DebugModeScreen({ onDone }) {
|
|
|
1396
1703
|
onDone();
|
|
1397
1704
|
}
|
|
1398
1705
|
});
|
|
1399
|
-
return /* @__PURE__ */
|
|
1400
|
-
/* @__PURE__ */
|
|
1401
|
-
/* @__PURE__ */
|
|
1402
|
-
loading ? /* @__PURE__ */
|
|
1706
|
+
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1707
|
+
/* @__PURE__ */ jsx12(Text12, { bold: true, children: "Settings \u203A Debug Mode" }),
|
|
1708
|
+
/* @__PURE__ */ jsx12(Text12, { children: " " }),
|
|
1709
|
+
loading ? /* @__PURE__ */ jsx12(Text12, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs11(Text12, { children: [
|
|
1403
1710
|
"Debug logging:",
|
|
1404
1711
|
" ",
|
|
1405
|
-
/* @__PURE__ */
|
|
1712
|
+
/* @__PURE__ */ jsx12(Text12, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
1406
1713
|
] }),
|
|
1407
|
-
/* @__PURE__ */
|
|
1408
|
-
/* @__PURE__ */
|
|
1714
|
+
/* @__PURE__ */ jsx12(Text12, { children: " " }),
|
|
1715
|
+
/* @__PURE__ */ jsx12(
|
|
1409
1716
|
ControlHints,
|
|
1410
1717
|
{
|
|
1411
1718
|
hints: [
|
|
@@ -1416,7 +1723,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
1416
1723
|
)
|
|
1417
1724
|
] });
|
|
1418
1725
|
}
|
|
1419
|
-
var
|
|
1726
|
+
var init_screen5 = __esm({
|
|
1420
1727
|
"packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx"() {
|
|
1421
1728
|
"use strict";
|
|
1422
1729
|
init_home_theme();
|
|
@@ -1431,15 +1738,16 @@ var app_exports = {};
|
|
|
1431
1738
|
__export(app_exports, {
|
|
1432
1739
|
runApp: () => runApp
|
|
1433
1740
|
});
|
|
1434
|
-
import { useEffect as
|
|
1435
|
-
import { Fragment as Fragment4, jsx as
|
|
1741
|
+
import { useEffect as useEffect9, useState as useState12 } from "react";
|
|
1742
|
+
import { Fragment as Fragment4, jsx as jsx13 } from "react/jsx-runtime";
|
|
1436
1743
|
function App({ onLaunchImport, importExitCode }) {
|
|
1437
1744
|
const returnedFromImport = importExitCode !== void 0;
|
|
1438
|
-
const [screen, setScreen] =
|
|
1439
|
-
const [showImportResult, setShowImportResult] =
|
|
1440
|
-
const [projectPath, setProjectPath] =
|
|
1441
|
-
const [
|
|
1442
|
-
|
|
1745
|
+
const [screen, setScreen] = useState12(returnedFromImport ? "import" : "start");
|
|
1746
|
+
const [showImportResult, setShowImportResult] = useState12(returnedFromImport);
|
|
1747
|
+
const [projectPath, setProjectPath] = useState12();
|
|
1748
|
+
const [tokensPath, setTokensPath] = useState12();
|
|
1749
|
+
const [importDefaults, setImportDefaults] = useState12();
|
|
1750
|
+
useEffect9(() => {
|
|
1443
1751
|
if (screen !== "import") {
|
|
1444
1752
|
setImportDefaults(void 0);
|
|
1445
1753
|
return;
|
|
@@ -1450,50 +1758,65 @@ function App({ onLaunchImport, importExitCode }) {
|
|
|
1450
1758
|
}, [screen]);
|
|
1451
1759
|
const goToStart = () => setScreen("start");
|
|
1452
1760
|
const goToSettings = () => setScreen("settings");
|
|
1761
|
+
const resetImport = () => {
|
|
1762
|
+
setProjectPath(void 0);
|
|
1763
|
+
setTokensPath(void 0);
|
|
1764
|
+
};
|
|
1453
1765
|
const finishImportResult = () => {
|
|
1454
1766
|
setShowImportResult(false);
|
|
1455
|
-
|
|
1767
|
+
resetImport();
|
|
1456
1768
|
goToStart();
|
|
1457
1769
|
};
|
|
1458
1770
|
const leaveImport = () => {
|
|
1459
|
-
|
|
1771
|
+
resetImport();
|
|
1460
1772
|
goToStart();
|
|
1461
1773
|
};
|
|
1462
1774
|
switch (screen) {
|
|
1463
1775
|
case "import":
|
|
1464
|
-
if (showImportResult) return /* @__PURE__ */
|
|
1465
|
-
if (importDefaults === void 0) return /* @__PURE__ */
|
|
1776
|
+
if (showImportResult) return /* @__PURE__ */ jsx13(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
|
|
1777
|
+
if (importDefaults === void 0) return /* @__PURE__ */ jsx13(Fragment4, {});
|
|
1466
1778
|
if (projectPath === void 0) {
|
|
1467
|
-
return /* @__PURE__ */
|
|
1779
|
+
return /* @__PURE__ */ jsx13(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
|
|
1780
|
+
}
|
|
1781
|
+
if (tokensPath === void 0) {
|
|
1782
|
+
return /* @__PURE__ */ jsx13(
|
|
1783
|
+
TokenInputScreen,
|
|
1784
|
+
{
|
|
1785
|
+
initialPath: importDefaults.tokenFile,
|
|
1786
|
+
onConfirm: setTokensPath,
|
|
1787
|
+
onBack: () => setProjectPath(void 0)
|
|
1788
|
+
}
|
|
1789
|
+
);
|
|
1468
1790
|
}
|
|
1469
|
-
return /* @__PURE__ */
|
|
1470
|
-
|
|
1791
|
+
return /* @__PURE__ */ jsx13(
|
|
1792
|
+
PathValidationScreen,
|
|
1471
1793
|
{
|
|
1472
|
-
|
|
1473
|
-
onConfirm: (
|
|
1474
|
-
|
|
1794
|
+
projectPath,
|
|
1795
|
+
onConfirm: (project) => onLaunchImport?.({ project, tokens: tokensPath }),
|
|
1796
|
+
onChangePath: resetImport,
|
|
1797
|
+
onBack: () => setTokensPath(void 0)
|
|
1475
1798
|
}
|
|
1476
1799
|
);
|
|
1477
1800
|
case "help":
|
|
1478
|
-
return /* @__PURE__ */
|
|
1801
|
+
return /* @__PURE__ */ jsx13(HelpScreen, { onDone: goToStart });
|
|
1479
1802
|
case "upgrade":
|
|
1480
|
-
return /* @__PURE__ */
|
|
1803
|
+
return /* @__PURE__ */ jsx13(UpgradeScreen, { onDone: goToStart });
|
|
1481
1804
|
case "settings":
|
|
1482
|
-
return /* @__PURE__ */
|
|
1805
|
+
return /* @__PURE__ */ jsx13(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
1483
1806
|
case "settings-configuration":
|
|
1484
|
-
return /* @__PURE__ */
|
|
1807
|
+
return /* @__PURE__ */ jsx13(ConfigurationScreen, { onDone: goToSettings });
|
|
1485
1808
|
case "settings-opt-in-analytics":
|
|
1486
|
-
return /* @__PURE__ */
|
|
1809
|
+
return /* @__PURE__ */ jsx13(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
1487
1810
|
case "settings-debug-mode":
|
|
1488
|
-
return /* @__PURE__ */
|
|
1811
|
+
return /* @__PURE__ */ jsx13(DebugModeScreen, { onDone: goToSettings });
|
|
1489
1812
|
case "start":
|
|
1490
|
-
return /* @__PURE__ */
|
|
1813
|
+
return /* @__PURE__ */ jsx13(HomeScreen, { onNavigate: setScreen });
|
|
1491
1814
|
}
|
|
1492
1815
|
}
|
|
1493
1816
|
async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
|
|
1494
1817
|
let requestedImport;
|
|
1495
1818
|
const instance = renderApp(
|
|
1496
|
-
/* @__PURE__ */
|
|
1819
|
+
/* @__PURE__ */ jsx13(
|
|
1497
1820
|
App,
|
|
1498
1821
|
{
|
|
1499
1822
|
importExitCode,
|
|
@@ -1532,9 +1855,9 @@ var init_app = __esm({
|
|
|
1532
1855
|
init_PageContainer2();
|
|
1533
1856
|
init_PageContainer3();
|
|
1534
1857
|
init_ContentfulConfigScreen();
|
|
1535
|
-
init_screen3();
|
|
1536
|
-
init_PageContainer4();
|
|
1537
1858
|
init_screen4();
|
|
1859
|
+
init_PageContainer4();
|
|
1860
|
+
init_screen5();
|
|
1538
1861
|
init_config_store();
|
|
1539
1862
|
CLEAR_SCREEN = "\x1B[2J\x1B[H";
|
|
1540
1863
|
}
|
|
@@ -1542,7 +1865,7 @@ var init_app = __esm({
|
|
|
1542
1865
|
|
|
1543
1866
|
// packages/experience-design-system-cli/program.ts
|
|
1544
1867
|
import { readFileSync as readFileSync3 } from "node:fs";
|
|
1545
|
-
import { join as
|
|
1868
|
+
import { join as join8 } from "node:path";
|
|
1546
1869
|
import { Command } from "commander";
|
|
1547
1870
|
|
|
1548
1871
|
// packages/experience-design-system-cli/src/legacy/run-legacy.ts
|
|
@@ -1647,7 +1970,7 @@ function registerImportCommand(program, openTui) {
|
|
|
1647
1970
|
init_package_root();
|
|
1648
1971
|
var pkg = JSON.parse(
|
|
1649
1972
|
readFileSync3(
|
|
1650
|
-
|
|
1973
|
+
join8(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
|
|
1651
1974
|
"utf8"
|
|
1652
1975
|
)
|
|
1653
1976
|
);
|
|
@@ -1667,7 +1990,7 @@ init_config();
|
|
|
1667
1990
|
init_package_root();
|
|
1668
1991
|
import { existsSync as existsSync5 } from "node:fs";
|
|
1669
1992
|
import { mkdir as mkdir3, readFile as readFile2, rename as rename2, rmdir, unlink } from "node:fs/promises";
|
|
1670
|
-
import { dirname as dirname3, join as
|
|
1993
|
+
import { dirname as dirname3, join as join9 } from "node:path";
|
|
1671
1994
|
var PACKAGE_NAME4 = "@contentful/experience-design-system-cli";
|
|
1672
1995
|
async function readJson(path) {
|
|
1673
1996
|
try {
|
|
@@ -1678,9 +2001,9 @@ async function readJson(path) {
|
|
|
1678
2001
|
}
|
|
1679
2002
|
async function migrateOldConfig() {
|
|
1680
2003
|
try {
|
|
1681
|
-
const oldCredentials =
|
|
1682
|
-
const oldRuns =
|
|
1683
|
-
const oldDebugMode =
|
|
2004
|
+
const oldCredentials = join9(oldConfigDir(), "credentials.json");
|
|
2005
|
+
const oldRuns = join9(oldConfigDir(), "runs.json");
|
|
2006
|
+
const oldDebugMode = join9(
|
|
1684
2007
|
findPackageRoot(import.meta.url, PACKAGE_NAME4),
|
|
1685
2008
|
".contentful",
|
|
1686
2009
|
"config",
|