@contentful/experience-design-system-cli 2.35.1-dev-build-7780c1f7.0 → 2.35.1-dev-build-a963233a.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 +200 -126
- package/dist/index.js +230 -130
- package/dist/package.json +2 -1
- package/dist/src/tui/import/steps/01-welcome/controls.d.ts +8 -0
- package/dist/src/tui/import/steps/01-welcome/logic.d.ts +8 -0
- package/dist/src/tui/import/steps/01-welcome/screen.d.ts +7 -0
- package/dist/src/tui/import/steps/index.d.ts +1 -0
- package/legacy/package.json +2 -1
- package/package.json +3 -2
package/dist/app.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// packages/experience-design-system-cli/app.tsx
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as useState9 } from "react";
|
|
3
3
|
|
|
4
4
|
// packages/experience-design-system-cli/src/tui/home/home.tsx
|
|
5
5
|
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
@@ -230,6 +230,80 @@ function ImportScreen({ exitCode, onDone }) {
|
|
|
230
230
|
] });
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
|
|
234
|
+
import { useState as useState3 } from "react";
|
|
235
|
+
import { Box as Box3, Text as Text3 } from "ink";
|
|
236
|
+
import TextInput from "ink-text-input";
|
|
237
|
+
|
|
238
|
+
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/controls.ts
|
|
239
|
+
import { useInput as useInput3 } from "ink";
|
|
240
|
+
|
|
241
|
+
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/logic.ts
|
|
242
|
+
function shouldQuit(value, input, key) {
|
|
243
|
+
if (key.escape) return true;
|
|
244
|
+
return value === "" && input === "q" && !key.ctrl && !key.meta;
|
|
245
|
+
}
|
|
246
|
+
function toProjectPath(value) {
|
|
247
|
+
const projectPath = value.trim();
|
|
248
|
+
return projectPath === "" ? null : projectPath;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/controls.ts
|
|
252
|
+
var WELCOME_CONTROLS = [
|
|
253
|
+
{ keys: "Enter", label: "Continue" },
|
|
254
|
+
{ keys: "Esc/q", label: "Back to menu" }
|
|
255
|
+
];
|
|
256
|
+
function useWelcomeControls(projectPath, onQuit) {
|
|
257
|
+
useInput3((input, key) => {
|
|
258
|
+
if (shouldQuit(projectPath, input, key)) onQuit();
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
|
|
263
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
264
|
+
var RULE = "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500";
|
|
265
|
+
var OVERVIEW = [
|
|
266
|
+
{ label: "Step 1", description: "Extract components from your codebase" },
|
|
267
|
+
{ label: "Step 2", description: "Review what was extracted" },
|
|
268
|
+
{ label: "Step 3", description: "Generate CDF definitions with Claude" },
|
|
269
|
+
{ label: "Step 4", description: "Review generated definitions" },
|
|
270
|
+
{ label: "Step 5", description: "Push to Contentful" }
|
|
271
|
+
];
|
|
272
|
+
function WelcomeScreen({ onContinue, onQuit }) {
|
|
273
|
+
const [projectPath, setProjectPath] = useState3("");
|
|
274
|
+
useWelcomeControls(projectPath, onQuit);
|
|
275
|
+
const submit = (value) => {
|
|
276
|
+
const path = toProjectPath(value);
|
|
277
|
+
if (path) onContinue(path);
|
|
278
|
+
};
|
|
279
|
+
return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
280
|
+
/* @__PURE__ */ jsx3(Text3, { bold: true, color: PALETTE.success, children: "\u{1F44B} Hey! Let's import your design system into Contentful." }),
|
|
281
|
+
/* @__PURE__ */ jsx3(Text3, { dimColor: true, children: "I'll walk you through 5 steps to get your components into Contentful ExO." }),
|
|
282
|
+
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", marginTop: 1, children: [
|
|
283
|
+
/* @__PURE__ */ jsx3(Text3, { dimColor: true, children: RULE }),
|
|
284
|
+
OVERVIEW.map((item) => /* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
|
|
285
|
+
/* @__PURE__ */ jsx3(Text3, { bold: true, children: item.label }),
|
|
286
|
+
/* @__PURE__ */ jsx3(Text3, { dimColor: true, children: item.description })
|
|
287
|
+
] }, item.label)),
|
|
288
|
+
/* @__PURE__ */ jsx3(Text3, { dimColor: true, children: RULE })
|
|
289
|
+
] }),
|
|
290
|
+
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", marginTop: 1, children: [
|
|
291
|
+
/* @__PURE__ */ jsx3(Text3, { children: "Where is your component library?" }),
|
|
292
|
+
/* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
|
|
293
|
+
/* @__PURE__ */ jsx3(Text3, { color: PALETTE.accent, children: "?" }),
|
|
294
|
+
/* @__PURE__ */ jsx3(Text3, { children: "Project path:" }),
|
|
295
|
+
/* @__PURE__ */ jsx3(TextInput, { value: projectPath, onChange: setProjectPath, onSubmit: submit })
|
|
296
|
+
] })
|
|
297
|
+
] }),
|
|
298
|
+
/* @__PURE__ */ jsx3(Box3, { marginTop: 1, gap: 3, children: WELCOME_CONTROLS.map((control) => /* @__PURE__ */ jsxs3(Text3, { dimColor: true, children: [
|
|
299
|
+
"[",
|
|
300
|
+
control.keys,
|
|
301
|
+
"] ",
|
|
302
|
+
control.label
|
|
303
|
+
] }, control.keys)) })
|
|
304
|
+
] });
|
|
305
|
+
}
|
|
306
|
+
|
|
233
307
|
// packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts
|
|
234
308
|
import { spawn } from "node:child_process";
|
|
235
309
|
|
|
@@ -295,7 +369,7 @@ function startReadingTerminal() {
|
|
|
295
369
|
|
|
296
370
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
297
371
|
import { useEffect as useEffect3 } from "react";
|
|
298
|
-
import { Box as
|
|
372
|
+
import { Box as Box4, Text as Text4, useInput as useInput4 } from "ink";
|
|
299
373
|
|
|
300
374
|
// packages/experience-design-system-cli/src/tui/debug-store.ts
|
|
301
375
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
@@ -469,7 +543,7 @@ process.once("SIGINT", () => {
|
|
|
469
543
|
});
|
|
470
544
|
|
|
471
545
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
472
|
-
import { jsx as
|
|
546
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
473
547
|
function HelpScreen({ onDone }) {
|
|
474
548
|
useEffect3(() => {
|
|
475
549
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
@@ -478,7 +552,7 @@ function HelpScreen({ onDone }) {
|
|
|
478
552
|
void finishDebugRun({ outputs: {}, status: "success", exitMethod });
|
|
479
553
|
onDone();
|
|
480
554
|
};
|
|
481
|
-
|
|
555
|
+
useInput4((input, key) => {
|
|
482
556
|
if (key.return) {
|
|
483
557
|
leave("saved");
|
|
484
558
|
return;
|
|
@@ -488,30 +562,30 @@ function HelpScreen({ onDone }) {
|
|
|
488
562
|
return;
|
|
489
563
|
}
|
|
490
564
|
});
|
|
491
|
-
return /* @__PURE__ */
|
|
492
|
-
/* @__PURE__ */
|
|
493
|
-
/* @__PURE__ */
|
|
494
|
-
/* @__PURE__ */
|
|
495
|
-
/* @__PURE__ */
|
|
496
|
-
/* @__PURE__ */
|
|
565
|
+
return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
566
|
+
/* @__PURE__ */ jsx4(Text4, { bold: true, children: "Help" }),
|
|
567
|
+
/* @__PURE__ */ jsx4(Text4, { children: " " }),
|
|
568
|
+
/* @__PURE__ */ jsx4(Text4, { children: "This is a placeholder screen for v2 help content." }),
|
|
569
|
+
/* @__PURE__ */ jsx4(Text4, { children: " " }),
|
|
570
|
+
/* @__PURE__ */ jsx4(Text4, { dimColor: true, children: "[Enter] Complete [Esc/q] Exit \u2014 both return to Start" })
|
|
497
571
|
] });
|
|
498
572
|
}
|
|
499
573
|
|
|
500
574
|
// packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
|
|
501
|
-
import { useState as
|
|
502
|
-
import { Box as
|
|
503
|
-
import { jsx as
|
|
575
|
+
import { useState as useState4 } from "react";
|
|
576
|
+
import { Box as Box5, Text as Text5, useInput as useInput5 } from "ink";
|
|
577
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
504
578
|
function SettingsScreen({
|
|
505
579
|
onNavigate,
|
|
506
580
|
onBack
|
|
507
581
|
}) {
|
|
508
|
-
const [focusIdx, setFocusIdx] =
|
|
582
|
+
const [focusIdx, setFocusIdx] = useState4(0);
|
|
509
583
|
const items = [
|
|
510
584
|
{ label: "Configuration", screen: "settings-configuration" },
|
|
511
585
|
{ label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
|
|
512
586
|
{ label: "Debug Mode", screen: "settings-debug-mode" }
|
|
513
587
|
];
|
|
514
|
-
|
|
588
|
+
useInput5((input, key) => {
|
|
515
589
|
if (key.upArrow) {
|
|
516
590
|
setFocusIdx((i) => (i - 1 + items.length) % items.length);
|
|
517
591
|
return;
|
|
@@ -531,21 +605,21 @@ function SettingsScreen({
|
|
|
531
605
|
onBack();
|
|
532
606
|
}
|
|
533
607
|
});
|
|
534
|
-
return /* @__PURE__ */
|
|
535
|
-
/* @__PURE__ */
|
|
536
|
-
/* @__PURE__ */
|
|
537
|
-
items.map((item, i) => /* @__PURE__ */
|
|
608
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
609
|
+
/* @__PURE__ */ jsx5(Text5, { bold: true, children: "Settings" }),
|
|
610
|
+
/* @__PURE__ */ jsx5(Text5, { children: " " }),
|
|
611
|
+
items.map((item, i) => /* @__PURE__ */ jsxs5(Text5, { color: i === focusIdx ? "cyan" : void 0, children: [
|
|
538
612
|
i === focusIdx ? "> " : " ",
|
|
539
613
|
item.label
|
|
540
614
|
] }, item.label)),
|
|
541
|
-
/* @__PURE__ */
|
|
542
|
-
/* @__PURE__ */
|
|
615
|
+
/* @__PURE__ */ jsx5(Text5, { children: " " }),
|
|
616
|
+
/* @__PURE__ */ jsx5(Text5, { dimColor: true, children: "[\u2191/\u2193] Navigate [Enter] Select [Esc/q] Back to Start" })
|
|
543
617
|
] });
|
|
544
618
|
}
|
|
545
619
|
|
|
546
620
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
547
|
-
import { useEffect as useEffect4, useState as
|
|
548
|
-
import { Box as
|
|
621
|
+
import { useEffect as useEffect4, useState as useState5 } from "react";
|
|
622
|
+
import { Box as Box6, Text as Text6, useInput as useInput6 } from "ink";
|
|
549
623
|
|
|
550
624
|
// packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
|
|
551
625
|
import { readFile as readFile2, writeFile as writeFile3, mkdir as mkdir3 } from "node:fs/promises";
|
|
@@ -589,7 +663,7 @@ async function writeCredentials(config) {
|
|
|
589
663
|
}
|
|
590
664
|
|
|
591
665
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
592
|
-
import { Fragment, jsx as
|
|
666
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
593
667
|
var FIELD_ORDER = ["spaceId", "environmentId", "cmaToken", "host"];
|
|
594
668
|
function debugFields(config) {
|
|
595
669
|
return {
|
|
@@ -606,10 +680,10 @@ var FIELD_LABELS = {
|
|
|
606
680
|
host: "API Host (optional)"
|
|
607
681
|
};
|
|
608
682
|
function ConfigurationScreen({ onDone }) {
|
|
609
|
-
const [stage, setStage] =
|
|
610
|
-
const [config, setConfig] =
|
|
611
|
-
const [activeField, setActiveField] =
|
|
612
|
-
const [message, setMessage] =
|
|
683
|
+
const [stage, setStage] = useState5("loading");
|
|
684
|
+
const [config, setConfig] = useState5(null);
|
|
685
|
+
const [activeField, setActiveField] = useState5("spaceId");
|
|
686
|
+
const [message, setMessage] = useState5(null);
|
|
613
687
|
useEffect4(() => {
|
|
614
688
|
readCredentials().then((cfg) => {
|
|
615
689
|
setConfig(cfg);
|
|
@@ -642,7 +716,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
642
716
|
setStage("form");
|
|
643
717
|
});
|
|
644
718
|
}
|
|
645
|
-
|
|
719
|
+
useInput6((input, key) => {
|
|
646
720
|
if (stage === "loading" || stage === "saving") return;
|
|
647
721
|
if (stage === "saved") {
|
|
648
722
|
if (key.return || key.escape || input === "q") {
|
|
@@ -685,57 +759,57 @@ function ConfigurationScreen({ onDone }) {
|
|
|
685
759
|
}
|
|
686
760
|
});
|
|
687
761
|
if (stage === "loading") {
|
|
688
|
-
return /* @__PURE__ */
|
|
689
|
-
/* @__PURE__ */
|
|
690
|
-
/* @__PURE__ */
|
|
691
|
-
/* @__PURE__ */
|
|
762
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
763
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: "Configuration" }),
|
|
764
|
+
/* @__PURE__ */ jsx6(Text6, { children: " " }),
|
|
765
|
+
/* @__PURE__ */ jsx6(Text6, { color: PALETTE.accent, children: "Loading..." })
|
|
692
766
|
] });
|
|
693
767
|
}
|
|
694
768
|
if (stage === "saved") {
|
|
695
|
-
return /* @__PURE__ */
|
|
696
|
-
/* @__PURE__ */
|
|
697
|
-
/* @__PURE__ */
|
|
698
|
-
/* @__PURE__ */
|
|
769
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
770
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: "Configuration" }),
|
|
771
|
+
/* @__PURE__ */ jsx6(Text6, { children: " " }),
|
|
772
|
+
/* @__PURE__ */ jsxs6(Text6, { color: PALETTE.success, children: [
|
|
699
773
|
"\u2713 ",
|
|
700
774
|
message
|
|
701
775
|
] }),
|
|
702
|
-
/* @__PURE__ */
|
|
703
|
-
/* @__PURE__ */
|
|
776
|
+
/* @__PURE__ */ jsx6(Text6, { children: " " }),
|
|
777
|
+
/* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "[Enter] Back to Settings" })
|
|
704
778
|
] });
|
|
705
779
|
}
|
|
706
|
-
return /* @__PURE__ */
|
|
707
|
-
/* @__PURE__ */
|
|
708
|
-
/* @__PURE__ */
|
|
709
|
-
/* @__PURE__ */
|
|
710
|
-
/* @__PURE__ */
|
|
711
|
-
/* @__PURE__ */
|
|
780
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
781
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: "Configuration" }),
|
|
782
|
+
/* @__PURE__ */ jsx6(Text6, { children: " " }),
|
|
783
|
+
/* @__PURE__ */ jsx6(Text6, { children: "Contentful API Credentials" }),
|
|
784
|
+
/* @__PURE__ */ jsx6(Text6, { children: " " }),
|
|
785
|
+
/* @__PURE__ */ jsx6(Box6, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
|
|
712
786
|
const isActive = activeField === field;
|
|
713
787
|
const value = fieldValue(field);
|
|
714
788
|
const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
|
|
715
|
-
return /* @__PURE__ */
|
|
716
|
-
/* @__PURE__ */
|
|
717
|
-
/* @__PURE__ */
|
|
789
|
+
return /* @__PURE__ */ jsxs6(Box6, { gap: 1, children: [
|
|
790
|
+
/* @__PURE__ */ jsx6(Text6, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
791
|
+
/* @__PURE__ */ jsxs6(Text6, { bold: isActive, children: [
|
|
718
792
|
FIELD_LABELS[field],
|
|
719
793
|
":"
|
|
720
794
|
] }),
|
|
721
|
-
/* @__PURE__ */
|
|
795
|
+
/* @__PURE__ */ jsx6(Text6, { children: display || /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "(empty)" }) })
|
|
722
796
|
] }, field);
|
|
723
797
|
}) }),
|
|
724
|
-
message && /* @__PURE__ */
|
|
725
|
-
/* @__PURE__ */
|
|
726
|
-
/* @__PURE__ */
|
|
798
|
+
message && /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
799
|
+
/* @__PURE__ */ jsx6(Text6, { children: " " }),
|
|
800
|
+
/* @__PURE__ */ jsxs6(Text6, { color: PALETTE.error, children: [
|
|
727
801
|
"\u2717 ",
|
|
728
802
|
message
|
|
729
803
|
] })
|
|
730
804
|
] }),
|
|
731
|
-
/* @__PURE__ */
|
|
732
|
-
/* @__PURE__ */
|
|
805
|
+
/* @__PURE__ */ jsx6(Text6, { children: " " }),
|
|
806
|
+
/* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "[\u2191/\u2193] Switch field \xB7 [Enter] Save/Next \xB7 [Esc/q] Back" })
|
|
733
807
|
] });
|
|
734
808
|
}
|
|
735
809
|
|
|
736
810
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
737
|
-
import { useEffect as useEffect5, useState as
|
|
738
|
-
import { Box as
|
|
811
|
+
import { useEffect as useEffect5, useState as useState6 } from "react";
|
|
812
|
+
import { Box as Box7, Text as Text7, useInput as useInput7 } from "ink";
|
|
739
813
|
|
|
740
814
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
|
|
741
815
|
async function readAnalyticsSetting() {
|
|
@@ -753,10 +827,10 @@ async function writeAnalyticsSetting(setting) {
|
|
|
753
827
|
}
|
|
754
828
|
|
|
755
829
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
756
|
-
import { Fragment as Fragment2, jsx as
|
|
830
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
757
831
|
function OptInAnalyticsScreen({ onDone }) {
|
|
758
|
-
const [loading, setLoading] =
|
|
759
|
-
const [enabled, setEnabled] =
|
|
832
|
+
const [loading, setLoading] = useState6(true);
|
|
833
|
+
const [enabled, setEnabled] = useState6(true);
|
|
760
834
|
useEffect5(() => {
|
|
761
835
|
readAnalyticsSetting().then((setting) => {
|
|
762
836
|
setEnabled(setting.enabled);
|
|
@@ -769,7 +843,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
769
843
|
});
|
|
770
844
|
});
|
|
771
845
|
}, []);
|
|
772
|
-
|
|
846
|
+
useInput7((input, key) => {
|
|
773
847
|
if (loading) return;
|
|
774
848
|
if (key.return || input === " ") {
|
|
775
849
|
setEnabled((current) => {
|
|
@@ -784,31 +858,31 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
784
858
|
onDone();
|
|
785
859
|
}
|
|
786
860
|
});
|
|
787
|
-
return /* @__PURE__ */
|
|
788
|
-
/* @__PURE__ */
|
|
789
|
-
/* @__PURE__ */
|
|
790
|
-
loading ? /* @__PURE__ */
|
|
791
|
-
/* @__PURE__ */
|
|
861
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
862
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
|
|
863
|
+
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
864
|
+
loading ? /* @__PURE__ */ jsx7(Text7, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
865
|
+
/* @__PURE__ */ jsxs7(Text7, { children: [
|
|
792
866
|
"Share anonymous usage data:",
|
|
793
867
|
" ",
|
|
794
|
-
/* @__PURE__ */
|
|
868
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
795
869
|
] }),
|
|
796
|
-
/* @__PURE__ */
|
|
797
|
-
/* @__PURE__ */
|
|
798
|
-
/* @__PURE__ */
|
|
870
|
+
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
871
|
+
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Shares which CLI commands are used and where imports succeed or fail." }),
|
|
872
|
+
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Never includes source code, file paths, credentials, or authored content." })
|
|
799
873
|
] }),
|
|
800
|
-
/* @__PURE__ */
|
|
801
|
-
/* @__PURE__ */
|
|
874
|
+
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
875
|
+
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
|
|
802
876
|
] });
|
|
803
877
|
}
|
|
804
878
|
|
|
805
879
|
// packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
|
|
806
|
-
import { useEffect as useEffect6, useState as
|
|
807
|
-
import { Box as
|
|
808
|
-
import { jsx as
|
|
880
|
+
import { useEffect as useEffect6, useState as useState7 } from "react";
|
|
881
|
+
import { Box as Box8, Text as Text8, useInput as useInput8 } from "ink";
|
|
882
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
809
883
|
var UPGRADE_COMMANDS = ["git pull", "pnpm install", "pnpm build"];
|
|
810
884
|
function UpgradeScreen({ onDone }) {
|
|
811
|
-
const [upgradeCheck, setUpgradeCheck] =
|
|
885
|
+
const [upgradeCheck, setUpgradeCheck] = useState7();
|
|
812
886
|
useEffect6(() => {
|
|
813
887
|
startDebugRun({
|
|
814
888
|
flow: "upgrade",
|
|
@@ -818,7 +892,7 @@ function UpgradeScreen({ onDone }) {
|
|
|
818
892
|
});
|
|
819
893
|
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
820
894
|
}, []);
|
|
821
|
-
|
|
895
|
+
useInput8((_input, key) => {
|
|
822
896
|
if (key.return) {
|
|
823
897
|
void finishDebugRun({
|
|
824
898
|
outputs: upgradeCheck ?? {},
|
|
@@ -829,12 +903,12 @@ function UpgradeScreen({ onDone }) {
|
|
|
829
903
|
return;
|
|
830
904
|
}
|
|
831
905
|
});
|
|
832
|
-
return /* @__PURE__ */
|
|
833
|
-
/* @__PURE__ */
|
|
834
|
-
/* @__PURE__ */
|
|
906
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
907
|
+
/* @__PURE__ */ jsx8(Text8, { bold: true, children: "Upgrade" }),
|
|
908
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
835
909
|
renderBody(upgradeCheck),
|
|
836
|
-
/* @__PURE__ */
|
|
837
|
-
/* @__PURE__ */
|
|
910
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
911
|
+
/* @__PURE__ */ jsxs8(Text8, { bold: true, color: PALETTE.accent, children: [
|
|
838
912
|
FOCUS_MARKER,
|
|
839
913
|
" Go Back"
|
|
840
914
|
] })
|
|
@@ -842,44 +916,44 @@ function UpgradeScreen({ onDone }) {
|
|
|
842
916
|
}
|
|
843
917
|
function renderBody(upgradeCheck) {
|
|
844
918
|
if (!upgradeCheck) {
|
|
845
|
-
return /* @__PURE__ */
|
|
919
|
+
return /* @__PURE__ */ jsx8(Text8, { color: PALETTE.muted, children: "Checking for updates\u2026" });
|
|
846
920
|
}
|
|
847
921
|
if (upgradeCheck.status === "error") {
|
|
848
|
-
return /* @__PURE__ */
|
|
922
|
+
return /* @__PURE__ */ jsx8(Text8, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
|
|
849
923
|
}
|
|
850
924
|
if (upgradeCheck.status === "up-to-date") {
|
|
851
|
-
return /* @__PURE__ */
|
|
925
|
+
return /* @__PURE__ */ jsxs8(Text8, { color: PALETTE.success, children: [
|
|
852
926
|
"You're already on the latest version (v",
|
|
853
927
|
upgradeCheck.current,
|
|
854
928
|
")."
|
|
855
929
|
] });
|
|
856
930
|
}
|
|
857
|
-
return /* @__PURE__ */
|
|
858
|
-
/* @__PURE__ */
|
|
859
|
-
/* @__PURE__ */
|
|
931
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
|
|
932
|
+
/* @__PURE__ */ jsxs8(Text8, { color: PALETTE.muted, children: [
|
|
933
|
+
/* @__PURE__ */ jsxs8(Text8, { bold: true, color: PALETTE.success, children: [
|
|
860
934
|
"v",
|
|
861
935
|
upgradeCheck.latest
|
|
862
936
|
] }),
|
|
863
937
|
" ",
|
|
864
938
|
"is available (you're on ",
|
|
865
|
-
/* @__PURE__ */
|
|
939
|
+
/* @__PURE__ */ jsxs8(Text8, { bold: true, children: [
|
|
866
940
|
"v",
|
|
867
941
|
upgradeCheck.current
|
|
868
942
|
] }),
|
|
869
943
|
"). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
|
|
870
944
|
] }),
|
|
871
|
-
/* @__PURE__ */
|
|
872
|
-
/* @__PURE__ */
|
|
945
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
946
|
+
/* @__PURE__ */ jsx8(Box8, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx8(Text8, { bold: true, children: cmd }, cmd)) })
|
|
873
947
|
] });
|
|
874
948
|
}
|
|
875
949
|
|
|
876
950
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
877
|
-
import { useEffect as useEffect7, useState as
|
|
878
|
-
import { Box as
|
|
879
|
-
import { jsx as
|
|
951
|
+
import { useEffect as useEffect7, useState as useState8 } from "react";
|
|
952
|
+
import { Box as Box9, Text as Text9, useInput as useInput9 } from "ink";
|
|
953
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
880
954
|
function DebugModeScreen({ onDone }) {
|
|
881
|
-
const [loading, setLoading] =
|
|
882
|
-
const [enabled, setEnabled] =
|
|
955
|
+
const [loading, setLoading] = useState8(true);
|
|
956
|
+
const [enabled, setEnabled] = useState8(true);
|
|
883
957
|
useEffect7(() => {
|
|
884
958
|
readDebugModeSetting().then((setting) => {
|
|
885
959
|
setEnabled(setting.enabled);
|
|
@@ -892,7 +966,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
892
966
|
});
|
|
893
967
|
});
|
|
894
968
|
}, []);
|
|
895
|
-
|
|
969
|
+
useInput9((input, key) => {
|
|
896
970
|
if (loading) return;
|
|
897
971
|
if (key.return || input === " ") {
|
|
898
972
|
setEnabled((current) => {
|
|
@@ -907,61 +981,59 @@ function DebugModeScreen({ onDone }) {
|
|
|
907
981
|
onDone();
|
|
908
982
|
}
|
|
909
983
|
});
|
|
910
|
-
return /* @__PURE__ */
|
|
911
|
-
/* @__PURE__ */
|
|
912
|
-
/* @__PURE__ */
|
|
913
|
-
loading ? /* @__PURE__ */
|
|
984
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
985
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, children: "Settings \u203A Debug Mode" }),
|
|
986
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
987
|
+
loading ? /* @__PURE__ */ jsx9(Text9, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs9(Text9, { children: [
|
|
914
988
|
"Debug logging:",
|
|
915
989
|
" ",
|
|
916
|
-
/* @__PURE__ */
|
|
990
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
917
991
|
] }),
|
|
918
|
-
/* @__PURE__ */
|
|
919
|
-
/* @__PURE__ */
|
|
992
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
993
|
+
/* @__PURE__ */ jsx9(Text9, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
|
|
920
994
|
] });
|
|
921
995
|
}
|
|
922
996
|
|
|
923
997
|
// packages/experience-design-system-cli/app.tsx
|
|
924
|
-
import { jsx as
|
|
998
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
925
999
|
function App({ onLaunchImport, importExitCode }) {
|
|
926
1000
|
const returnedFromImport = importExitCode !== void 0;
|
|
927
|
-
const [screen, setScreen] =
|
|
1001
|
+
const [screen, setScreen] = useState9(returnedFromImport ? "import" : "start");
|
|
1002
|
+
const [showImportResult, setShowImportResult] = useState9(returnedFromImport);
|
|
928
1003
|
const goToStart = () => setScreen("start");
|
|
929
1004
|
const goToSettings = () => setScreen("settings");
|
|
930
|
-
const
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
return;
|
|
934
|
-
}
|
|
935
|
-
setScreen(next);
|
|
1005
|
+
const finishImportResult = () => {
|
|
1006
|
+
setShowImportResult(false);
|
|
1007
|
+
goToStart();
|
|
936
1008
|
};
|
|
937
1009
|
switch (screen) {
|
|
938
1010
|
case "import":
|
|
939
|
-
return /* @__PURE__ */
|
|
1011
|
+
return showImportResult ? /* @__PURE__ */ jsx10(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult }) : /* @__PURE__ */ jsx10(WelcomeScreen, { onContinue: (projectPath) => onLaunchImport?.(projectPath), onQuit: goToStart });
|
|
940
1012
|
case "help":
|
|
941
|
-
return /* @__PURE__ */
|
|
1013
|
+
return /* @__PURE__ */ jsx10(HelpScreen, { onDone: goToStart });
|
|
942
1014
|
case "upgrade":
|
|
943
|
-
return /* @__PURE__ */
|
|
1015
|
+
return /* @__PURE__ */ jsx10(UpgradeScreen, { onDone: goToStart });
|
|
944
1016
|
case "settings":
|
|
945
|
-
return /* @__PURE__ */
|
|
1017
|
+
return /* @__PURE__ */ jsx10(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
946
1018
|
case "settings-configuration":
|
|
947
|
-
return /* @__PURE__ */
|
|
1019
|
+
return /* @__PURE__ */ jsx10(ConfigurationScreen, { onDone: goToSettings });
|
|
948
1020
|
case "settings-opt-in-analytics":
|
|
949
|
-
return /* @__PURE__ */
|
|
1021
|
+
return /* @__PURE__ */ jsx10(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
950
1022
|
case "settings-debug-mode":
|
|
951
|
-
return /* @__PURE__ */
|
|
1023
|
+
return /* @__PURE__ */ jsx10(DebugModeScreen, { onDone: goToSettings });
|
|
952
1024
|
case "start":
|
|
953
|
-
return /* @__PURE__ */
|
|
1025
|
+
return /* @__PURE__ */ jsx10(HomeScreen, { onNavigate: setScreen });
|
|
954
1026
|
}
|
|
955
1027
|
}
|
|
956
1028
|
async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
|
|
957
|
-
let
|
|
1029
|
+
let requestedProjectPath;
|
|
958
1030
|
const instance = renderApp(
|
|
959
|
-
/* @__PURE__ */
|
|
1031
|
+
/* @__PURE__ */ jsx10(
|
|
960
1032
|
App,
|
|
961
1033
|
{
|
|
962
1034
|
importExitCode,
|
|
963
|
-
onLaunchImport: () => {
|
|
964
|
-
|
|
1035
|
+
onLaunchImport: (projectPath) => {
|
|
1036
|
+
requestedProjectPath = projectPath;
|
|
965
1037
|
instance.unmount();
|
|
966
1038
|
}
|
|
967
1039
|
}
|
|
@@ -969,13 +1041,15 @@ async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
|
|
|
969
1041
|
);
|
|
970
1042
|
await instance.waitUntilExit();
|
|
971
1043
|
await stopReadingTerminal();
|
|
972
|
-
return
|
|
1044
|
+
return requestedProjectPath;
|
|
973
1045
|
}
|
|
974
1046
|
async function runApp(renderApp) {
|
|
975
1047
|
let importExitCode;
|
|
976
|
-
|
|
977
|
-
|
|
1048
|
+
let projectPath = await renderUntilImportRequestedOrExit(renderApp, importExitCode);
|
|
1049
|
+
while (projectPath !== void 0) {
|
|
1050
|
+
importExitCode = (await spawnV1Import({ project: projectPath })).exitCode;
|
|
978
1051
|
startReadingTerminal();
|
|
1052
|
+
projectPath = await renderUntilImportRequestedOrExit(renderApp, importExitCode);
|
|
979
1053
|
}
|
|
980
1054
|
}
|
|
981
1055
|
export {
|