@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/index.js
CHANGED
|
@@ -443,7 +443,8 @@ var init_controls2 = __esm({
|
|
|
443
443
|
}
|
|
444
444
|
});
|
|
445
445
|
|
|
446
|
-
// packages/experience-design-system-cli/src/tui/import/
|
|
446
|
+
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts
|
|
447
|
+
import { statSync } from "node:fs";
|
|
447
448
|
import { homedir } from "node:os";
|
|
448
449
|
import { resolve } from "node:path";
|
|
449
450
|
function stripQuotes(value) {
|
|
@@ -453,19 +454,8 @@ function stripQuotes(value) {
|
|
|
453
454
|
function expandHome(value) {
|
|
454
455
|
return value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? homedir() + value.slice(1) : value;
|
|
455
456
|
}
|
|
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";
|
|
467
457
|
function validateTokenPath(rawPath) {
|
|
468
|
-
const path =
|
|
458
|
+
const path = resolve(expandHome(stripQuotes(rawPath.trim())));
|
|
469
459
|
let stats;
|
|
470
460
|
try {
|
|
471
461
|
stats = statSync(path);
|
|
@@ -487,7 +477,6 @@ function validateTokenPath(rawPath) {
|
|
|
487
477
|
var init_validate_path = __esm({
|
|
488
478
|
"packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts"() {
|
|
489
479
|
"use strict";
|
|
490
|
-
init_resolve_user_path();
|
|
491
480
|
}
|
|
492
481
|
});
|
|
493
482
|
|
|
@@ -552,308 +541,12 @@ var init_screen2 = __esm({
|
|
|
552
541
|
}
|
|
553
542
|
});
|
|
554
543
|
|
|
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
|
-
|
|
850
544
|
// packages/experience-design-system-cli/src/tui/import/steps/index.ts
|
|
851
545
|
var init_steps = __esm({
|
|
852
546
|
"packages/experience-design-system-cli/src/tui/import/steps/index.ts"() {
|
|
853
547
|
"use strict";
|
|
854
548
|
init_screen();
|
|
855
549
|
init_screen2();
|
|
856
|
-
init_screen3();
|
|
857
550
|
}
|
|
858
551
|
});
|
|
859
552
|
|
|
@@ -918,9 +611,9 @@ var init_terminal_input = __esm({
|
|
|
918
611
|
import { randomBytes } from "node:crypto";
|
|
919
612
|
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
920
613
|
import { homedir as homedir2 } from "node:os";
|
|
921
|
-
import { dirname as dirname2, join as
|
|
614
|
+
import { dirname as dirname2, join as join5 } from "node:path";
|
|
922
615
|
function configRoot() {
|
|
923
|
-
return process.env["EDS_HOME"] ||
|
|
616
|
+
return process.env["EDS_HOME"] || join5(homedir2(), ".contentful", "experience-design-system-cli");
|
|
924
617
|
}
|
|
925
618
|
async function readSettings() {
|
|
926
619
|
try {
|
|
@@ -944,10 +637,10 @@ var configFilePath, runsFilePath, debugSessionsDir, oldConfigDir;
|
|
|
944
637
|
var init_config = __esm({
|
|
945
638
|
"packages/experience-design-system-types/dist/src/config/index.js"() {
|
|
946
639
|
"use strict";
|
|
947
|
-
configFilePath = () =>
|
|
948
|
-
runsFilePath = () =>
|
|
949
|
-
debugSessionsDir = () =>
|
|
950
|
-
oldConfigDir = () =>
|
|
640
|
+
configFilePath = () => join5(configRoot(), "config.json");
|
|
641
|
+
runsFilePath = () => join5(configRoot(), "state", "runs.json");
|
|
642
|
+
debugSessionsDir = () => join5(configRoot(), "debug", "sessions");
|
|
643
|
+
oldConfigDir = () => join5(homedir2(), ".config", "experiences");
|
|
951
644
|
}
|
|
952
645
|
});
|
|
953
646
|
|
|
@@ -973,7 +666,7 @@ var init_debug_mode_store = __esm({
|
|
|
973
666
|
// packages/experience-design-system-cli/src/tui/debug-store.ts
|
|
974
667
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
975
668
|
import { existsSync as existsSync4, readdirSync } from "node:fs";
|
|
976
|
-
import { join as
|
|
669
|
+
import { join as join6 } from "node:path";
|
|
977
670
|
function generateRunId() {
|
|
978
671
|
const now = /* @__PURE__ */ new Date();
|
|
979
672
|
const pad = (n) => String(n).padStart(2, "0");
|
|
@@ -998,7 +691,7 @@ function generateSessionId() {
|
|
|
998
691
|
return `${today}-session-${maxSeq + 1}`;
|
|
999
692
|
}
|
|
1000
693
|
function sessionDebugDir() {
|
|
1001
|
-
return
|
|
694
|
+
return join6(debugSessionsDir(), SESSION_ID);
|
|
1002
695
|
}
|
|
1003
696
|
function currentDebugSessionDir() {
|
|
1004
697
|
return sessionDebugDir();
|
|
@@ -1043,10 +736,10 @@ async function finishDebugRun({
|
|
|
1043
736
|
const durationMs = Date.now() - run.startedAt;
|
|
1044
737
|
const content = renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs });
|
|
1045
738
|
const flowSegments = run.flow.split("/");
|
|
1046
|
-
const dir =
|
|
739
|
+
const dir = join6(sessionDebugDir(), ...flowSegments);
|
|
1047
740
|
await mkdir2(dir, { recursive: true });
|
|
1048
741
|
const filename = nextAttemptFilename(dir, run.menuOption);
|
|
1049
|
-
await writeFile2(
|
|
742
|
+
await writeFile2(join6(dir, filename), content, { mode: 384 });
|
|
1050
743
|
}
|
|
1051
744
|
function nextAttemptFilename(dir, menuOption) {
|
|
1052
745
|
const today = datePrefix();
|
|
@@ -1152,21 +845,21 @@ var init_help_info = __esm({
|
|
|
1152
845
|
});
|
|
1153
846
|
|
|
1154
847
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
1155
|
-
import { useEffect as
|
|
1156
|
-
import { Box as
|
|
1157
|
-
import { Fragment, jsx as
|
|
848
|
+
import { useEffect as useEffect3, useState as useState5 } from "react";
|
|
849
|
+
import { Box as Box5, Text as Text6, useInput as useInput5 } from "ink";
|
|
850
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1158
851
|
function Section({ title, rows }) {
|
|
1159
|
-
return /* @__PURE__ */
|
|
1160
|
-
/* @__PURE__ */
|
|
1161
|
-
rows.map((row) => /* @__PURE__ */
|
|
1162
|
-
/* @__PURE__ */
|
|
1163
|
-
/* @__PURE__ */
|
|
852
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
|
|
853
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, color: PALETTE.accent, children: title }),
|
|
854
|
+
rows.map((row) => /* @__PURE__ */ jsxs5(Box5, { gap: 1, children: [
|
|
855
|
+
/* @__PURE__ */ jsx6(Box5, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: row.label }) }),
|
|
856
|
+
/* @__PURE__ */ jsx6(Text6, { children: row.value })
|
|
1164
857
|
] }, row.label))
|
|
1165
858
|
] });
|
|
1166
859
|
}
|
|
1167
860
|
function HelpScreen({ onDone }) {
|
|
1168
|
-
const [info, setInfo] =
|
|
1169
|
-
|
|
861
|
+
const [info, setInfo] = useState5();
|
|
862
|
+
useEffect3(() => {
|
|
1170
863
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
1171
864
|
void readHelpInfo().then(setInfo);
|
|
1172
865
|
}, []);
|
|
@@ -1174,7 +867,7 @@ function HelpScreen({ onDone }) {
|
|
|
1174
867
|
void finishDebugRun({ outputs: {}, status: "success", exitMethod });
|
|
1175
868
|
onDone();
|
|
1176
869
|
};
|
|
1177
|
-
|
|
870
|
+
useInput5((input, key) => {
|
|
1178
871
|
if (key.return) {
|
|
1179
872
|
leave("saved");
|
|
1180
873
|
return;
|
|
@@ -1184,14 +877,14 @@ function HelpScreen({ onDone }) {
|
|
|
1184
877
|
return;
|
|
1185
878
|
}
|
|
1186
879
|
});
|
|
1187
|
-
return /* @__PURE__ */
|
|
1188
|
-
/* @__PURE__ */
|
|
1189
|
-
info ? /* @__PURE__ */
|
|
1190
|
-
/* @__PURE__ */
|
|
1191
|
-
/* @__PURE__ */
|
|
1192
|
-
/* @__PURE__ */
|
|
1193
|
-
] }) : /* @__PURE__ */
|
|
1194
|
-
/* @__PURE__ */
|
|
880
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", paddingX: 2, paddingY: 1, gap: 1, children: [
|
|
881
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: "Help" }),
|
|
882
|
+
info ? /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
883
|
+
/* @__PURE__ */ jsx6(Section, { title: "Where things are stored", rows: info.storage }),
|
|
884
|
+
/* @__PURE__ */ jsx6(Section, { title: "Troubleshooting", rows: info.troubleshooting }),
|
|
885
|
+
/* @__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." })
|
|
886
|
+
] }) : /* @__PURE__ */ jsx6(Text6, { color: PALETTE.accent, children: "Loading..." }),
|
|
887
|
+
/* @__PURE__ */ jsx6(
|
|
1195
888
|
ControlHints,
|
|
1196
889
|
{
|
|
1197
890
|
hints: [
|
|
@@ -1213,20 +906,20 @@ var init_PageContainer2 = __esm({
|
|
|
1213
906
|
});
|
|
1214
907
|
|
|
1215
908
|
// packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
|
|
1216
|
-
import { useState as
|
|
1217
|
-
import { Box as
|
|
1218
|
-
import { jsx as
|
|
909
|
+
import { useState as useState6 } from "react";
|
|
910
|
+
import { Box as Box6, Text as Text7, useInput as useInput6 } from "ink";
|
|
911
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1219
912
|
function SettingsScreen({
|
|
1220
913
|
onNavigate,
|
|
1221
914
|
onBack
|
|
1222
915
|
}) {
|
|
1223
|
-
const [focusIdx, setFocusIdx] =
|
|
916
|
+
const [focusIdx, setFocusIdx] = useState6(0);
|
|
1224
917
|
const items = [
|
|
1225
918
|
{ label: "Configuration", screen: "settings-configuration" },
|
|
1226
919
|
{ label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
|
|
1227
920
|
{ label: "Debug Mode", screen: "settings-debug-mode" }
|
|
1228
921
|
];
|
|
1229
|
-
|
|
922
|
+
useInput6((input, key) => {
|
|
1230
923
|
if (key.upArrow) {
|
|
1231
924
|
setFocusIdx((i) => (i - 1 + items.length) % items.length);
|
|
1232
925
|
return;
|
|
@@ -1246,15 +939,15 @@ function SettingsScreen({
|
|
|
1246
939
|
onBack();
|
|
1247
940
|
}
|
|
1248
941
|
});
|
|
1249
|
-
return /* @__PURE__ */
|
|
1250
|
-
/* @__PURE__ */
|
|
1251
|
-
/* @__PURE__ */
|
|
1252
|
-
items.map((item, i) => /* @__PURE__ */
|
|
942
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
943
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, children: "Settings" }),
|
|
944
|
+
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
945
|
+
items.map((item, i) => /* @__PURE__ */ jsxs6(Text7, { color: i === focusIdx ? "cyan" : void 0, children: [
|
|
1253
946
|
i === focusIdx ? "> " : " ",
|
|
1254
947
|
item.label
|
|
1255
948
|
] }, item.label)),
|
|
1256
|
-
/* @__PURE__ */
|
|
1257
|
-
/* @__PURE__ */
|
|
949
|
+
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
950
|
+
/* @__PURE__ */ jsx7(
|
|
1258
951
|
ControlHints,
|
|
1259
952
|
{
|
|
1260
953
|
hints: [
|
|
@@ -1315,10 +1008,10 @@ var init_config_store = __esm({
|
|
|
1315
1008
|
});
|
|
1316
1009
|
|
|
1317
1010
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
1318
|
-
import { useEffect as
|
|
1319
|
-
import { Box as
|
|
1011
|
+
import { useEffect as useEffect4, useState as useState7 } from "react";
|
|
1012
|
+
import { Box as Box7, Text as Text8, useInput as useInput7 } from "ink";
|
|
1320
1013
|
import TextInput3 from "ink-text-input";
|
|
1321
|
-
import { Fragment as Fragment2, jsx as
|
|
1014
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1322
1015
|
function debugFields(config) {
|
|
1323
1016
|
return {
|
|
1324
1017
|
space_id: config?.spaceId ?? "",
|
|
@@ -1330,14 +1023,14 @@ function debugFields(config) {
|
|
|
1330
1023
|
};
|
|
1331
1024
|
}
|
|
1332
1025
|
function ConfigurationScreen({ onDone }) {
|
|
1333
|
-
const [stage, setStage] =
|
|
1334
|
-
const [config, setConfig] =
|
|
1335
|
-
const [activeField, setActiveField] =
|
|
1336
|
-
const [notice, setNotice] =
|
|
1337
|
-
const [lastSaved, setLastSaved] =
|
|
1338
|
-
const [editing, setEditing] =
|
|
1339
|
-
const [valueBeforeEdit, setValueBeforeEdit] =
|
|
1340
|
-
|
|
1026
|
+
const [stage, setStage] = useState7("loading");
|
|
1027
|
+
const [config, setConfig] = useState7(null);
|
|
1028
|
+
const [activeField, setActiveField] = useState7("spaceId");
|
|
1029
|
+
const [notice, setNotice] = useState7(null);
|
|
1030
|
+
const [lastSaved, setLastSaved] = useState7(null);
|
|
1031
|
+
const [editing, setEditing] = useState7(false);
|
|
1032
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState7("");
|
|
1033
|
+
useEffect4(() => {
|
|
1341
1034
|
readCredentials().then((cfg) => {
|
|
1342
1035
|
setConfig(cfg);
|
|
1343
1036
|
setStage("form");
|
|
@@ -1377,7 +1070,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1377
1070
|
);
|
|
1378
1071
|
onDone();
|
|
1379
1072
|
}
|
|
1380
|
-
|
|
1073
|
+
useInput7((input, key) => {
|
|
1381
1074
|
if (stage === "loading" || stage === "saving") return;
|
|
1382
1075
|
if (editing) {
|
|
1383
1076
|
if (key.escape) {
|
|
@@ -1414,26 +1107,26 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1414
1107
|
}
|
|
1415
1108
|
});
|
|
1416
1109
|
if (stage === "loading") {
|
|
1417
|
-
return /* @__PURE__ */
|
|
1418
|
-
/* @__PURE__ */
|
|
1419
|
-
/* @__PURE__ */
|
|
1420
|
-
/* @__PURE__ */
|
|
1110
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1111
|
+
/* @__PURE__ */ jsx8(Text8, { bold: true, children: "Configuration" }),
|
|
1112
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
1113
|
+
/* @__PURE__ */ jsx8(Text8, { color: PALETTE.accent, children: "Loading..." })
|
|
1421
1114
|
] });
|
|
1422
1115
|
}
|
|
1423
|
-
return /* @__PURE__ */
|
|
1424
|
-
/* @__PURE__ */
|
|
1425
|
-
/* @__PURE__ */
|
|
1426
|
-
/* @__PURE__ */
|
|
1116
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1117
|
+
/* @__PURE__ */ jsx8(Text8, { bold: true, children: "Configuration" }),
|
|
1118
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
1119
|
+
/* @__PURE__ */ jsx8(Box7, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
|
|
1427
1120
|
const isActive = activeField === field;
|
|
1428
1121
|
const value = fieldValue(field);
|
|
1429
1122
|
const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
|
|
1430
|
-
return /* @__PURE__ */
|
|
1431
|
-
/* @__PURE__ */
|
|
1432
|
-
/* @__PURE__ */
|
|
1123
|
+
return /* @__PURE__ */ jsxs7(Box7, { gap: 1, children: [
|
|
1124
|
+
/* @__PURE__ */ jsx8(Text8, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
1125
|
+
/* @__PURE__ */ jsxs7(Text8, { bold: isActive, children: [
|
|
1433
1126
|
FIELD_LABELS[field],
|
|
1434
1127
|
":"
|
|
1435
1128
|
] }),
|
|
1436
|
-
isActive && editing ? /* @__PURE__ */
|
|
1129
|
+
isActive && editing ? /* @__PURE__ */ jsx8(
|
|
1437
1130
|
TextInput3,
|
|
1438
1131
|
{
|
|
1439
1132
|
value,
|
|
@@ -1441,19 +1134,19 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1441
1134
|
onSubmit: () => setEditing(false),
|
|
1442
1135
|
mask: field === "cmaToken" ? "\u2022" : void 0
|
|
1443
1136
|
}
|
|
1444
|
-
) : /* @__PURE__ */
|
|
1137
|
+
) : /* @__PURE__ */ jsx8(Text8, { children: display || /* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "(empty)" }) })
|
|
1445
1138
|
] }, field);
|
|
1446
1139
|
}) }),
|
|
1447
|
-
notice && /* @__PURE__ */
|
|
1448
|
-
/* @__PURE__ */
|
|
1449
|
-
/* @__PURE__ */
|
|
1140
|
+
notice && /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
1141
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
1142
|
+
/* @__PURE__ */ jsxs7(Text8, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
1450
1143
|
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
1451
1144
|
" ",
|
|
1452
1145
|
notice.text
|
|
1453
1146
|
] })
|
|
1454
1147
|
] }),
|
|
1455
|
-
/* @__PURE__ */
|
|
1456
|
-
/* @__PURE__ */
|
|
1148
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
1149
|
+
/* @__PURE__ */ jsx8(
|
|
1457
1150
|
ControlHints,
|
|
1458
1151
|
{
|
|
1459
1152
|
hints: editing ? [
|
|
@@ -1521,13 +1214,13 @@ var init_analytics_store = __esm({
|
|
|
1521
1214
|
});
|
|
1522
1215
|
|
|
1523
1216
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
1524
|
-
import { useEffect as
|
|
1525
|
-
import { Box as
|
|
1526
|
-
import { Fragment as Fragment3, jsx as
|
|
1217
|
+
import { useEffect as useEffect5, useState as useState8 } from "react";
|
|
1218
|
+
import { Box as Box8, Text as Text9, useInput as useInput8 } from "ink";
|
|
1219
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1527
1220
|
function OptInAnalyticsScreen({ onDone }) {
|
|
1528
|
-
const [loading, setLoading] =
|
|
1529
|
-
const [enabled, setEnabled] =
|
|
1530
|
-
|
|
1221
|
+
const [loading, setLoading] = useState8(true);
|
|
1222
|
+
const [enabled, setEnabled] = useState8(true);
|
|
1223
|
+
useEffect5(() => {
|
|
1531
1224
|
readAnalyticsSetting().then((setting) => {
|
|
1532
1225
|
setEnabled(setting.enabled);
|
|
1533
1226
|
setLoading(false);
|
|
@@ -1539,7 +1232,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1539
1232
|
});
|
|
1540
1233
|
});
|
|
1541
1234
|
}, []);
|
|
1542
|
-
|
|
1235
|
+
useInput8((input, key) => {
|
|
1543
1236
|
if (loading) return;
|
|
1544
1237
|
if (key.return || input === " ") {
|
|
1545
1238
|
setEnabled((current) => {
|
|
@@ -1554,21 +1247,21 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1554
1247
|
onDone();
|
|
1555
1248
|
}
|
|
1556
1249
|
});
|
|
1557
|
-
return /* @__PURE__ */
|
|
1558
|
-
/* @__PURE__ */
|
|
1559
|
-
/* @__PURE__ */
|
|
1560
|
-
loading ? /* @__PURE__ */
|
|
1561
|
-
/* @__PURE__ */
|
|
1250
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1251
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
|
|
1252
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1253
|
+
loading ? /* @__PURE__ */ jsx9(Text9, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
1254
|
+
/* @__PURE__ */ jsxs8(Text9, { children: [
|
|
1562
1255
|
"Share anonymous usage data:",
|
|
1563
1256
|
" ",
|
|
1564
|
-
/* @__PURE__ */
|
|
1257
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
1565
1258
|
] }),
|
|
1566
|
-
/* @__PURE__ */
|
|
1567
|
-
/* @__PURE__ */
|
|
1568
|
-
/* @__PURE__ */
|
|
1259
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1260
|
+
/* @__PURE__ */ jsx9(Text9, { dimColor: true, children: "Shares which CLI commands are used and where imports succeed or fail." }),
|
|
1261
|
+
/* @__PURE__ */ jsx9(Text9, { dimColor: true, children: "Never includes source code, file paths, credentials, or authored content." })
|
|
1569
1262
|
] }),
|
|
1570
|
-
/* @__PURE__ */
|
|
1571
|
-
/* @__PURE__ */
|
|
1263
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1264
|
+
/* @__PURE__ */ jsx9(
|
|
1572
1265
|
ControlHints,
|
|
1573
1266
|
{
|
|
1574
1267
|
hints: [
|
|
@@ -1579,7 +1272,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1579
1272
|
)
|
|
1580
1273
|
] });
|
|
1581
1274
|
}
|
|
1582
|
-
var
|
|
1275
|
+
var init_screen3 = __esm({
|
|
1583
1276
|
"packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx"() {
|
|
1584
1277
|
"use strict";
|
|
1585
1278
|
init_home_theme();
|
|
@@ -1590,12 +1283,12 @@ var init_screen4 = __esm({
|
|
|
1590
1283
|
});
|
|
1591
1284
|
|
|
1592
1285
|
// packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
|
|
1593
|
-
import { useEffect as
|
|
1594
|
-
import { Box as
|
|
1595
|
-
import { jsx as
|
|
1286
|
+
import { useEffect as useEffect6, useState as useState9 } from "react";
|
|
1287
|
+
import { Box as Box9, Text as Text10, useInput as useInput9 } from "ink";
|
|
1288
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1596
1289
|
function UpgradeScreen({ onDone }) {
|
|
1597
|
-
const [upgradeCheck, setUpgradeCheck] =
|
|
1598
|
-
|
|
1290
|
+
const [upgradeCheck, setUpgradeCheck] = useState9();
|
|
1291
|
+
useEffect6(() => {
|
|
1599
1292
|
startDebugRun({
|
|
1600
1293
|
flow: "upgrade",
|
|
1601
1294
|
step: "01-upgrade",
|
|
@@ -1604,7 +1297,7 @@ function UpgradeScreen({ onDone }) {
|
|
|
1604
1297
|
});
|
|
1605
1298
|
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
1606
1299
|
}, []);
|
|
1607
|
-
|
|
1300
|
+
useInput9((_input, key) => {
|
|
1608
1301
|
if (key.return) {
|
|
1609
1302
|
void finishDebugRun({
|
|
1610
1303
|
outputs: upgradeCheck ?? {},
|
|
@@ -1615,12 +1308,12 @@ function UpgradeScreen({ onDone }) {
|
|
|
1615
1308
|
return;
|
|
1616
1309
|
}
|
|
1617
1310
|
});
|
|
1618
|
-
return /* @__PURE__ */
|
|
1619
|
-
/* @__PURE__ */
|
|
1620
|
-
/* @__PURE__ */
|
|
1311
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1312
|
+
/* @__PURE__ */ jsx10(Text10, { bold: true, children: "Upgrade" }),
|
|
1313
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1621
1314
|
renderBody(upgradeCheck),
|
|
1622
|
-
/* @__PURE__ */
|
|
1623
|
-
/* @__PURE__ */
|
|
1315
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1316
|
+
/* @__PURE__ */ jsxs9(Text10, { bold: true, color: PALETTE.accent, children: [
|
|
1624
1317
|
FOCUS_MARKER,
|
|
1625
1318
|
" Go Back"
|
|
1626
1319
|
] })
|
|
@@ -1628,34 +1321,34 @@ function UpgradeScreen({ onDone }) {
|
|
|
1628
1321
|
}
|
|
1629
1322
|
function renderBody(upgradeCheck) {
|
|
1630
1323
|
if (!upgradeCheck) {
|
|
1631
|
-
return /* @__PURE__ */
|
|
1324
|
+
return /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "Checking for updates\u2026" });
|
|
1632
1325
|
}
|
|
1633
1326
|
if (upgradeCheck.status === "error") {
|
|
1634
|
-
return /* @__PURE__ */
|
|
1327
|
+
return /* @__PURE__ */ jsx10(Text10, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
|
|
1635
1328
|
}
|
|
1636
1329
|
if (upgradeCheck.status === "up-to-date") {
|
|
1637
|
-
return /* @__PURE__ */
|
|
1330
|
+
return /* @__PURE__ */ jsxs9(Text10, { color: PALETTE.success, children: [
|
|
1638
1331
|
"You're already on the latest version (v",
|
|
1639
1332
|
upgradeCheck.current,
|
|
1640
1333
|
")."
|
|
1641
1334
|
] });
|
|
1642
1335
|
}
|
|
1643
|
-
return /* @__PURE__ */
|
|
1644
|
-
/* @__PURE__ */
|
|
1645
|
-
/* @__PURE__ */
|
|
1336
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", children: [
|
|
1337
|
+
/* @__PURE__ */ jsxs9(Text10, { color: PALETTE.muted, children: [
|
|
1338
|
+
/* @__PURE__ */ jsxs9(Text10, { bold: true, color: PALETTE.success, children: [
|
|
1646
1339
|
"v",
|
|
1647
1340
|
upgradeCheck.latest
|
|
1648
1341
|
] }),
|
|
1649
1342
|
" ",
|
|
1650
1343
|
"is available (you're on ",
|
|
1651
|
-
/* @__PURE__ */
|
|
1344
|
+
/* @__PURE__ */ jsxs9(Text10, { bold: true, children: [
|
|
1652
1345
|
"v",
|
|
1653
1346
|
upgradeCheck.current
|
|
1654
1347
|
] }),
|
|
1655
1348
|
"). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
|
|
1656
1349
|
] }),
|
|
1657
|
-
/* @__PURE__ */
|
|
1658
|
-
/* @__PURE__ */
|
|
1350
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1351
|
+
/* @__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)) })
|
|
1659
1352
|
] });
|
|
1660
1353
|
}
|
|
1661
1354
|
var UPGRADE_COMMANDS;
|
|
@@ -1670,13 +1363,13 @@ var init_PageContainer4 = __esm({
|
|
|
1670
1363
|
});
|
|
1671
1364
|
|
|
1672
1365
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
1673
|
-
import { useEffect as
|
|
1674
|
-
import { Box as
|
|
1675
|
-
import { jsx as
|
|
1366
|
+
import { useEffect as useEffect7, useState as useState10 } from "react";
|
|
1367
|
+
import { Box as Box10, Text as Text11, useInput as useInput10 } from "ink";
|
|
1368
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1676
1369
|
function DebugModeScreen({ onDone }) {
|
|
1677
|
-
const [loading, setLoading] =
|
|
1678
|
-
const [enabled, setEnabled] =
|
|
1679
|
-
|
|
1370
|
+
const [loading, setLoading] = useState10(true);
|
|
1371
|
+
const [enabled, setEnabled] = useState10(true);
|
|
1372
|
+
useEffect7(() => {
|
|
1680
1373
|
readDebugModeSetting().then((setting) => {
|
|
1681
1374
|
setEnabled(setting.enabled);
|
|
1682
1375
|
setLoading(false);
|
|
@@ -1688,7 +1381,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
1688
1381
|
});
|
|
1689
1382
|
});
|
|
1690
1383
|
}, []);
|
|
1691
|
-
|
|
1384
|
+
useInput10((input, key) => {
|
|
1692
1385
|
if (loading) return;
|
|
1693
1386
|
if (key.return || input === " ") {
|
|
1694
1387
|
setEnabled((current) => {
|
|
@@ -1703,16 +1396,16 @@ function DebugModeScreen({ onDone }) {
|
|
|
1703
1396
|
onDone();
|
|
1704
1397
|
}
|
|
1705
1398
|
});
|
|
1706
|
-
return /* @__PURE__ */
|
|
1707
|
-
/* @__PURE__ */
|
|
1708
|
-
/* @__PURE__ */
|
|
1709
|
-
loading ? /* @__PURE__ */
|
|
1399
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1400
|
+
/* @__PURE__ */ jsx11(Text11, { bold: true, children: "Settings \u203A Debug Mode" }),
|
|
1401
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1402
|
+
loading ? /* @__PURE__ */ jsx11(Text11, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs10(Text11, { children: [
|
|
1710
1403
|
"Debug logging:",
|
|
1711
1404
|
" ",
|
|
1712
|
-
/* @__PURE__ */
|
|
1405
|
+
/* @__PURE__ */ jsx11(Text11, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
1713
1406
|
] }),
|
|
1714
|
-
/* @__PURE__ */
|
|
1715
|
-
/* @__PURE__ */
|
|
1407
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1408
|
+
/* @__PURE__ */ jsx11(
|
|
1716
1409
|
ControlHints,
|
|
1717
1410
|
{
|
|
1718
1411
|
hints: [
|
|
@@ -1723,7 +1416,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
1723
1416
|
)
|
|
1724
1417
|
] });
|
|
1725
1418
|
}
|
|
1726
|
-
var
|
|
1419
|
+
var init_screen4 = __esm({
|
|
1727
1420
|
"packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx"() {
|
|
1728
1421
|
"use strict";
|
|
1729
1422
|
init_home_theme();
|
|
@@ -1738,16 +1431,15 @@ var app_exports = {};
|
|
|
1738
1431
|
__export(app_exports, {
|
|
1739
1432
|
runApp: () => runApp
|
|
1740
1433
|
});
|
|
1741
|
-
import { useEffect as
|
|
1742
|
-
import { Fragment as Fragment4, jsx as
|
|
1434
|
+
import { useEffect as useEffect8, useState as useState11 } from "react";
|
|
1435
|
+
import { Fragment as Fragment4, jsx as jsx12 } from "react/jsx-runtime";
|
|
1743
1436
|
function App({ onLaunchImport, importExitCode }) {
|
|
1744
1437
|
const returnedFromImport = importExitCode !== void 0;
|
|
1745
|
-
const [screen, setScreen] =
|
|
1746
|
-
const [showImportResult, setShowImportResult] =
|
|
1747
|
-
const [projectPath, setProjectPath] =
|
|
1748
|
-
const [
|
|
1749
|
-
|
|
1750
|
-
useEffect9(() => {
|
|
1438
|
+
const [screen, setScreen] = useState11(returnedFromImport ? "import" : "start");
|
|
1439
|
+
const [showImportResult, setShowImportResult] = useState11(returnedFromImport);
|
|
1440
|
+
const [projectPath, setProjectPath] = useState11();
|
|
1441
|
+
const [importDefaults, setImportDefaults] = useState11();
|
|
1442
|
+
useEffect8(() => {
|
|
1751
1443
|
if (screen !== "import") {
|
|
1752
1444
|
setImportDefaults(void 0);
|
|
1753
1445
|
return;
|
|
@@ -1758,65 +1450,50 @@ function App({ onLaunchImport, importExitCode }) {
|
|
|
1758
1450
|
}, [screen]);
|
|
1759
1451
|
const goToStart = () => setScreen("start");
|
|
1760
1452
|
const goToSettings = () => setScreen("settings");
|
|
1761
|
-
const resetImport = () => {
|
|
1762
|
-
setProjectPath(void 0);
|
|
1763
|
-
setTokensPath(void 0);
|
|
1764
|
-
};
|
|
1765
1453
|
const finishImportResult = () => {
|
|
1766
1454
|
setShowImportResult(false);
|
|
1767
|
-
|
|
1455
|
+
setProjectPath(void 0);
|
|
1768
1456
|
goToStart();
|
|
1769
1457
|
};
|
|
1770
1458
|
const leaveImport = () => {
|
|
1771
|
-
|
|
1459
|
+
setProjectPath(void 0);
|
|
1772
1460
|
goToStart();
|
|
1773
1461
|
};
|
|
1774
1462
|
switch (screen) {
|
|
1775
1463
|
case "import":
|
|
1776
|
-
if (showImportResult) return /* @__PURE__ */
|
|
1777
|
-
if (importDefaults === void 0) return /* @__PURE__ */
|
|
1464
|
+
if (showImportResult) return /* @__PURE__ */ jsx12(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
|
|
1465
|
+
if (importDefaults === void 0) return /* @__PURE__ */ jsx12(Fragment4, {});
|
|
1778
1466
|
if (projectPath === void 0) {
|
|
1779
|
-
return /* @__PURE__ */
|
|
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
|
-
);
|
|
1467
|
+
return /* @__PURE__ */ jsx12(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
|
|
1790
1468
|
}
|
|
1791
|
-
return /* @__PURE__ */
|
|
1792
|
-
|
|
1469
|
+
return /* @__PURE__ */ jsx12(
|
|
1470
|
+
TokenInputScreen,
|
|
1793
1471
|
{
|
|
1794
|
-
|
|
1795
|
-
onConfirm: (
|
|
1796
|
-
|
|
1797
|
-
onBack: () => setTokensPath(void 0)
|
|
1472
|
+
initialPath: importDefaults.tokenFile,
|
|
1473
|
+
onConfirm: (tokens) => onLaunchImport?.({ project: projectPath, tokens }),
|
|
1474
|
+
onBack: () => setProjectPath(void 0)
|
|
1798
1475
|
}
|
|
1799
1476
|
);
|
|
1800
1477
|
case "help":
|
|
1801
|
-
return /* @__PURE__ */
|
|
1478
|
+
return /* @__PURE__ */ jsx12(HelpScreen, { onDone: goToStart });
|
|
1802
1479
|
case "upgrade":
|
|
1803
|
-
return /* @__PURE__ */
|
|
1480
|
+
return /* @__PURE__ */ jsx12(UpgradeScreen, { onDone: goToStart });
|
|
1804
1481
|
case "settings":
|
|
1805
|
-
return /* @__PURE__ */
|
|
1482
|
+
return /* @__PURE__ */ jsx12(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
1806
1483
|
case "settings-configuration":
|
|
1807
|
-
return /* @__PURE__ */
|
|
1484
|
+
return /* @__PURE__ */ jsx12(ConfigurationScreen, { onDone: goToSettings });
|
|
1808
1485
|
case "settings-opt-in-analytics":
|
|
1809
|
-
return /* @__PURE__ */
|
|
1486
|
+
return /* @__PURE__ */ jsx12(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
1810
1487
|
case "settings-debug-mode":
|
|
1811
|
-
return /* @__PURE__ */
|
|
1488
|
+
return /* @__PURE__ */ jsx12(DebugModeScreen, { onDone: goToSettings });
|
|
1812
1489
|
case "start":
|
|
1813
|
-
return /* @__PURE__ */
|
|
1490
|
+
return /* @__PURE__ */ jsx12(HomeScreen, { onNavigate: setScreen });
|
|
1814
1491
|
}
|
|
1815
1492
|
}
|
|
1816
1493
|
async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
|
|
1817
1494
|
let requestedImport;
|
|
1818
1495
|
const instance = renderApp(
|
|
1819
|
-
/* @__PURE__ */
|
|
1496
|
+
/* @__PURE__ */ jsx12(
|
|
1820
1497
|
App,
|
|
1821
1498
|
{
|
|
1822
1499
|
importExitCode,
|
|
@@ -1855,9 +1532,9 @@ var init_app = __esm({
|
|
|
1855
1532
|
init_PageContainer2();
|
|
1856
1533
|
init_PageContainer3();
|
|
1857
1534
|
init_ContentfulConfigScreen();
|
|
1858
|
-
|
|
1535
|
+
init_screen3();
|
|
1859
1536
|
init_PageContainer4();
|
|
1860
|
-
|
|
1537
|
+
init_screen4();
|
|
1861
1538
|
init_config_store();
|
|
1862
1539
|
CLEAR_SCREEN = "\x1B[2J\x1B[H";
|
|
1863
1540
|
}
|
|
@@ -1865,7 +1542,7 @@ var init_app = __esm({
|
|
|
1865
1542
|
|
|
1866
1543
|
// packages/experience-design-system-cli/program.ts
|
|
1867
1544
|
import { readFileSync as readFileSync3 } from "node:fs";
|
|
1868
|
-
import { join as
|
|
1545
|
+
import { join as join7 } from "node:path";
|
|
1869
1546
|
import { Command } from "commander";
|
|
1870
1547
|
|
|
1871
1548
|
// packages/experience-design-system-cli/src/legacy/run-legacy.ts
|
|
@@ -1970,7 +1647,7 @@ function registerImportCommand(program, openTui) {
|
|
|
1970
1647
|
init_package_root();
|
|
1971
1648
|
var pkg = JSON.parse(
|
|
1972
1649
|
readFileSync3(
|
|
1973
|
-
|
|
1650
|
+
join7(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
|
|
1974
1651
|
"utf8"
|
|
1975
1652
|
)
|
|
1976
1653
|
);
|
|
@@ -1990,7 +1667,7 @@ init_config();
|
|
|
1990
1667
|
init_package_root();
|
|
1991
1668
|
import { existsSync as existsSync5 } from "node:fs";
|
|
1992
1669
|
import { mkdir as mkdir3, readFile as readFile2, rename as rename2, rmdir, unlink } from "node:fs/promises";
|
|
1993
|
-
import { dirname as dirname3, join as
|
|
1670
|
+
import { dirname as dirname3, join as join8 } from "node:path";
|
|
1994
1671
|
var PACKAGE_NAME4 = "@contentful/experience-design-system-cli";
|
|
1995
1672
|
async function readJson(path) {
|
|
1996
1673
|
try {
|
|
@@ -2001,9 +1678,9 @@ async function readJson(path) {
|
|
|
2001
1678
|
}
|
|
2002
1679
|
async function migrateOldConfig() {
|
|
2003
1680
|
try {
|
|
2004
|
-
const oldCredentials =
|
|
2005
|
-
const oldRuns =
|
|
2006
|
-
const oldDebugMode =
|
|
1681
|
+
const oldCredentials = join8(oldConfigDir(), "credentials.json");
|
|
1682
|
+
const oldRuns = join8(oldConfigDir(), "runs.json");
|
|
1683
|
+
const oldDebugMode = join8(
|
|
2007
1684
|
findPackageRoot(import.meta.url, PACKAGE_NAME4),
|
|
2008
1685
|
".contentful",
|
|
2009
1686
|
"config",
|