@contentful/experience-design-system-cli 2.37.1-dev-build-f86ffbb8.0 → 2.37.1-dev-build-2e476265.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 +150 -389
- package/dist/index.js +154 -421
- package/dist/package.json +1 -2
- package/dist/src/tui/home/home.theme.d.ts +1 -2
- package/dist/src/tui/import/spawn-v1-import.d.ts +0 -1
- package/dist/src/tui/import/steps/index.d.ts +0 -1
- package/legacy/dist/src/analyze/select/tui/components/ScrollablePanel.d.ts +2 -2
- package/legacy/dist/src/analyze/select/tui/theme.d.ts +1 -1
- package/legacy/dist/src/import/tui/steps/CredentialsStep.d.ts +43 -0
- package/legacy/dist/src/index.js +1476 -1085
- package/legacy/package.json +1 -2
- package/package.json +2 -3
- package/dist/src/tui/import/steps/04-credentials/controls.d.ts +0 -21
- package/dist/src/tui/import/steps/04-credentials/logic.d.ts +0 -23
- package/dist/src/tui/import/steps/04-credentials/screen.d.ts +0 -17
- package/dist/src/tui/import/steps/04-credentials/validate.d.ts +0 -8
package/dist/app.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// packages/experience-design-system-cli/app.tsx
|
|
2
|
-
import { useEffect as useEffect9, useState as
|
|
2
|
+
import { useEffect as useEffect9, useState as useState12 } 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";
|
|
@@ -12,14 +12,11 @@ var BRAND = {
|
|
|
12
12
|
orange: "#E44F20",
|
|
13
13
|
yellow: "#FFDA00",
|
|
14
14
|
white: "#FFFFFF",
|
|
15
|
-
slate: "#
|
|
16
|
-
steel: "#C4D1DE"
|
|
17
|
-
mist: "#DDE5EC",
|
|
18
|
-
fog: "#EFF2F6"
|
|
15
|
+
slate: "#8B8D91",
|
|
16
|
+
steel: "#C4D1DE"
|
|
19
17
|
};
|
|
20
18
|
var PALETTE = {
|
|
21
19
|
accent: BRAND.blue,
|
|
22
|
-
heading: BRAND.white,
|
|
23
20
|
success: BRAND.green,
|
|
24
21
|
error: BRAND.orange,
|
|
25
22
|
warning: BRAND.yellow,
|
|
@@ -121,7 +118,7 @@ function useTerminalWidth() {
|
|
|
121
118
|
import { Text } from "ink";
|
|
122
119
|
import { jsx } from "react/jsx-runtime";
|
|
123
120
|
function ControlHints({ hints }) {
|
|
124
|
-
return /* @__PURE__ */ jsx(Text, {
|
|
121
|
+
return /* @__PURE__ */ jsx(Text, { children: hints.map((hint) => `[${hint.keys}] ${hint.label}`).join(" \xB7 ") });
|
|
125
122
|
}
|
|
126
123
|
|
|
127
124
|
// packages/experience-design-system-cli/src/tui/home/home.tsx
|
|
@@ -184,7 +181,7 @@ function HomeScreen({ onNavigate }) {
|
|
|
184
181
|
}
|
|
185
182
|
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
186
183
|
/* @__PURE__ */ jsxs(Box, { flexDirection: "column", alignItems: "center", children: [
|
|
187
|
-
/* @__PURE__ */ jsx2(Text2, { bold: true,
|
|
184
|
+
/* @__PURE__ */ jsx2(Text2, { bold: true, children: HEADING }),
|
|
188
185
|
/* @__PURE__ */ jsx2(Text2, { children: brandBar(HEADING.length).map((segment, i) => /* @__PURE__ */ jsx2(Text2, { color: segment.color, children: segment.text }, i)) }),
|
|
189
186
|
/* @__PURE__ */ jsx2(Text2, { color: PALETTE.muted, children: SUBTITLE }),
|
|
190
187
|
/* @__PURE__ */ jsxs(Text2, { color: PALETTE.muted, children: [
|
|
@@ -201,8 +198,7 @@ function HomeScreen({ onNavigate }) {
|
|
|
201
198
|
Text2,
|
|
202
199
|
{
|
|
203
200
|
bold: focused && !dimmed,
|
|
204
|
-
|
|
205
|
-
color: focused && !dimmed ? PALETTE.accent : display.color,
|
|
201
|
+
color: dimmed ? PALETTE.muted : focused ? PALETTE.accent : display.color,
|
|
206
202
|
children: [
|
|
207
203
|
focused ? `${FOCUS_MARKER} ` : " ",
|
|
208
204
|
display.label
|
|
@@ -235,14 +231,13 @@ function ImportScreen({ exitCode, onDone }) {
|
|
|
235
231
|
});
|
|
236
232
|
const isSuccess = exitCode === 0;
|
|
237
233
|
return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
238
|
-
/* @__PURE__ */ jsx3(Text3, { bold: true, children: "Import" }),
|
|
239
234
|
/* @__PURE__ */ jsx3(Text3, { children: " " }),
|
|
240
235
|
isSuccess ? /* @__PURE__ */ jsx3(Text3, { color: PALETTE.success, children: "\u2713 Import complete" }) : /* @__PURE__ */ jsxs2(Text3, { color: PALETTE.error, children: [
|
|
241
236
|
"\u2717 Import failed: process exited with code ",
|
|
242
237
|
exitCode ?? "unknown"
|
|
243
238
|
] }),
|
|
244
239
|
/* @__PURE__ */ jsx3(Text3, { children: " " }),
|
|
245
|
-
/* @__PURE__ */ jsx3(Text3, {
|
|
240
|
+
/* @__PURE__ */ jsx3(Text3, { children: "[Enter] Back to Start" })
|
|
246
241
|
] });
|
|
247
242
|
}
|
|
248
243
|
|
|
@@ -293,16 +288,16 @@ function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
|
|
|
293
288
|
};
|
|
294
289
|
return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
295
290
|
/* @__PURE__ */ jsx4(Text4, { bold: true, color: PALETTE.success, children: "\u{1F44B} Hey! Let's import your design system into Contentful." }),
|
|
296
|
-
/* @__PURE__ */ jsx4(Text4, {
|
|
297
|
-
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column",
|
|
291
|
+
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: "I'll walk you through 5 steps to get your components into Contentful ExO." }),
|
|
292
|
+
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
|
|
298
293
|
/* @__PURE__ */ jsx4(Text4, { dimColor: true, children: RULE }),
|
|
299
294
|
OVERVIEW.map((item) => /* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
|
|
300
295
|
/* @__PURE__ */ jsx4(Text4, { bold: true, children: item.label }),
|
|
301
|
-
/* @__PURE__ */ jsx4(Text4, {
|
|
296
|
+
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: item.description })
|
|
302
297
|
] }, item.label)),
|
|
303
298
|
/* @__PURE__ */ jsx4(Text4, { dimColor: true, children: RULE })
|
|
304
299
|
] }),
|
|
305
|
-
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column",
|
|
300
|
+
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", gap: 1, children: [
|
|
306
301
|
/* @__PURE__ */ jsx4(Text4, { children: "Where is your component library?" }),
|
|
307
302
|
/* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
|
|
308
303
|
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.accent, children: "?" }),
|
|
@@ -310,7 +305,7 @@ function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
|
|
|
310
305
|
/* @__PURE__ */ jsx4(TextInput, { value: projectPath, onChange: setProjectPath, onSubmit: submit })
|
|
311
306
|
] })
|
|
312
307
|
] }),
|
|
313
|
-
/* @__PURE__ */ jsx4(Box3, {
|
|
308
|
+
/* @__PURE__ */ jsx4(Box3, { gap: 3, children: WELCOME_CONTROLS.map((control) => /* @__PURE__ */ jsxs3(Text4, { children: [
|
|
314
309
|
"[",
|
|
315
310
|
control.keys,
|
|
316
311
|
"] ",
|
|
@@ -408,7 +403,7 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
|
|
|
408
403
|
};
|
|
409
404
|
return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
410
405
|
/* @__PURE__ */ jsx5(Text5, { bold: true, children: "Design tokens" }),
|
|
411
|
-
/* @__PURE__ */ jsx5(Text5, {
|
|
406
|
+
/* @__PURE__ */ jsx5(Text5, { color: PALETTE.muted, children: "Point me to your raw token file (e.g. ~/design-tokens/tokens.json). You can use ~, relative, or absolute paths. Claude will map it to Design Token Group Format (DTCG)." }),
|
|
412
407
|
/* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
|
|
413
408
|
/* @__PURE__ */ jsxs4(Box4, { gap: 1, children: [
|
|
414
409
|
/* @__PURE__ */ jsx5(Text5, { color: PALETTE.accent, children: "?" }),
|
|
@@ -420,13 +415,13 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
|
|
|
420
415
|
"\u2717 ",
|
|
421
416
|
failure.error
|
|
422
417
|
] }),
|
|
423
|
-
failure.resolvedPath && /* @__PURE__ */ jsxs4(Text5, {
|
|
418
|
+
failure.resolvedPath && /* @__PURE__ */ jsxs4(Text5, { color: PALETTE.muted, children: [
|
|
424
419
|
" Resolved to: ",
|
|
425
420
|
failure.resolvedPath
|
|
426
421
|
] })
|
|
427
422
|
] })
|
|
428
423
|
] }),
|
|
429
|
-
/* @__PURE__ */ jsx5(Box4, { marginTop: 1, gap: 3, children: TOKEN_INPUT_CONTROLS.map((control) => /* @__PURE__ */ jsxs4(Text5, {
|
|
424
|
+
/* @__PURE__ */ jsx5(Box4, { marginTop: 1, gap: 3, children: TOKEN_INPUT_CONTROLS.map((control) => /* @__PURE__ */ jsxs4(Text5, { children: [
|
|
430
425
|
"[",
|
|
431
426
|
control.keys,
|
|
432
427
|
"] ",
|
|
@@ -705,219 +700,6 @@ function PathValidationScreen({
|
|
|
705
700
|
] });
|
|
706
701
|
}
|
|
707
702
|
|
|
708
|
-
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
|
|
709
|
-
import { useRef, useState as useState6 } from "react";
|
|
710
|
-
import { Box as Box6, Text as Text7 } from "ink";
|
|
711
|
-
import TextInput3 from "ink-text-input";
|
|
712
|
-
|
|
713
|
-
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/controls.ts
|
|
714
|
-
import { useInput as useInput6 } from "ink";
|
|
715
|
-
|
|
716
|
-
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts
|
|
717
|
-
var FIELDS = ["spaceId", "environmentId", "cmaToken", "host"];
|
|
718
|
-
var DEFAULT_HOST = "api.contentful.com";
|
|
719
|
-
function keyAction2(input, key) {
|
|
720
|
-
if (key.escape) return "back";
|
|
721
|
-
if (key.tab) return "next-field";
|
|
722
|
-
if (key.ctrl && input === "s") return "skip";
|
|
723
|
-
return null;
|
|
724
|
-
}
|
|
725
|
-
function nextField(field) {
|
|
726
|
-
return FIELDS[(FIELDS.indexOf(field) + 1) % FIELDS.length];
|
|
727
|
-
}
|
|
728
|
-
function toConfiguredHost(host) {
|
|
729
|
-
const value = (host ?? "").trim().replace(/\/+$/, "");
|
|
730
|
-
return value === "" ? DEFAULT_HOST : value.replace(/^https:\/\//i, "");
|
|
731
|
-
}
|
|
732
|
-
function toApiHost(host) {
|
|
733
|
-
const value = host.trim().replace(/\/+$/, "");
|
|
734
|
-
if (value === "") return `https://${DEFAULT_HOST}`;
|
|
735
|
-
return /^[a-z][a-z\d+\-.]*:\/\//i.test(value) ? value : `https://${value}`;
|
|
736
|
-
}
|
|
737
|
-
function normalize(values) {
|
|
738
|
-
return {
|
|
739
|
-
spaceId: values.spaceId.trim(),
|
|
740
|
-
environmentId: values.environmentId.trim(),
|
|
741
|
-
cmaToken: values.cmaToken.trim(),
|
|
742
|
-
host: toConfiguredHost(values.host)
|
|
743
|
-
};
|
|
744
|
-
}
|
|
745
|
-
function missingField(values) {
|
|
746
|
-
return values.spaceId === "" || values.environmentId === "" || values.cmaToken === "";
|
|
747
|
-
}
|
|
748
|
-
function isUnchanged(current, initial) {
|
|
749
|
-
return FIELDS.every((field) => current[field] === initial[field]);
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/controls.ts
|
|
753
|
-
var CREDENTIALS_CONTROLS = [
|
|
754
|
-
{ keys: "Enter", label: "Next field / Continue" },
|
|
755
|
-
{ keys: "Tab", label: "Switch field" },
|
|
756
|
-
{ keys: "Ctrl+S", label: "Skip (no push)" },
|
|
757
|
-
{ keys: "Esc", label: "Back" }
|
|
758
|
-
];
|
|
759
|
-
function useCredentialsControls(handlers) {
|
|
760
|
-
useInput6((input, key) => {
|
|
761
|
-
if (handlers.disabled) return;
|
|
762
|
-
const action = keyAction2(input, key);
|
|
763
|
-
if (action === "back") handlers.onBack();
|
|
764
|
-
else if (action === "next-field") handlers.onNextField();
|
|
765
|
-
else if (action === "skip") handlers.onSkip();
|
|
766
|
-
});
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/validate.ts
|
|
770
|
-
var USER_AGENT = "app contentful.experience-design-system-cli";
|
|
771
|
-
function headers(token) {
|
|
772
|
-
return { Authorization: `Bearer ${token}`, "X-Contentful-User-Agent": USER_AGENT };
|
|
773
|
-
}
|
|
774
|
-
function isApsDenial(body) {
|
|
775
|
-
try {
|
|
776
|
-
const id = JSON.parse(body).sys?.id;
|
|
777
|
-
return id === "NotFound" || id === "AccessDenied";
|
|
778
|
-
} catch {
|
|
779
|
-
return false;
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
function messageFrom(body) {
|
|
783
|
-
try {
|
|
784
|
-
const message = JSON.parse(body).message;
|
|
785
|
-
return typeof message === "string" && message !== "" ? message : void 0;
|
|
786
|
-
} catch {
|
|
787
|
-
return void 0;
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
async function validateCredentials(values) {
|
|
791
|
-
const base = toApiHost(values.host);
|
|
792
|
-
let me;
|
|
793
|
-
try {
|
|
794
|
-
me = await fetch(`${base}/users/me`, { headers: headers(values.cmaToken) });
|
|
795
|
-
} catch (error) {
|
|
796
|
-
return { ok: false, error: `Could not reach ${base}: ${error instanceof Error ? error.message : String(error)}` };
|
|
797
|
-
}
|
|
798
|
-
if (me.status === 401) return { ok: false, error: "CMA token is invalid or revoked." };
|
|
799
|
-
if (!me.ok) return { ok: false, error: `Unexpected error validating the token (${me.status}).` };
|
|
800
|
-
let preflight;
|
|
801
|
-
try {
|
|
802
|
-
preflight = await fetch(
|
|
803
|
-
`${base}/spaces/${values.spaceId}/environments/${values.environmentId}/design_systems/preflight`,
|
|
804
|
-
{ headers: headers(values.cmaToken) }
|
|
805
|
-
);
|
|
806
|
-
} catch {
|
|
807
|
-
return { ok: true };
|
|
808
|
-
}
|
|
809
|
-
if (preflight.ok || preflight.status >= 500) return { ok: true };
|
|
810
|
-
const body = await preflight.text();
|
|
811
|
-
if (preflight.status === 404 && !isApsDenial(body)) return { ok: true };
|
|
812
|
-
const detail = messageFrom(body);
|
|
813
|
-
if (preflight.status === 403) {
|
|
814
|
-
return { ok: false, error: `Access denied. ${detail ?? "Your token cannot write design system components here."}` };
|
|
815
|
-
}
|
|
816
|
-
if (preflight.status === 404) {
|
|
817
|
-
return {
|
|
818
|
-
ok: false,
|
|
819
|
-
error: `Not found. Check the space ID, environment and API host.${detail ? ` (${detail})` : ""}`
|
|
820
|
-
};
|
|
821
|
-
}
|
|
822
|
-
return { ok: false, error: `Credential check failed (${preflight.status}).${detail ? ` ${detail}` : ""}` };
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
|
|
826
|
-
import { Fragment, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
827
|
-
var LABELS = {
|
|
828
|
-
spaceId: "Space ID",
|
|
829
|
-
environmentId: "Environment",
|
|
830
|
-
cmaToken: "CMA Token",
|
|
831
|
-
host: "API Host"
|
|
832
|
-
};
|
|
833
|
-
function CredentialsScreen({
|
|
834
|
-
onDone,
|
|
835
|
-
onBack,
|
|
836
|
-
initial = {},
|
|
837
|
-
validate = validateCredentials
|
|
838
|
-
}) {
|
|
839
|
-
const initialValues = useRef(
|
|
840
|
-
normalize({
|
|
841
|
-
spaceId: initial.spaceId ?? "",
|
|
842
|
-
environmentId: initial.environmentId || "master",
|
|
843
|
-
cmaToken: initial.cmaToken ?? "",
|
|
844
|
-
host: initial.host ?? ""
|
|
845
|
-
})
|
|
846
|
-
).current;
|
|
847
|
-
const [values, setValues] = useState6(initialValues);
|
|
848
|
-
const [active, setActive] = useState6("spaceId");
|
|
849
|
-
const [error, setError] = useState6(null);
|
|
850
|
-
const [validating, setValidating] = useState6(false);
|
|
851
|
-
const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
|
|
852
|
-
useCredentialsControls({
|
|
853
|
-
disabled: validating,
|
|
854
|
-
onBack,
|
|
855
|
-
onNextField: () => setActive(nextField),
|
|
856
|
-
onSkip: () => onDone({ skipped: true })
|
|
857
|
-
});
|
|
858
|
-
const change = (field) => (value) => {
|
|
859
|
-
setValues((current) => ({ ...current, [field]: value }));
|
|
860
|
-
setError(null);
|
|
861
|
-
};
|
|
862
|
-
const submit = async (field) => {
|
|
863
|
-
if (field !== "host") {
|
|
864
|
-
setActive(nextField(field));
|
|
865
|
-
return;
|
|
866
|
-
}
|
|
867
|
-
const credentials = normalize(values);
|
|
868
|
-
if (missingField(credentials)) {
|
|
869
|
-
setError("Space ID, environment and CMA token are all required.");
|
|
870
|
-
return;
|
|
871
|
-
}
|
|
872
|
-
setValidating(true);
|
|
873
|
-
const result = await validate(credentials);
|
|
874
|
-
setValidating(false);
|
|
875
|
-
if (result.ok) onDone({ skipped: false, credentials });
|
|
876
|
-
else setError(result.error);
|
|
877
|
-
};
|
|
878
|
-
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
879
|
-
/* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
|
|
880
|
-
/* @__PURE__ */ jsx7(Text7, { bold: true, children: "Contentful credentials" }),
|
|
881
|
-
/* @__PURE__ */ jsx7(Text7, { children: prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into." }),
|
|
882
|
-
!prefilled && /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
883
|
-
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Used to align suggestions with what already exists in the space and to push your import at the end. Skipping runs without space context and disables push." }),
|
|
884
|
-
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Tip: save these under Settings \u2192 Configuration so they pre-fill here." })
|
|
885
|
-
] })
|
|
886
|
-
] }),
|
|
887
|
-
/* @__PURE__ */ jsx7(Box6, { flexDirection: "column", children: FIELDS.map((field) => /* @__PURE__ */ jsxs6(Box6, { gap: 1, children: [
|
|
888
|
-
/* @__PURE__ */ jsx7(Text7, { color: active === field ? PALETTE.accent : void 0, children: "?" }),
|
|
889
|
-
/* @__PURE__ */ jsxs6(Text7, { bold: active === field, children: [
|
|
890
|
-
LABELS[field],
|
|
891
|
-
":"
|
|
892
|
-
] }),
|
|
893
|
-
/* @__PURE__ */ jsx7(
|
|
894
|
-
TextInput3,
|
|
895
|
-
{
|
|
896
|
-
value: values[field],
|
|
897
|
-
focus: active === field && !validating,
|
|
898
|
-
mask: field === "cmaToken" ? "\u2022" : void 0,
|
|
899
|
-
placeholder: field === "host" ? DEFAULT_HOST : void 0,
|
|
900
|
-
onChange: change(field),
|
|
901
|
-
onSubmit: () => void submit(field)
|
|
902
|
-
}
|
|
903
|
-
)
|
|
904
|
-
] }, field)) }),
|
|
905
|
-
active === "host" && /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Default: api.contentful.com \xB7 EU spaces: api.eu.contentful.com" }),
|
|
906
|
-
error && /* @__PURE__ */ jsxs6(Text7, { color: PALETTE.error, children: [
|
|
907
|
-
"\u2717 ",
|
|
908
|
-
error
|
|
909
|
-
] }),
|
|
910
|
-
validating && /* @__PURE__ */ jsx7(Text7, { color: PALETTE.accent, children: "Validating credentials..." }),
|
|
911
|
-
!validating && !error && !isUnchanged(normalize(values), initialValues) && /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Changed values are saved after they validate." }),
|
|
912
|
-
/* @__PURE__ */ jsx7(Box6, { marginTop: 1, gap: 3, children: CREDENTIALS_CONTROLS.map((control) => /* @__PURE__ */ jsxs6(Text7, { dimColor: true, children: [
|
|
913
|
-
"[",
|
|
914
|
-
control.keys,
|
|
915
|
-
"] ",
|
|
916
|
-
control.label
|
|
917
|
-
] }, control.keys)) })
|
|
918
|
-
] });
|
|
919
|
-
}
|
|
920
|
-
|
|
921
703
|
// packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts
|
|
922
704
|
import { spawn } from "node:child_process";
|
|
923
705
|
|
|
@@ -955,8 +737,7 @@ async function spawnV1Import(options = {}) {
|
|
|
955
737
|
const args = buildArgs(options);
|
|
956
738
|
return new Promise((resolvePromise) => {
|
|
957
739
|
const child = spawn("node", [cliPath, ...args], {
|
|
958
|
-
stdio: "inherit"
|
|
959
|
-
env: options.skipCredentials ? { ...process.env, EDS_IMPORT_SKIP_CREDENTIALS: "1" } : process.env
|
|
740
|
+
stdio: "inherit"
|
|
960
741
|
});
|
|
961
742
|
child.on("close", (code) => {
|
|
962
743
|
resolvePromise({ exitCode: code ?? 1, result: void 0, stdout: "", stderr: "" });
|
|
@@ -986,8 +767,8 @@ function startReadingTerminal() {
|
|
|
986
767
|
}
|
|
987
768
|
|
|
988
769
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
989
|
-
import { useEffect as useEffect4, useState as
|
|
990
|
-
import { Box as
|
|
770
|
+
import { useEffect as useEffect4, useState as useState6 } from "react";
|
|
771
|
+
import { Box as Box6, Text as Text7, useInput as useInput6 } from "ink";
|
|
991
772
|
|
|
992
773
|
// packages/experience-design-system-cli/src/tui/debug-store.ts
|
|
993
774
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
@@ -1197,18 +978,18 @@ async function readHelpInfo() {
|
|
|
1197
978
|
}
|
|
1198
979
|
|
|
1199
980
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
1200
|
-
import { Fragment
|
|
981
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1201
982
|
function Section({ title, rows }) {
|
|
1202
|
-
return /* @__PURE__ */
|
|
1203
|
-
/* @__PURE__ */
|
|
1204
|
-
rows.map((row) => /* @__PURE__ */
|
|
1205
|
-
/* @__PURE__ */
|
|
1206
|
-
/* @__PURE__ */
|
|
983
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
|
|
984
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, color: PALETTE.accent, children: title }),
|
|
985
|
+
rows.map((row) => /* @__PURE__ */ jsxs6(Box6, { gap: 1, children: [
|
|
986
|
+
/* @__PURE__ */ jsx7(Box6, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx7(Text7, { color: PALETTE.muted, children: row.label }) }),
|
|
987
|
+
/* @__PURE__ */ jsx7(Text7, { children: row.value })
|
|
1207
988
|
] }, row.label))
|
|
1208
989
|
] });
|
|
1209
990
|
}
|
|
1210
991
|
function HelpScreen({ onDone }) {
|
|
1211
|
-
const [info, setInfo] =
|
|
992
|
+
const [info, setInfo] = useState6();
|
|
1212
993
|
useEffect4(() => {
|
|
1213
994
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
1214
995
|
void readHelpInfo().then(setInfo);
|
|
@@ -1217,7 +998,7 @@ function HelpScreen({ onDone }) {
|
|
|
1217
998
|
void finishDebugRun({ outputs: {}, status: "success", exitMethod });
|
|
1218
999
|
onDone();
|
|
1219
1000
|
};
|
|
1220
|
-
|
|
1001
|
+
useInput6((input, key) => {
|
|
1221
1002
|
if (key.return) {
|
|
1222
1003
|
leave("saved");
|
|
1223
1004
|
return;
|
|
@@ -1227,14 +1008,14 @@ function HelpScreen({ onDone }) {
|
|
|
1227
1008
|
return;
|
|
1228
1009
|
}
|
|
1229
1010
|
});
|
|
1230
|
-
return /* @__PURE__ */
|
|
1231
|
-
/* @__PURE__ */
|
|
1232
|
-
info ? /* @__PURE__ */
|
|
1233
|
-
/* @__PURE__ */
|
|
1234
|
-
/* @__PURE__ */
|
|
1235
|
-
/* @__PURE__ */
|
|
1236
|
-
] }) : /* @__PURE__ */
|
|
1237
|
-
/* @__PURE__ */
|
|
1011
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, gap: 1, children: [
|
|
1012
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, children: "Help" }),
|
|
1013
|
+
info ? /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
1014
|
+
/* @__PURE__ */ jsx7(Section, { title: "Where things are stored", rows: info.storage }),
|
|
1015
|
+
/* @__PURE__ */ jsx7(Section, { title: "Troubleshooting", rows: info.troubleshooting }),
|
|
1016
|
+
/* @__PURE__ */ jsx7(Text7, { color: PALETTE.muted, 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." })
|
|
1017
|
+
] }) : /* @__PURE__ */ jsx7(Text7, { color: PALETTE.accent, children: "Loading..." }),
|
|
1018
|
+
/* @__PURE__ */ jsx7(
|
|
1238
1019
|
ControlHints,
|
|
1239
1020
|
{
|
|
1240
1021
|
hints: [
|
|
@@ -1247,20 +1028,20 @@ function HelpScreen({ onDone }) {
|
|
|
1247
1028
|
}
|
|
1248
1029
|
|
|
1249
1030
|
// packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
|
|
1250
|
-
import { useState as
|
|
1251
|
-
import { Box as
|
|
1252
|
-
import { jsx as
|
|
1031
|
+
import { useState as useState7 } from "react";
|
|
1032
|
+
import { Box as Box7, Text as Text8, useInput as useInput7 } from "ink";
|
|
1033
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1253
1034
|
function SettingsScreen({
|
|
1254
1035
|
onNavigate,
|
|
1255
1036
|
onBack
|
|
1256
1037
|
}) {
|
|
1257
|
-
const [focusIdx, setFocusIdx] =
|
|
1038
|
+
const [focusIdx, setFocusIdx] = useState7(0);
|
|
1258
1039
|
const items = [
|
|
1259
1040
|
{ label: "Configuration", screen: "settings-configuration" },
|
|
1260
1041
|
{ label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
|
|
1261
1042
|
{ label: "Debug Mode", screen: "settings-debug-mode" }
|
|
1262
1043
|
];
|
|
1263
|
-
|
|
1044
|
+
useInput7((input, key) => {
|
|
1264
1045
|
if (key.upArrow) {
|
|
1265
1046
|
setFocusIdx((i) => (i - 1 + items.length) % items.length);
|
|
1266
1047
|
return;
|
|
@@ -1280,15 +1061,15 @@ function SettingsScreen({
|
|
|
1280
1061
|
onBack();
|
|
1281
1062
|
}
|
|
1282
1063
|
});
|
|
1283
|
-
return /* @__PURE__ */
|
|
1284
|
-
/* @__PURE__ */
|
|
1285
|
-
/* @__PURE__ */
|
|
1286
|
-
items.map((item, i) => /* @__PURE__ */
|
|
1064
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1065
|
+
/* @__PURE__ */ jsx8(Text8, { bold: true, children: "Settings" }),
|
|
1066
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
1067
|
+
items.map((item, i) => /* @__PURE__ */ jsxs7(Text8, { color: i === focusIdx ? "cyan" : void 0, children: [
|
|
1287
1068
|
i === focusIdx ? "> " : " ",
|
|
1288
1069
|
item.label
|
|
1289
1070
|
] }, item.label)),
|
|
1290
|
-
/* @__PURE__ */
|
|
1291
|
-
/* @__PURE__ */
|
|
1071
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
1072
|
+
/* @__PURE__ */ jsx8(
|
|
1292
1073
|
ControlHints,
|
|
1293
1074
|
{
|
|
1294
1075
|
hints: [
|
|
@@ -1302,9 +1083,9 @@ function SettingsScreen({
|
|
|
1302
1083
|
}
|
|
1303
1084
|
|
|
1304
1085
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
1305
|
-
import { useEffect as useEffect5, useState as
|
|
1306
|
-
import { Box as
|
|
1307
|
-
import
|
|
1086
|
+
import { useEffect as useEffect5, useState as useState8 } from "react";
|
|
1087
|
+
import { Box as Box8, Text as Text9, useInput as useInput8 } from "ink";
|
|
1088
|
+
import TextInput3 from "ink-text-input";
|
|
1308
1089
|
|
|
1309
1090
|
// packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
|
|
1310
1091
|
var readV1Store = readSettings;
|
|
@@ -1335,7 +1116,7 @@ async function writeCredentials(config) {
|
|
|
1335
1116
|
}
|
|
1336
1117
|
|
|
1337
1118
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
1338
|
-
import { Fragment as
|
|
1119
|
+
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1339
1120
|
var FIELD_ORDER = [
|
|
1340
1121
|
"spaceId",
|
|
1341
1122
|
"environmentId",
|
|
@@ -1363,13 +1144,13 @@ var FIELD_LABELS = {
|
|
|
1363
1144
|
defaultTokenFile: "Default token file (optional)"
|
|
1364
1145
|
};
|
|
1365
1146
|
function ConfigurationScreen({ onDone }) {
|
|
1366
|
-
const [stage, setStage] =
|
|
1367
|
-
const [config, setConfig] =
|
|
1368
|
-
const [activeField, setActiveField] =
|
|
1369
|
-
const [notice, setNotice] =
|
|
1370
|
-
const [lastSaved, setLastSaved] =
|
|
1371
|
-
const [editing, setEditing] =
|
|
1372
|
-
const [valueBeforeEdit, setValueBeforeEdit] =
|
|
1147
|
+
const [stage, setStage] = useState8("loading");
|
|
1148
|
+
const [config, setConfig] = useState8(null);
|
|
1149
|
+
const [activeField, setActiveField] = useState8("spaceId");
|
|
1150
|
+
const [notice, setNotice] = useState8(null);
|
|
1151
|
+
const [lastSaved, setLastSaved] = useState8(null);
|
|
1152
|
+
const [editing, setEditing] = useState8(false);
|
|
1153
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState8("");
|
|
1373
1154
|
useEffect5(() => {
|
|
1374
1155
|
readCredentials().then((cfg) => {
|
|
1375
1156
|
setConfig(cfg);
|
|
@@ -1410,7 +1191,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1410
1191
|
);
|
|
1411
1192
|
onDone();
|
|
1412
1193
|
}
|
|
1413
|
-
|
|
1194
|
+
useInput8((input, key) => {
|
|
1414
1195
|
if (stage === "loading" || stage === "saving") return;
|
|
1415
1196
|
if (editing) {
|
|
1416
1197
|
if (key.escape) {
|
|
@@ -1447,46 +1228,46 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1447
1228
|
}
|
|
1448
1229
|
});
|
|
1449
1230
|
if (stage === "loading") {
|
|
1450
|
-
return /* @__PURE__ */
|
|
1451
|
-
/* @__PURE__ */
|
|
1452
|
-
/* @__PURE__ */
|
|
1453
|
-
/* @__PURE__ */
|
|
1231
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1232
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, children: "Configuration" }),
|
|
1233
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1234
|
+
/* @__PURE__ */ jsx9(Text9, { color: PALETTE.accent, children: "Loading..." })
|
|
1454
1235
|
] });
|
|
1455
1236
|
}
|
|
1456
|
-
return /* @__PURE__ */
|
|
1457
|
-
/* @__PURE__ */
|
|
1458
|
-
/* @__PURE__ */
|
|
1459
|
-
/* @__PURE__ */
|
|
1237
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1238
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, children: "Configuration" }),
|
|
1239
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1240
|
+
/* @__PURE__ */ jsx9(Box8, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
|
|
1460
1241
|
const isActive = activeField === field;
|
|
1461
1242
|
const value = fieldValue(field);
|
|
1462
1243
|
const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
|
|
1463
|
-
return /* @__PURE__ */
|
|
1464
|
-
/* @__PURE__ */
|
|
1465
|
-
/* @__PURE__ */
|
|
1244
|
+
return /* @__PURE__ */ jsxs8(Box8, { gap: 1, children: [
|
|
1245
|
+
/* @__PURE__ */ jsx9(Text9, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
1246
|
+
/* @__PURE__ */ jsxs8(Text9, { bold: isActive, children: [
|
|
1466
1247
|
FIELD_LABELS[field],
|
|
1467
1248
|
":"
|
|
1468
1249
|
] }),
|
|
1469
|
-
isActive && editing ? /* @__PURE__ */
|
|
1470
|
-
|
|
1250
|
+
isActive && editing ? /* @__PURE__ */ jsx9(
|
|
1251
|
+
TextInput3,
|
|
1471
1252
|
{
|
|
1472
1253
|
value,
|
|
1473
1254
|
onChange: (next) => setFieldValue(field, next),
|
|
1474
1255
|
onSubmit: () => setEditing(false),
|
|
1475
1256
|
mask: field === "cmaToken" ? "\u2022" : void 0
|
|
1476
1257
|
}
|
|
1477
|
-
) : /* @__PURE__ */
|
|
1258
|
+
) : /* @__PURE__ */ jsx9(Text9, { children: display || /* @__PURE__ */ jsx9(Text9, { color: PALETTE.muted, children: "(empty)" }) })
|
|
1478
1259
|
] }, field);
|
|
1479
1260
|
}) }),
|
|
1480
|
-
notice && /* @__PURE__ */
|
|
1481
|
-
/* @__PURE__ */
|
|
1482
|
-
/* @__PURE__ */
|
|
1261
|
+
notice && /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
1262
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1263
|
+
/* @__PURE__ */ jsxs8(Text9, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
1483
1264
|
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
1484
1265
|
" ",
|
|
1485
1266
|
notice.text
|
|
1486
1267
|
] })
|
|
1487
1268
|
] }),
|
|
1488
|
-
/* @__PURE__ */
|
|
1489
|
-
/* @__PURE__ */
|
|
1269
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1270
|
+
/* @__PURE__ */ jsx9(
|
|
1490
1271
|
ControlHints,
|
|
1491
1272
|
{
|
|
1492
1273
|
hints: editing ? [
|
|
@@ -1507,8 +1288,8 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1507
1288
|
}
|
|
1508
1289
|
|
|
1509
1290
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
1510
|
-
import { useEffect as useEffect6, useState as
|
|
1511
|
-
import { Box as
|
|
1291
|
+
import { useEffect as useEffect6, useState as useState9 } from "react";
|
|
1292
|
+
import { Box as Box9, Text as Text10, useInput as useInput9 } from "ink";
|
|
1512
1293
|
|
|
1513
1294
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
|
|
1514
1295
|
async function readAnalyticsSetting() {
|
|
@@ -1526,10 +1307,10 @@ async function writeAnalyticsSetting(setting) {
|
|
|
1526
1307
|
}
|
|
1527
1308
|
|
|
1528
1309
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
1529
|
-
import { Fragment as
|
|
1310
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1530
1311
|
function OptInAnalyticsScreen({ onDone }) {
|
|
1531
|
-
const [loading, setLoading] =
|
|
1532
|
-
const [enabled, setEnabled] =
|
|
1312
|
+
const [loading, setLoading] = useState9(true);
|
|
1313
|
+
const [enabled, setEnabled] = useState9(true);
|
|
1533
1314
|
useEffect6(() => {
|
|
1534
1315
|
readAnalyticsSetting().then((setting) => {
|
|
1535
1316
|
setEnabled(setting.enabled);
|
|
@@ -1542,7 +1323,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1542
1323
|
});
|
|
1543
1324
|
});
|
|
1544
1325
|
}, []);
|
|
1545
|
-
|
|
1326
|
+
useInput9((input, key) => {
|
|
1546
1327
|
if (loading) return;
|
|
1547
1328
|
if (key.return || input === " ") {
|
|
1548
1329
|
setEnabled((current) => {
|
|
@@ -1557,21 +1338,21 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1557
1338
|
onDone();
|
|
1558
1339
|
}
|
|
1559
1340
|
});
|
|
1560
|
-
return /* @__PURE__ */
|
|
1561
|
-
/* @__PURE__ */
|
|
1562
|
-
/* @__PURE__ */
|
|
1563
|
-
loading ? /* @__PURE__ */
|
|
1564
|
-
/* @__PURE__ */
|
|
1341
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1342
|
+
/* @__PURE__ */ jsx10(Text10, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
|
|
1343
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1344
|
+
loading ? /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
1345
|
+
/* @__PURE__ */ jsxs9(Text10, { children: [
|
|
1565
1346
|
"Share anonymous usage data:",
|
|
1566
1347
|
" ",
|
|
1567
|
-
/* @__PURE__ */
|
|
1348
|
+
/* @__PURE__ */ jsx10(Text10, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
1568
1349
|
] }),
|
|
1569
|
-
/* @__PURE__ */
|
|
1570
|
-
/* @__PURE__ */
|
|
1571
|
-
/* @__PURE__ */
|
|
1350
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1351
|
+
/* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "Shares which CLI commands are used and where imports succeed or fail." }),
|
|
1352
|
+
/* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "Never includes source code, file paths, credentials, or authored content." })
|
|
1572
1353
|
] }),
|
|
1573
|
-
/* @__PURE__ */
|
|
1574
|
-
/* @__PURE__ */
|
|
1354
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1355
|
+
/* @__PURE__ */ jsx10(
|
|
1575
1356
|
ControlHints,
|
|
1576
1357
|
{
|
|
1577
1358
|
hints: [
|
|
@@ -1584,12 +1365,12 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1584
1365
|
}
|
|
1585
1366
|
|
|
1586
1367
|
// packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
|
|
1587
|
-
import { useEffect as useEffect7, useState as
|
|
1588
|
-
import { Box as
|
|
1589
|
-
import { jsx as
|
|
1368
|
+
import { useEffect as useEffect7, useState as useState10 } from "react";
|
|
1369
|
+
import { Box as Box10, Text as Text11, useInput as useInput10 } from "ink";
|
|
1370
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1590
1371
|
var UPGRADE_COMMANDS = ["git pull", "pnpm install", "pnpm build"];
|
|
1591
1372
|
function UpgradeScreen({ onDone }) {
|
|
1592
|
-
const [upgradeCheck, setUpgradeCheck] =
|
|
1373
|
+
const [upgradeCheck, setUpgradeCheck] = useState10();
|
|
1593
1374
|
useEffect7(() => {
|
|
1594
1375
|
startDebugRun({
|
|
1595
1376
|
flow: "upgrade",
|
|
@@ -1599,7 +1380,7 @@ function UpgradeScreen({ onDone }) {
|
|
|
1599
1380
|
});
|
|
1600
1381
|
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
1601
1382
|
}, []);
|
|
1602
|
-
|
|
1383
|
+
useInput10((_input, key) => {
|
|
1603
1384
|
if (key.return) {
|
|
1604
1385
|
void finishDebugRun({
|
|
1605
1386
|
outputs: upgradeCheck ?? {},
|
|
@@ -1610,12 +1391,12 @@ function UpgradeScreen({ onDone }) {
|
|
|
1610
1391
|
return;
|
|
1611
1392
|
}
|
|
1612
1393
|
});
|
|
1613
|
-
return /* @__PURE__ */
|
|
1614
|
-
/* @__PURE__ */
|
|
1615
|
-
/* @__PURE__ */
|
|
1394
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1395
|
+
/* @__PURE__ */ jsx11(Text11, { bold: true, children: "Upgrade" }),
|
|
1396
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1616
1397
|
renderBody(upgradeCheck),
|
|
1617
|
-
/* @__PURE__ */
|
|
1618
|
-
/* @__PURE__ */
|
|
1398
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1399
|
+
/* @__PURE__ */ jsxs10(Text11, { bold: true, color: PALETTE.accent, children: [
|
|
1619
1400
|
FOCUS_MARKER,
|
|
1620
1401
|
" Go Back"
|
|
1621
1402
|
] })
|
|
@@ -1623,44 +1404,44 @@ function UpgradeScreen({ onDone }) {
|
|
|
1623
1404
|
}
|
|
1624
1405
|
function renderBody(upgradeCheck) {
|
|
1625
1406
|
if (!upgradeCheck) {
|
|
1626
|
-
return /* @__PURE__ */
|
|
1407
|
+
return /* @__PURE__ */ jsx11(Text11, { color: PALETTE.muted, children: "Checking for updates\u2026" });
|
|
1627
1408
|
}
|
|
1628
1409
|
if (upgradeCheck.status === "error") {
|
|
1629
|
-
return /* @__PURE__ */
|
|
1410
|
+
return /* @__PURE__ */ jsx11(Text11, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
|
|
1630
1411
|
}
|
|
1631
1412
|
if (upgradeCheck.status === "up-to-date") {
|
|
1632
|
-
return /* @__PURE__ */
|
|
1413
|
+
return /* @__PURE__ */ jsxs10(Text11, { color: PALETTE.success, children: [
|
|
1633
1414
|
"You're already on the latest version (v",
|
|
1634
1415
|
upgradeCheck.current,
|
|
1635
1416
|
")."
|
|
1636
1417
|
] });
|
|
1637
1418
|
}
|
|
1638
|
-
return /* @__PURE__ */
|
|
1639
|
-
/* @__PURE__ */
|
|
1640
|
-
/* @__PURE__ */
|
|
1419
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", children: [
|
|
1420
|
+
/* @__PURE__ */ jsxs10(Text11, { color: PALETTE.muted, children: [
|
|
1421
|
+
/* @__PURE__ */ jsxs10(Text11, { bold: true, color: PALETTE.success, children: [
|
|
1641
1422
|
"v",
|
|
1642
1423
|
upgradeCheck.latest
|
|
1643
1424
|
] }),
|
|
1644
1425
|
" ",
|
|
1645
1426
|
"is available (you're on ",
|
|
1646
|
-
/* @__PURE__ */
|
|
1427
|
+
/* @__PURE__ */ jsxs10(Text11, { bold: true, children: [
|
|
1647
1428
|
"v",
|
|
1648
1429
|
upgradeCheck.current
|
|
1649
1430
|
] }),
|
|
1650
1431
|
"). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
|
|
1651
1432
|
] }),
|
|
1652
|
-
/* @__PURE__ */
|
|
1653
|
-
/* @__PURE__ */
|
|
1433
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1434
|
+
/* @__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)) })
|
|
1654
1435
|
] });
|
|
1655
1436
|
}
|
|
1656
1437
|
|
|
1657
1438
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
1658
|
-
import { useEffect as useEffect8, useState as
|
|
1659
|
-
import { Box as
|
|
1660
|
-
import { jsx as
|
|
1439
|
+
import { useEffect as useEffect8, useState as useState11 } from "react";
|
|
1440
|
+
import { Box as Box11, Text as Text12, useInput as useInput11 } from "ink";
|
|
1441
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1661
1442
|
function DebugModeScreen({ onDone }) {
|
|
1662
|
-
const [loading, setLoading] =
|
|
1663
|
-
const [enabled, setEnabled] =
|
|
1443
|
+
const [loading, setLoading] = useState11(true);
|
|
1444
|
+
const [enabled, setEnabled] = useState11(true);
|
|
1664
1445
|
useEffect8(() => {
|
|
1665
1446
|
readDebugModeSetting().then((setting) => {
|
|
1666
1447
|
setEnabled(setting.enabled);
|
|
@@ -1673,7 +1454,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
1673
1454
|
});
|
|
1674
1455
|
});
|
|
1675
1456
|
}, []);
|
|
1676
|
-
|
|
1457
|
+
useInput11((input, key) => {
|
|
1677
1458
|
if (loading) return;
|
|
1678
1459
|
if (key.return || input === " ") {
|
|
1679
1460
|
setEnabled((current) => {
|
|
@@ -1688,16 +1469,16 @@ function DebugModeScreen({ onDone }) {
|
|
|
1688
1469
|
onDone();
|
|
1689
1470
|
}
|
|
1690
1471
|
});
|
|
1691
|
-
return /* @__PURE__ */
|
|
1692
|
-
/* @__PURE__ */
|
|
1693
|
-
/* @__PURE__ */
|
|
1694
|
-
loading ? /* @__PURE__ */
|
|
1472
|
+
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1473
|
+
/* @__PURE__ */ jsx12(Text12, { bold: true, children: "Settings \u203A Debug Mode" }),
|
|
1474
|
+
/* @__PURE__ */ jsx12(Text12, { children: " " }),
|
|
1475
|
+
loading ? /* @__PURE__ */ jsx12(Text12, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs11(Text12, { children: [
|
|
1695
1476
|
"Debug logging:",
|
|
1696
1477
|
" ",
|
|
1697
|
-
/* @__PURE__ */
|
|
1478
|
+
/* @__PURE__ */ jsx12(Text12, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
1698
1479
|
] }),
|
|
1699
|
-
/* @__PURE__ */
|
|
1700
|
-
/* @__PURE__ */
|
|
1480
|
+
/* @__PURE__ */ jsx12(Text12, { children: " " }),
|
|
1481
|
+
/* @__PURE__ */ jsx12(
|
|
1701
1482
|
ControlHints,
|
|
1702
1483
|
{
|
|
1703
1484
|
hints: [
|
|
@@ -1710,38 +1491,28 @@ function DebugModeScreen({ onDone }) {
|
|
|
1710
1491
|
}
|
|
1711
1492
|
|
|
1712
1493
|
// packages/experience-design-system-cli/app.tsx
|
|
1713
|
-
import { Fragment as
|
|
1494
|
+
import { Fragment as Fragment4, jsx as jsx13 } from "react/jsx-runtime";
|
|
1714
1495
|
function App({ onLaunchImport, importExitCode }) {
|
|
1715
1496
|
const returnedFromImport = importExitCode !== void 0;
|
|
1716
|
-
const [screen, setScreen] =
|
|
1717
|
-
const [showImportResult, setShowImportResult] =
|
|
1718
|
-
const [projectPath, setProjectPath] =
|
|
1719
|
-
const [tokensPath, setTokensPath] =
|
|
1720
|
-
const [
|
|
1721
|
-
const [importDefaults, setImportDefaults] = useState13();
|
|
1497
|
+
const [screen, setScreen] = useState12(returnedFromImport ? "import" : "start");
|
|
1498
|
+
const [showImportResult, setShowImportResult] = useState12(returnedFromImport);
|
|
1499
|
+
const [projectPath, setProjectPath] = useState12();
|
|
1500
|
+
const [tokensPath, setTokensPath] = useState12();
|
|
1501
|
+
const [importDefaults, setImportDefaults] = useState12();
|
|
1722
1502
|
useEffect9(() => {
|
|
1723
1503
|
if (screen !== "import") {
|
|
1724
1504
|
setImportDefaults(void 0);
|
|
1725
1505
|
return;
|
|
1726
1506
|
}
|
|
1727
1507
|
void readCredentials().then(
|
|
1728
|
-
(saved) => setImportDefaults({
|
|
1729
|
-
componentDir: saved.defaultComponentDir ?? "",
|
|
1730
|
-
tokenFile: saved.defaultTokenFile ?? "",
|
|
1731
|
-
credentials: saved
|
|
1732
|
-
})
|
|
1508
|
+
(saved) => setImportDefaults({ componentDir: saved.defaultComponentDir ?? "", tokenFile: saved.defaultTokenFile ?? "" })
|
|
1733
1509
|
);
|
|
1734
1510
|
}, [screen]);
|
|
1735
|
-
const finishCredentials = async (result, project, tokens) => {
|
|
1736
|
-
if (!result.skipped) await writeCredentials({ ...result.credentials });
|
|
1737
|
-
onLaunchImport?.({ project, tokens, skipCredentials: result.skipped });
|
|
1738
|
-
};
|
|
1739
1511
|
const goToStart = () => setScreen("start");
|
|
1740
1512
|
const goToSettings = () => setScreen("settings");
|
|
1741
1513
|
const resetImport = () => {
|
|
1742
1514
|
setProjectPath(void 0);
|
|
1743
1515
|
setTokensPath(void 0);
|
|
1744
|
-
setPathConfirmed(false);
|
|
1745
1516
|
};
|
|
1746
1517
|
const finishImportResult = () => {
|
|
1747
1518
|
setShowImportResult(false);
|
|
@@ -1754,13 +1525,13 @@ function App({ onLaunchImport, importExitCode }) {
|
|
|
1754
1525
|
};
|
|
1755
1526
|
switch (screen) {
|
|
1756
1527
|
case "import":
|
|
1757
|
-
if (showImportResult) return /* @__PURE__ */
|
|
1758
|
-
if (importDefaults === void 0) return /* @__PURE__ */
|
|
1528
|
+
if (showImportResult) return /* @__PURE__ */ jsx13(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
|
|
1529
|
+
if (importDefaults === void 0) return /* @__PURE__ */ jsx13(Fragment4, {});
|
|
1759
1530
|
if (projectPath === void 0) {
|
|
1760
|
-
return /* @__PURE__ */
|
|
1531
|
+
return /* @__PURE__ */ jsx13(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
|
|
1761
1532
|
}
|
|
1762
1533
|
if (tokensPath === void 0) {
|
|
1763
|
-
return /* @__PURE__ */
|
|
1534
|
+
return /* @__PURE__ */ jsx13(
|
|
1764
1535
|
TokenInputScreen,
|
|
1765
1536
|
{
|
|
1766
1537
|
initialPath: importDefaults.tokenFile,
|
|
@@ -1769,46 +1540,36 @@ function App({ onLaunchImport, importExitCode }) {
|
|
|
1769
1540
|
}
|
|
1770
1541
|
);
|
|
1771
1542
|
}
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
PathValidationScreen,
|
|
1775
|
-
{
|
|
1776
|
-
projectPath,
|
|
1777
|
-
onConfirm: () => setPathConfirmed(true),
|
|
1778
|
-
onChangePath: resetImport,
|
|
1779
|
-
onBack: () => setTokensPath(void 0)
|
|
1780
|
-
}
|
|
1781
|
-
);
|
|
1782
|
-
}
|
|
1783
|
-
return /* @__PURE__ */ jsx14(
|
|
1784
|
-
CredentialsScreen,
|
|
1543
|
+
return /* @__PURE__ */ jsx13(
|
|
1544
|
+
PathValidationScreen,
|
|
1785
1545
|
{
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1546
|
+
projectPath,
|
|
1547
|
+
onConfirm: (project) => onLaunchImport?.({ project, tokens: tokensPath }),
|
|
1548
|
+
onChangePath: resetImport,
|
|
1549
|
+
onBack: () => setTokensPath(void 0)
|
|
1789
1550
|
}
|
|
1790
1551
|
);
|
|
1791
1552
|
case "help":
|
|
1792
|
-
return /* @__PURE__ */
|
|
1553
|
+
return /* @__PURE__ */ jsx13(HelpScreen, { onDone: goToStart });
|
|
1793
1554
|
case "upgrade":
|
|
1794
|
-
return /* @__PURE__ */
|
|
1555
|
+
return /* @__PURE__ */ jsx13(UpgradeScreen, { onDone: goToStart });
|
|
1795
1556
|
case "settings":
|
|
1796
|
-
return /* @__PURE__ */
|
|
1557
|
+
return /* @__PURE__ */ jsx13(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
1797
1558
|
case "settings-configuration":
|
|
1798
|
-
return /* @__PURE__ */
|
|
1559
|
+
return /* @__PURE__ */ jsx13(ConfigurationScreen, { onDone: goToSettings });
|
|
1799
1560
|
case "settings-opt-in-analytics":
|
|
1800
|
-
return /* @__PURE__ */
|
|
1561
|
+
return /* @__PURE__ */ jsx13(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
1801
1562
|
case "settings-debug-mode":
|
|
1802
|
-
return /* @__PURE__ */
|
|
1563
|
+
return /* @__PURE__ */ jsx13(DebugModeScreen, { onDone: goToSettings });
|
|
1803
1564
|
case "start":
|
|
1804
|
-
return /* @__PURE__ */
|
|
1565
|
+
return /* @__PURE__ */ jsx13(HomeScreen, { onNavigate: setScreen });
|
|
1805
1566
|
}
|
|
1806
1567
|
}
|
|
1807
1568
|
var CLEAR_SCREEN = "\x1B[2J\x1B[H";
|
|
1808
1569
|
async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
|
|
1809
1570
|
let requestedImport;
|
|
1810
1571
|
const instance = renderApp(
|
|
1811
|
-
/* @__PURE__ */
|
|
1572
|
+
/* @__PURE__ */ jsx13(
|
|
1812
1573
|
App,
|
|
1813
1574
|
{
|
|
1814
1575
|
importExitCode,
|