@contentful/experience-design-system-cli 2.37.1-dev-build-b65632a0.0 → 2.37.1-dev-build-979aba4b.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 +389 -150
- package/dist/index.js +421 -154
- package/dist/package.json +2 -1
- package/dist/src/tui/home/home.theme.d.ts +2 -1
- package/dist/src/tui/import/spawn-v1-import.d.ts +1 -0
- package/dist/src/tui/import/steps/04-credentials/controls.d.ts +21 -0
- package/dist/src/tui/import/steps/04-credentials/logic.d.ts +18 -0
- package/dist/src/tui/import/steps/04-credentials/screen.d.ts +17 -0
- package/dist/src/tui/import/steps/04-credentials/validate.d.ts +8 -0
- package/dist/src/tui/import/steps/index.d.ts +1 -0
- 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/index.js +1085 -1476
- package/legacy/package.json +2 -1
- package/package.json +3 -2
- package/legacy/dist/src/import/tui/steps/CredentialsStep.d.ts +0 -43
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 useState13 } 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,11 +12,14 @@ var BRAND = {
|
|
|
12
12
|
orange: "#E44F20",
|
|
13
13
|
yellow: "#FFDA00",
|
|
14
14
|
white: "#FFFFFF",
|
|
15
|
-
slate: "#
|
|
16
|
-
steel: "#C4D1DE"
|
|
15
|
+
slate: "#A6B5C7",
|
|
16
|
+
steel: "#C4D1DE",
|
|
17
|
+
mist: "#DDE5EC",
|
|
18
|
+
fog: "#EFF2F6"
|
|
17
19
|
};
|
|
18
20
|
var PALETTE = {
|
|
19
21
|
accent: BRAND.blue,
|
|
22
|
+
heading: BRAND.white,
|
|
20
23
|
success: BRAND.green,
|
|
21
24
|
error: BRAND.orange,
|
|
22
25
|
warning: BRAND.yellow,
|
|
@@ -118,7 +121,7 @@ function useTerminalWidth() {
|
|
|
118
121
|
import { Text } from "ink";
|
|
119
122
|
import { jsx } from "react/jsx-runtime";
|
|
120
123
|
function ControlHints({ hints }) {
|
|
121
|
-
return /* @__PURE__ */ jsx(Text, { children: hints.map((hint) =>
|
|
124
|
+
return /* @__PURE__ */ jsx(Text, { color: PALETTE.muted, children: hints.map((hint) => `${hint.keys} ${hint.label}`).join(" \xB7 ") });
|
|
122
125
|
}
|
|
123
126
|
|
|
124
127
|
// packages/experience-design-system-cli/src/tui/home/home.tsx
|
|
@@ -181,7 +184,7 @@ function HomeScreen({ onNavigate }) {
|
|
|
181
184
|
}
|
|
182
185
|
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
183
186
|
/* @__PURE__ */ jsxs(Box, { flexDirection: "column", alignItems: "center", children: [
|
|
184
|
-
/* @__PURE__ */ jsx2(Text2, { bold: true, children: HEADING }),
|
|
187
|
+
/* @__PURE__ */ jsx2(Text2, { bold: true, color: PALETTE.heading, children: HEADING }),
|
|
185
188
|
/* @__PURE__ */ jsx2(Text2, { children: brandBar(HEADING.length).map((segment, i) => /* @__PURE__ */ jsx2(Text2, { color: segment.color, children: segment.text }, i)) }),
|
|
186
189
|
/* @__PURE__ */ jsx2(Text2, { color: PALETTE.muted, children: SUBTITLE }),
|
|
187
190
|
/* @__PURE__ */ jsxs(Text2, { color: PALETTE.muted, children: [
|
|
@@ -198,7 +201,8 @@ function HomeScreen({ onNavigate }) {
|
|
|
198
201
|
Text2,
|
|
199
202
|
{
|
|
200
203
|
bold: focused && !dimmed,
|
|
201
|
-
|
|
204
|
+
dimColor: dimmed,
|
|
205
|
+
color: focused && !dimmed ? PALETTE.accent : display.color,
|
|
202
206
|
children: [
|
|
203
207
|
focused ? `${FOCUS_MARKER} ` : " ",
|
|
204
208
|
display.label
|
|
@@ -231,13 +235,14 @@ function ImportScreen({ exitCode, onDone }) {
|
|
|
231
235
|
});
|
|
232
236
|
const isSuccess = exitCode === 0;
|
|
233
237
|
return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
238
|
+
/* @__PURE__ */ jsx3(Text3, { bold: true, children: "Import" }),
|
|
234
239
|
/* @__PURE__ */ jsx3(Text3, { children: " " }),
|
|
235
240
|
isSuccess ? /* @__PURE__ */ jsx3(Text3, { color: PALETTE.success, children: "\u2713 Import complete" }) : /* @__PURE__ */ jsxs2(Text3, { color: PALETTE.error, children: [
|
|
236
241
|
"\u2717 Import failed: process exited with code ",
|
|
237
242
|
exitCode ?? "unknown"
|
|
238
243
|
] }),
|
|
239
244
|
/* @__PURE__ */ jsx3(Text3, { children: " " }),
|
|
240
|
-
/* @__PURE__ */ jsx3(Text3, { children: "[Enter] Back to Start" })
|
|
245
|
+
/* @__PURE__ */ jsx3(Text3, { dimColor: true, children: "[Enter] Back to Start" })
|
|
241
246
|
] });
|
|
242
247
|
}
|
|
243
248
|
|
|
@@ -288,16 +293,16 @@ function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
|
|
|
288
293
|
};
|
|
289
294
|
return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
290
295
|
/* @__PURE__ */ jsx4(Text4, { bold: true, color: PALETTE.success, children: "\u{1F44B} Hey! Let's import your design system into Contentful." }),
|
|
291
|
-
/* @__PURE__ */ jsx4(Text4, {
|
|
292
|
-
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
|
|
296
|
+
/* @__PURE__ */ jsx4(Text4, { dimColor: true, children: "I'll walk you through 5 steps to get your components into Contentful ExO." }),
|
|
297
|
+
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", marginTop: 1, children: [
|
|
293
298
|
/* @__PURE__ */ jsx4(Text4, { dimColor: true, children: RULE }),
|
|
294
299
|
OVERVIEW.map((item) => /* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
|
|
295
300
|
/* @__PURE__ */ jsx4(Text4, { bold: true, children: item.label }),
|
|
296
|
-
/* @__PURE__ */ jsx4(Text4, {
|
|
301
|
+
/* @__PURE__ */ jsx4(Text4, { dimColor: true, children: item.description })
|
|
297
302
|
] }, item.label)),
|
|
298
303
|
/* @__PURE__ */ jsx4(Text4, { dimColor: true, children: RULE })
|
|
299
304
|
] }),
|
|
300
|
-
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column",
|
|
305
|
+
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", marginTop: 1, children: [
|
|
301
306
|
/* @__PURE__ */ jsx4(Text4, { children: "Where is your component library?" }),
|
|
302
307
|
/* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
|
|
303
308
|
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.accent, children: "?" }),
|
|
@@ -305,7 +310,7 @@ function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
|
|
|
305
310
|
/* @__PURE__ */ jsx4(TextInput, { value: projectPath, onChange: setProjectPath, onSubmit: submit })
|
|
306
311
|
] })
|
|
307
312
|
] }),
|
|
308
|
-
/* @__PURE__ */ jsx4(Box3, { gap: 3, children: WELCOME_CONTROLS.map((control) => /* @__PURE__ */ jsxs3(Text4, { children: [
|
|
313
|
+
/* @__PURE__ */ jsx4(Box3, { marginTop: 1, gap: 3, children: WELCOME_CONTROLS.map((control) => /* @__PURE__ */ jsxs3(Text4, { dimColor: true, children: [
|
|
309
314
|
"[",
|
|
310
315
|
control.keys,
|
|
311
316
|
"] ",
|
|
@@ -403,7 +408,7 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
|
|
|
403
408
|
};
|
|
404
409
|
return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
405
410
|
/* @__PURE__ */ jsx5(Text5, { bold: true, children: "Design tokens" }),
|
|
406
|
-
/* @__PURE__ */ jsx5(Text5, {
|
|
411
|
+
/* @__PURE__ */ jsx5(Text5, { dimColor: true, 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)." }),
|
|
407
412
|
/* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
|
|
408
413
|
/* @__PURE__ */ jsxs4(Box4, { gap: 1, children: [
|
|
409
414
|
/* @__PURE__ */ jsx5(Text5, { color: PALETTE.accent, children: "?" }),
|
|
@@ -415,13 +420,13 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
|
|
|
415
420
|
"\u2717 ",
|
|
416
421
|
failure.error
|
|
417
422
|
] }),
|
|
418
|
-
failure.resolvedPath && /* @__PURE__ */ jsxs4(Text5, {
|
|
423
|
+
failure.resolvedPath && /* @__PURE__ */ jsxs4(Text5, { dimColor: true, children: [
|
|
419
424
|
" Resolved to: ",
|
|
420
425
|
failure.resolvedPath
|
|
421
426
|
] })
|
|
422
427
|
] })
|
|
423
428
|
] }),
|
|
424
|
-
/* @__PURE__ */ jsx5(Box4, { marginTop: 1, gap: 3, children: TOKEN_INPUT_CONTROLS.map((control) => /* @__PURE__ */ jsxs4(Text5, { children: [
|
|
429
|
+
/* @__PURE__ */ jsx5(Box4, { marginTop: 1, gap: 3, children: TOKEN_INPUT_CONTROLS.map((control) => /* @__PURE__ */ jsxs4(Text5, { dimColor: true, children: [
|
|
425
430
|
"[",
|
|
426
431
|
control.keys,
|
|
427
432
|
"] ",
|
|
@@ -700,6 +705,219 @@ function PathValidationScreen({
|
|
|
700
705
|
] });
|
|
701
706
|
}
|
|
702
707
|
|
|
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: "We use it to check what components already exist and to push your import. If you skip, files are saved locally and nothing is pushed." }),
|
|
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
|
+
|
|
703
921
|
// packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts
|
|
704
922
|
import { spawn } from "node:child_process";
|
|
705
923
|
|
|
@@ -737,7 +955,8 @@ async function spawnV1Import(options = {}) {
|
|
|
737
955
|
const args = buildArgs(options);
|
|
738
956
|
return new Promise((resolvePromise) => {
|
|
739
957
|
const child = spawn("node", [cliPath, ...args], {
|
|
740
|
-
stdio: "inherit"
|
|
958
|
+
stdio: "inherit",
|
|
959
|
+
env: options.skipCredentials ? { ...process.env, EDS_IMPORT_SKIP_CREDENTIALS: "1" } : process.env
|
|
741
960
|
});
|
|
742
961
|
child.on("close", (code) => {
|
|
743
962
|
resolvePromise({ exitCode: code ?? 1, result: void 0, stdout: "", stderr: "" });
|
|
@@ -767,8 +986,8 @@ function startReadingTerminal() {
|
|
|
767
986
|
}
|
|
768
987
|
|
|
769
988
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
770
|
-
import { useEffect as useEffect4, useState as
|
|
771
|
-
import { Box as
|
|
989
|
+
import { useEffect as useEffect4, useState as useState7 } from "react";
|
|
990
|
+
import { Box as Box7, Text as Text8, useInput as useInput7 } from "ink";
|
|
772
991
|
|
|
773
992
|
// packages/experience-design-system-cli/src/tui/debug-store.ts
|
|
774
993
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
@@ -978,18 +1197,18 @@ async function readHelpInfo() {
|
|
|
978
1197
|
}
|
|
979
1198
|
|
|
980
1199
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
981
|
-
import { Fragment, jsx as
|
|
1200
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
982
1201
|
function Section({ title, rows }) {
|
|
983
|
-
return /* @__PURE__ */
|
|
984
|
-
/* @__PURE__ */
|
|
985
|
-
rows.map((row) => /* @__PURE__ */
|
|
986
|
-
/* @__PURE__ */
|
|
987
|
-
/* @__PURE__ */
|
|
1202
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
|
|
1203
|
+
/* @__PURE__ */ jsx8(Text8, { bold: true, color: PALETTE.accent, children: title }),
|
|
1204
|
+
rows.map((row) => /* @__PURE__ */ jsxs7(Box7, { gap: 1, children: [
|
|
1205
|
+
/* @__PURE__ */ jsx8(Box7, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx8(Text8, { dimColor: true, children: row.label }) }),
|
|
1206
|
+
/* @__PURE__ */ jsx8(Text8, { children: row.value })
|
|
988
1207
|
] }, row.label))
|
|
989
1208
|
] });
|
|
990
1209
|
}
|
|
991
1210
|
function HelpScreen({ onDone }) {
|
|
992
|
-
const [info, setInfo] =
|
|
1211
|
+
const [info, setInfo] = useState7();
|
|
993
1212
|
useEffect4(() => {
|
|
994
1213
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
995
1214
|
void readHelpInfo().then(setInfo);
|
|
@@ -998,7 +1217,7 @@ function HelpScreen({ onDone }) {
|
|
|
998
1217
|
void finishDebugRun({ outputs: {}, status: "success", exitMethod });
|
|
999
1218
|
onDone();
|
|
1000
1219
|
};
|
|
1001
|
-
|
|
1220
|
+
useInput7((input, key) => {
|
|
1002
1221
|
if (key.return) {
|
|
1003
1222
|
leave("saved");
|
|
1004
1223
|
return;
|
|
@@ -1008,14 +1227,14 @@ function HelpScreen({ onDone }) {
|
|
|
1008
1227
|
return;
|
|
1009
1228
|
}
|
|
1010
1229
|
});
|
|
1011
|
-
return /* @__PURE__ */
|
|
1012
|
-
/* @__PURE__ */
|
|
1013
|
-
info ? /* @__PURE__ */
|
|
1014
|
-
/* @__PURE__ */
|
|
1015
|
-
/* @__PURE__ */
|
|
1016
|
-
/* @__PURE__ */
|
|
1017
|
-
] }) : /* @__PURE__ */
|
|
1018
|
-
/* @__PURE__ */
|
|
1230
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, gap: 1, children: [
|
|
1231
|
+
/* @__PURE__ */ jsx8(Text8, { bold: true, children: "Help" }),
|
|
1232
|
+
info ? /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
1233
|
+
/* @__PURE__ */ jsx8(Section, { title: "Where things are stored", rows: info.storage }),
|
|
1234
|
+
/* @__PURE__ */ jsx8(Section, { title: "Troubleshooting", rows: info.troubleshooting }),
|
|
1235
|
+
/* @__PURE__ */ jsx8(Text8, { 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." })
|
|
1236
|
+
] }) : /* @__PURE__ */ jsx8(Text8, { color: PALETTE.accent, children: "Loading..." }),
|
|
1237
|
+
/* @__PURE__ */ jsx8(
|
|
1019
1238
|
ControlHints,
|
|
1020
1239
|
{
|
|
1021
1240
|
hints: [
|
|
@@ -1028,20 +1247,20 @@ function HelpScreen({ onDone }) {
|
|
|
1028
1247
|
}
|
|
1029
1248
|
|
|
1030
1249
|
// packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
|
|
1031
|
-
import { useState as
|
|
1032
|
-
import { Box as
|
|
1033
|
-
import { jsx as
|
|
1250
|
+
import { useState as useState8 } from "react";
|
|
1251
|
+
import { Box as Box8, Text as Text9, useInput as useInput8 } from "ink";
|
|
1252
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1034
1253
|
function SettingsScreen({
|
|
1035
1254
|
onNavigate,
|
|
1036
1255
|
onBack
|
|
1037
1256
|
}) {
|
|
1038
|
-
const [focusIdx, setFocusIdx] =
|
|
1257
|
+
const [focusIdx, setFocusIdx] = useState8(0);
|
|
1039
1258
|
const items = [
|
|
1040
1259
|
{ label: "Configuration", screen: "settings-configuration" },
|
|
1041
1260
|
{ label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
|
|
1042
1261
|
{ label: "Debug Mode", screen: "settings-debug-mode" }
|
|
1043
1262
|
];
|
|
1044
|
-
|
|
1263
|
+
useInput8((input, key) => {
|
|
1045
1264
|
if (key.upArrow) {
|
|
1046
1265
|
setFocusIdx((i) => (i - 1 + items.length) % items.length);
|
|
1047
1266
|
return;
|
|
@@ -1061,15 +1280,15 @@ function SettingsScreen({
|
|
|
1061
1280
|
onBack();
|
|
1062
1281
|
}
|
|
1063
1282
|
});
|
|
1064
|
-
return /* @__PURE__ */
|
|
1065
|
-
/* @__PURE__ */
|
|
1066
|
-
/* @__PURE__ */
|
|
1067
|
-
items.map((item, i) => /* @__PURE__ */
|
|
1283
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1284
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, children: "Settings" }),
|
|
1285
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1286
|
+
items.map((item, i) => /* @__PURE__ */ jsxs8(Text9, { color: i === focusIdx ? "cyan" : void 0, children: [
|
|
1068
1287
|
i === focusIdx ? "> " : " ",
|
|
1069
1288
|
item.label
|
|
1070
1289
|
] }, item.label)),
|
|
1071
|
-
/* @__PURE__ */
|
|
1072
|
-
/* @__PURE__ */
|
|
1290
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1291
|
+
/* @__PURE__ */ jsx9(
|
|
1073
1292
|
ControlHints,
|
|
1074
1293
|
{
|
|
1075
1294
|
hints: [
|
|
@@ -1083,9 +1302,9 @@ function SettingsScreen({
|
|
|
1083
1302
|
}
|
|
1084
1303
|
|
|
1085
1304
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
1086
|
-
import { useEffect as useEffect5, useState as
|
|
1087
|
-
import { Box as
|
|
1088
|
-
import
|
|
1305
|
+
import { useEffect as useEffect5, useState as useState9 } from "react";
|
|
1306
|
+
import { Box as Box9, Text as Text10, useInput as useInput9 } from "ink";
|
|
1307
|
+
import TextInput4 from "ink-text-input";
|
|
1089
1308
|
|
|
1090
1309
|
// packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
|
|
1091
1310
|
var readV1Store = readSettings;
|
|
@@ -1116,7 +1335,7 @@ async function writeCredentials(config) {
|
|
|
1116
1335
|
}
|
|
1117
1336
|
|
|
1118
1337
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
1119
|
-
import { Fragment as
|
|
1338
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1120
1339
|
var FIELD_ORDER = [
|
|
1121
1340
|
"spaceId",
|
|
1122
1341
|
"environmentId",
|
|
@@ -1144,13 +1363,13 @@ var FIELD_LABELS = {
|
|
|
1144
1363
|
defaultTokenFile: "Default token file (optional)"
|
|
1145
1364
|
};
|
|
1146
1365
|
function ConfigurationScreen({ onDone }) {
|
|
1147
|
-
const [stage, setStage] =
|
|
1148
|
-
const [config, setConfig] =
|
|
1149
|
-
const [activeField, setActiveField] =
|
|
1150
|
-
const [notice, setNotice] =
|
|
1151
|
-
const [lastSaved, setLastSaved] =
|
|
1152
|
-
const [editing, setEditing] =
|
|
1153
|
-
const [valueBeforeEdit, setValueBeforeEdit] =
|
|
1366
|
+
const [stage, setStage] = useState9("loading");
|
|
1367
|
+
const [config, setConfig] = useState9(null);
|
|
1368
|
+
const [activeField, setActiveField] = useState9("spaceId");
|
|
1369
|
+
const [notice, setNotice] = useState9(null);
|
|
1370
|
+
const [lastSaved, setLastSaved] = useState9(null);
|
|
1371
|
+
const [editing, setEditing] = useState9(false);
|
|
1372
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState9("");
|
|
1154
1373
|
useEffect5(() => {
|
|
1155
1374
|
readCredentials().then((cfg) => {
|
|
1156
1375
|
setConfig(cfg);
|
|
@@ -1191,7 +1410,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1191
1410
|
);
|
|
1192
1411
|
onDone();
|
|
1193
1412
|
}
|
|
1194
|
-
|
|
1413
|
+
useInput9((input, key) => {
|
|
1195
1414
|
if (stage === "loading" || stage === "saving") return;
|
|
1196
1415
|
if (editing) {
|
|
1197
1416
|
if (key.escape) {
|
|
@@ -1228,46 +1447,46 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1228
1447
|
}
|
|
1229
1448
|
});
|
|
1230
1449
|
if (stage === "loading") {
|
|
1231
|
-
return /* @__PURE__ */
|
|
1232
|
-
/* @__PURE__ */
|
|
1233
|
-
/* @__PURE__ */
|
|
1234
|
-
/* @__PURE__ */
|
|
1450
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1451
|
+
/* @__PURE__ */ jsx10(Text10, { bold: true, children: "Configuration" }),
|
|
1452
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1453
|
+
/* @__PURE__ */ jsx10(Text10, { color: PALETTE.accent, children: "Loading..." })
|
|
1235
1454
|
] });
|
|
1236
1455
|
}
|
|
1237
|
-
return /* @__PURE__ */
|
|
1238
|
-
/* @__PURE__ */
|
|
1239
|
-
/* @__PURE__ */
|
|
1240
|
-
/* @__PURE__ */
|
|
1456
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1457
|
+
/* @__PURE__ */ jsx10(Text10, { bold: true, children: "Configuration" }),
|
|
1458
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1459
|
+
/* @__PURE__ */ jsx10(Box9, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
|
|
1241
1460
|
const isActive = activeField === field;
|
|
1242
1461
|
const value = fieldValue(field);
|
|
1243
1462
|
const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
|
|
1244
|
-
return /* @__PURE__ */
|
|
1245
|
-
/* @__PURE__ */
|
|
1246
|
-
/* @__PURE__ */
|
|
1463
|
+
return /* @__PURE__ */ jsxs9(Box9, { gap: 1, children: [
|
|
1464
|
+
/* @__PURE__ */ jsx10(Text10, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
1465
|
+
/* @__PURE__ */ jsxs9(Text10, { bold: isActive, children: [
|
|
1247
1466
|
FIELD_LABELS[field],
|
|
1248
1467
|
":"
|
|
1249
1468
|
] }),
|
|
1250
|
-
isActive && editing ? /* @__PURE__ */
|
|
1251
|
-
|
|
1469
|
+
isActive && editing ? /* @__PURE__ */ jsx10(
|
|
1470
|
+
TextInput4,
|
|
1252
1471
|
{
|
|
1253
1472
|
value,
|
|
1254
1473
|
onChange: (next) => setFieldValue(field, next),
|
|
1255
1474
|
onSubmit: () => setEditing(false),
|
|
1256
1475
|
mask: field === "cmaToken" ? "\u2022" : void 0
|
|
1257
1476
|
}
|
|
1258
|
-
) : /* @__PURE__ */
|
|
1477
|
+
) : /* @__PURE__ */ jsx10(Text10, { children: display || /* @__PURE__ */ jsx10(Text10, { dimColor: true, children: "(empty)" }) })
|
|
1259
1478
|
] }, field);
|
|
1260
1479
|
}) }),
|
|
1261
|
-
notice && /* @__PURE__ */
|
|
1262
|
-
/* @__PURE__ */
|
|
1263
|
-
/* @__PURE__ */
|
|
1480
|
+
notice && /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
1481
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1482
|
+
/* @__PURE__ */ jsxs9(Text10, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
1264
1483
|
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
1265
1484
|
" ",
|
|
1266
1485
|
notice.text
|
|
1267
1486
|
] })
|
|
1268
1487
|
] }),
|
|
1269
|
-
/* @__PURE__ */
|
|
1270
|
-
/* @__PURE__ */
|
|
1488
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1489
|
+
/* @__PURE__ */ jsx10(
|
|
1271
1490
|
ControlHints,
|
|
1272
1491
|
{
|
|
1273
1492
|
hints: editing ? [
|
|
@@ -1288,8 +1507,8 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1288
1507
|
}
|
|
1289
1508
|
|
|
1290
1509
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
1291
|
-
import { useEffect as useEffect6, useState as
|
|
1292
|
-
import { Box as
|
|
1510
|
+
import { useEffect as useEffect6, useState as useState10 } from "react";
|
|
1511
|
+
import { Box as Box10, Text as Text11, useInput as useInput10 } from "ink";
|
|
1293
1512
|
|
|
1294
1513
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
|
|
1295
1514
|
async function readAnalyticsSetting() {
|
|
@@ -1307,10 +1526,10 @@ async function writeAnalyticsSetting(setting) {
|
|
|
1307
1526
|
}
|
|
1308
1527
|
|
|
1309
1528
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
1310
|
-
import { Fragment as
|
|
1529
|
+
import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1311
1530
|
function OptInAnalyticsScreen({ onDone }) {
|
|
1312
|
-
const [loading, setLoading] =
|
|
1313
|
-
const [enabled, setEnabled] =
|
|
1531
|
+
const [loading, setLoading] = useState10(true);
|
|
1532
|
+
const [enabled, setEnabled] = useState10(true);
|
|
1314
1533
|
useEffect6(() => {
|
|
1315
1534
|
readAnalyticsSetting().then((setting) => {
|
|
1316
1535
|
setEnabled(setting.enabled);
|
|
@@ -1323,7 +1542,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1323
1542
|
});
|
|
1324
1543
|
});
|
|
1325
1544
|
}, []);
|
|
1326
|
-
|
|
1545
|
+
useInput10((input, key) => {
|
|
1327
1546
|
if (loading) return;
|
|
1328
1547
|
if (key.return || input === " ") {
|
|
1329
1548
|
setEnabled((current) => {
|
|
@@ -1338,21 +1557,21 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1338
1557
|
onDone();
|
|
1339
1558
|
}
|
|
1340
1559
|
});
|
|
1341
|
-
return /* @__PURE__ */
|
|
1342
|
-
/* @__PURE__ */
|
|
1343
|
-
/* @__PURE__ */
|
|
1344
|
-
loading ? /* @__PURE__ */
|
|
1345
|
-
/* @__PURE__ */
|
|
1560
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1561
|
+
/* @__PURE__ */ jsx11(Text11, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
|
|
1562
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1563
|
+
loading ? /* @__PURE__ */ jsx11(Text11, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
1564
|
+
/* @__PURE__ */ jsxs10(Text11, { children: [
|
|
1346
1565
|
"Share anonymous usage data:",
|
|
1347
1566
|
" ",
|
|
1348
|
-
/* @__PURE__ */
|
|
1567
|
+
/* @__PURE__ */ jsx11(Text11, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
1349
1568
|
] }),
|
|
1350
|
-
/* @__PURE__ */
|
|
1351
|
-
/* @__PURE__ */
|
|
1352
|
-
/* @__PURE__ */
|
|
1569
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1570
|
+
/* @__PURE__ */ jsx11(Text11, { dimColor: true, children: "Shares which CLI commands are used and where imports succeed or fail." }),
|
|
1571
|
+
/* @__PURE__ */ jsx11(Text11, { dimColor: true, children: "Never includes source code, file paths, credentials, or authored content." })
|
|
1353
1572
|
] }),
|
|
1354
|
-
/* @__PURE__ */
|
|
1355
|
-
/* @__PURE__ */
|
|
1573
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1574
|
+
/* @__PURE__ */ jsx11(
|
|
1356
1575
|
ControlHints,
|
|
1357
1576
|
{
|
|
1358
1577
|
hints: [
|
|
@@ -1365,12 +1584,12 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1365
1584
|
}
|
|
1366
1585
|
|
|
1367
1586
|
// packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
|
|
1368
|
-
import { useEffect as useEffect7, useState as
|
|
1369
|
-
import { Box as
|
|
1370
|
-
import { jsx as
|
|
1587
|
+
import { useEffect as useEffect7, useState as useState11 } from "react";
|
|
1588
|
+
import { Box as Box11, Text as Text12, useInput as useInput11 } from "ink";
|
|
1589
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1371
1590
|
var UPGRADE_COMMANDS = ["git pull", "pnpm install", "pnpm build"];
|
|
1372
1591
|
function UpgradeScreen({ onDone }) {
|
|
1373
|
-
const [upgradeCheck, setUpgradeCheck] =
|
|
1592
|
+
const [upgradeCheck, setUpgradeCheck] = useState11();
|
|
1374
1593
|
useEffect7(() => {
|
|
1375
1594
|
startDebugRun({
|
|
1376
1595
|
flow: "upgrade",
|
|
@@ -1380,7 +1599,7 @@ function UpgradeScreen({ onDone }) {
|
|
|
1380
1599
|
});
|
|
1381
1600
|
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
1382
1601
|
}, []);
|
|
1383
|
-
|
|
1602
|
+
useInput11((_input, key) => {
|
|
1384
1603
|
if (key.return) {
|
|
1385
1604
|
void finishDebugRun({
|
|
1386
1605
|
outputs: upgradeCheck ?? {},
|
|
@@ -1391,12 +1610,12 @@ function UpgradeScreen({ onDone }) {
|
|
|
1391
1610
|
return;
|
|
1392
1611
|
}
|
|
1393
1612
|
});
|
|
1394
|
-
return /* @__PURE__ */
|
|
1395
|
-
/* @__PURE__ */
|
|
1396
|
-
/* @__PURE__ */
|
|
1613
|
+
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1614
|
+
/* @__PURE__ */ jsx12(Text12, { bold: true, children: "Upgrade" }),
|
|
1615
|
+
/* @__PURE__ */ jsx12(Text12, { children: " " }),
|
|
1397
1616
|
renderBody(upgradeCheck),
|
|
1398
|
-
/* @__PURE__ */
|
|
1399
|
-
/* @__PURE__ */
|
|
1617
|
+
/* @__PURE__ */ jsx12(Text12, { children: " " }),
|
|
1618
|
+
/* @__PURE__ */ jsxs11(Text12, { bold: true, color: PALETTE.accent, children: [
|
|
1400
1619
|
FOCUS_MARKER,
|
|
1401
1620
|
" Go Back"
|
|
1402
1621
|
] })
|
|
@@ -1404,44 +1623,44 @@ function UpgradeScreen({ onDone }) {
|
|
|
1404
1623
|
}
|
|
1405
1624
|
function renderBody(upgradeCheck) {
|
|
1406
1625
|
if (!upgradeCheck) {
|
|
1407
|
-
return /* @__PURE__ */
|
|
1626
|
+
return /* @__PURE__ */ jsx12(Text12, { color: PALETTE.muted, children: "Checking for updates\u2026" });
|
|
1408
1627
|
}
|
|
1409
1628
|
if (upgradeCheck.status === "error") {
|
|
1410
|
-
return /* @__PURE__ */
|
|
1629
|
+
return /* @__PURE__ */ jsx12(Text12, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
|
|
1411
1630
|
}
|
|
1412
1631
|
if (upgradeCheck.status === "up-to-date") {
|
|
1413
|
-
return /* @__PURE__ */
|
|
1632
|
+
return /* @__PURE__ */ jsxs11(Text12, { color: PALETTE.success, children: [
|
|
1414
1633
|
"You're already on the latest version (v",
|
|
1415
1634
|
upgradeCheck.current,
|
|
1416
1635
|
")."
|
|
1417
1636
|
] });
|
|
1418
1637
|
}
|
|
1419
|
-
return /* @__PURE__ */
|
|
1420
|
-
/* @__PURE__ */
|
|
1421
|
-
/* @__PURE__ */
|
|
1638
|
+
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", children: [
|
|
1639
|
+
/* @__PURE__ */ jsxs11(Text12, { color: PALETTE.muted, children: [
|
|
1640
|
+
/* @__PURE__ */ jsxs11(Text12, { bold: true, color: PALETTE.success, children: [
|
|
1422
1641
|
"v",
|
|
1423
1642
|
upgradeCheck.latest
|
|
1424
1643
|
] }),
|
|
1425
1644
|
" ",
|
|
1426
1645
|
"is available (you're on ",
|
|
1427
|
-
/* @__PURE__ */
|
|
1646
|
+
/* @__PURE__ */ jsxs11(Text12, { bold: true, children: [
|
|
1428
1647
|
"v",
|
|
1429
1648
|
upgradeCheck.current
|
|
1430
1649
|
] }),
|
|
1431
1650
|
"). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
|
|
1432
1651
|
] }),
|
|
1433
|
-
/* @__PURE__ */
|
|
1434
|
-
/* @__PURE__ */
|
|
1652
|
+
/* @__PURE__ */ jsx12(Text12, { children: " " }),
|
|
1653
|
+
/* @__PURE__ */ jsx12(Box11, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx12(Text12, { bold: true, children: cmd }, cmd)) })
|
|
1435
1654
|
] });
|
|
1436
1655
|
}
|
|
1437
1656
|
|
|
1438
1657
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
1439
|
-
import { useEffect as useEffect8, useState as
|
|
1440
|
-
import { Box as
|
|
1441
|
-
import { jsx as
|
|
1658
|
+
import { useEffect as useEffect8, useState as useState12 } from "react";
|
|
1659
|
+
import { Box as Box12, Text as Text13, useInput as useInput12 } from "ink";
|
|
1660
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1442
1661
|
function DebugModeScreen({ onDone }) {
|
|
1443
|
-
const [loading, setLoading] =
|
|
1444
|
-
const [enabled, setEnabled] =
|
|
1662
|
+
const [loading, setLoading] = useState12(true);
|
|
1663
|
+
const [enabled, setEnabled] = useState12(true);
|
|
1445
1664
|
useEffect8(() => {
|
|
1446
1665
|
readDebugModeSetting().then((setting) => {
|
|
1447
1666
|
setEnabled(setting.enabled);
|
|
@@ -1454,7 +1673,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
1454
1673
|
});
|
|
1455
1674
|
});
|
|
1456
1675
|
}, []);
|
|
1457
|
-
|
|
1676
|
+
useInput12((input, key) => {
|
|
1458
1677
|
if (loading) return;
|
|
1459
1678
|
if (key.return || input === " ") {
|
|
1460
1679
|
setEnabled((current) => {
|
|
@@ -1469,16 +1688,16 @@ function DebugModeScreen({ onDone }) {
|
|
|
1469
1688
|
onDone();
|
|
1470
1689
|
}
|
|
1471
1690
|
});
|
|
1472
|
-
return /* @__PURE__ */
|
|
1473
|
-
/* @__PURE__ */
|
|
1474
|
-
/* @__PURE__ */
|
|
1475
|
-
loading ? /* @__PURE__ */
|
|
1691
|
+
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1692
|
+
/* @__PURE__ */ jsx13(Text13, { bold: true, children: "Settings \u203A Debug Mode" }),
|
|
1693
|
+
/* @__PURE__ */ jsx13(Text13, { children: " " }),
|
|
1694
|
+
loading ? /* @__PURE__ */ jsx13(Text13, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs12(Text13, { children: [
|
|
1476
1695
|
"Debug logging:",
|
|
1477
1696
|
" ",
|
|
1478
|
-
/* @__PURE__ */
|
|
1697
|
+
/* @__PURE__ */ jsx13(Text13, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
1479
1698
|
] }),
|
|
1480
|
-
/* @__PURE__ */
|
|
1481
|
-
/* @__PURE__ */
|
|
1699
|
+
/* @__PURE__ */ jsx13(Text13, { children: " " }),
|
|
1700
|
+
/* @__PURE__ */ jsx13(
|
|
1482
1701
|
ControlHints,
|
|
1483
1702
|
{
|
|
1484
1703
|
hints: [
|
|
@@ -1491,28 +1710,38 @@ function DebugModeScreen({ onDone }) {
|
|
|
1491
1710
|
}
|
|
1492
1711
|
|
|
1493
1712
|
// packages/experience-design-system-cli/app.tsx
|
|
1494
|
-
import { Fragment as
|
|
1713
|
+
import { Fragment as Fragment5, jsx as jsx14 } from "react/jsx-runtime";
|
|
1495
1714
|
function App({ onLaunchImport, importExitCode }) {
|
|
1496
1715
|
const returnedFromImport = importExitCode !== void 0;
|
|
1497
|
-
const [screen, setScreen] =
|
|
1498
|
-
const [showImportResult, setShowImportResult] =
|
|
1499
|
-
const [projectPath, setProjectPath] =
|
|
1500
|
-
const [tokensPath, setTokensPath] =
|
|
1501
|
-
const [
|
|
1716
|
+
const [screen, setScreen] = useState13(returnedFromImport ? "import" : "start");
|
|
1717
|
+
const [showImportResult, setShowImportResult] = useState13(returnedFromImport);
|
|
1718
|
+
const [projectPath, setProjectPath] = useState13();
|
|
1719
|
+
const [tokensPath, setTokensPath] = useState13();
|
|
1720
|
+
const [pathConfirmed, setPathConfirmed] = useState13(false);
|
|
1721
|
+
const [importDefaults, setImportDefaults] = useState13();
|
|
1502
1722
|
useEffect9(() => {
|
|
1503
1723
|
if (screen !== "import") {
|
|
1504
1724
|
setImportDefaults(void 0);
|
|
1505
1725
|
return;
|
|
1506
1726
|
}
|
|
1507
1727
|
void readCredentials().then(
|
|
1508
|
-
(saved) => setImportDefaults({
|
|
1728
|
+
(saved) => setImportDefaults({
|
|
1729
|
+
componentDir: saved.defaultComponentDir ?? "",
|
|
1730
|
+
tokenFile: saved.defaultTokenFile ?? "",
|
|
1731
|
+
credentials: saved
|
|
1732
|
+
})
|
|
1509
1733
|
);
|
|
1510
1734
|
}, [screen]);
|
|
1735
|
+
const finishCredentials = async (result, project, tokens) => {
|
|
1736
|
+
if (!result.skipped) await writeCredentials({ ...result.credentials });
|
|
1737
|
+
onLaunchImport?.({ project, tokens, skipCredentials: result.skipped });
|
|
1738
|
+
};
|
|
1511
1739
|
const goToStart = () => setScreen("start");
|
|
1512
1740
|
const goToSettings = () => setScreen("settings");
|
|
1513
1741
|
const resetImport = () => {
|
|
1514
1742
|
setProjectPath(void 0);
|
|
1515
1743
|
setTokensPath(void 0);
|
|
1744
|
+
setPathConfirmed(false);
|
|
1516
1745
|
};
|
|
1517
1746
|
const finishImportResult = () => {
|
|
1518
1747
|
setShowImportResult(false);
|
|
@@ -1525,13 +1754,13 @@ function App({ onLaunchImport, importExitCode }) {
|
|
|
1525
1754
|
};
|
|
1526
1755
|
switch (screen) {
|
|
1527
1756
|
case "import":
|
|
1528
|
-
if (showImportResult) return /* @__PURE__ */
|
|
1529
|
-
if (importDefaults === void 0) return /* @__PURE__ */
|
|
1757
|
+
if (showImportResult) return /* @__PURE__ */ jsx14(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
|
|
1758
|
+
if (importDefaults === void 0) return /* @__PURE__ */ jsx14(Fragment5, {});
|
|
1530
1759
|
if (projectPath === void 0) {
|
|
1531
|
-
return /* @__PURE__ */
|
|
1760
|
+
return /* @__PURE__ */ jsx14(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
|
|
1532
1761
|
}
|
|
1533
1762
|
if (tokensPath === void 0) {
|
|
1534
|
-
return /* @__PURE__ */
|
|
1763
|
+
return /* @__PURE__ */ jsx14(
|
|
1535
1764
|
TokenInputScreen,
|
|
1536
1765
|
{
|
|
1537
1766
|
initialPath: importDefaults.tokenFile,
|
|
@@ -1540,36 +1769,46 @@ function App({ onLaunchImport, importExitCode }) {
|
|
|
1540
1769
|
}
|
|
1541
1770
|
);
|
|
1542
1771
|
}
|
|
1543
|
-
|
|
1544
|
-
|
|
1772
|
+
if (!pathConfirmed) {
|
|
1773
|
+
return /* @__PURE__ */ jsx14(
|
|
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,
|
|
1545
1785
|
{
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
onBack: () => setTokensPath(void 0)
|
|
1786
|
+
initial: importDefaults.credentials,
|
|
1787
|
+
onBack: () => setPathConfirmed(false),
|
|
1788
|
+
onDone: (result) => void finishCredentials(result, projectPath, tokensPath)
|
|
1550
1789
|
}
|
|
1551
1790
|
);
|
|
1552
1791
|
case "help":
|
|
1553
|
-
return /* @__PURE__ */
|
|
1792
|
+
return /* @__PURE__ */ jsx14(HelpScreen, { onDone: goToStart });
|
|
1554
1793
|
case "upgrade":
|
|
1555
|
-
return /* @__PURE__ */
|
|
1794
|
+
return /* @__PURE__ */ jsx14(UpgradeScreen, { onDone: goToStart });
|
|
1556
1795
|
case "settings":
|
|
1557
|
-
return /* @__PURE__ */
|
|
1796
|
+
return /* @__PURE__ */ jsx14(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
1558
1797
|
case "settings-configuration":
|
|
1559
|
-
return /* @__PURE__ */
|
|
1798
|
+
return /* @__PURE__ */ jsx14(ConfigurationScreen, { onDone: goToSettings });
|
|
1560
1799
|
case "settings-opt-in-analytics":
|
|
1561
|
-
return /* @__PURE__ */
|
|
1800
|
+
return /* @__PURE__ */ jsx14(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
1562
1801
|
case "settings-debug-mode":
|
|
1563
|
-
return /* @__PURE__ */
|
|
1802
|
+
return /* @__PURE__ */ jsx14(DebugModeScreen, { onDone: goToSettings });
|
|
1564
1803
|
case "start":
|
|
1565
|
-
return /* @__PURE__ */
|
|
1804
|
+
return /* @__PURE__ */ jsx14(HomeScreen, { onNavigate: setScreen });
|
|
1566
1805
|
}
|
|
1567
1806
|
}
|
|
1568
1807
|
var CLEAR_SCREEN = "\x1B[2J\x1B[H";
|
|
1569
1808
|
async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
|
|
1570
1809
|
let requestedImport;
|
|
1571
1810
|
const instance = renderApp(
|
|
1572
|
-
/* @__PURE__ */
|
|
1811
|
+
/* @__PURE__ */ jsx14(
|
|
1573
1812
|
App,
|
|
1574
1813
|
{
|
|
1575
1814
|
importExitCode,
|