@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/index.js
CHANGED
|
@@ -77,14 +77,11 @@ var init_home_theme = __esm({
|
|
|
77
77
|
orange: "#E44F20",
|
|
78
78
|
yellow: "#FFDA00",
|
|
79
79
|
white: "#FFFFFF",
|
|
80
|
-
slate: "#
|
|
81
|
-
steel: "#C4D1DE"
|
|
82
|
-
mist: "#DDE5EC",
|
|
83
|
-
fog: "#EFF2F6"
|
|
80
|
+
slate: "#8B8D91",
|
|
81
|
+
steel: "#C4D1DE"
|
|
84
82
|
};
|
|
85
83
|
PALETTE = {
|
|
86
84
|
accent: BRAND.blue,
|
|
87
|
-
heading: BRAND.white,
|
|
88
85
|
success: BRAND.green,
|
|
89
86
|
error: BRAND.orange,
|
|
90
87
|
warning: BRAND.yellow,
|
|
@@ -171,12 +168,11 @@ var init_use_terminal_width = __esm({
|
|
|
171
168
|
import { Text } from "ink";
|
|
172
169
|
import { jsx } from "react/jsx-runtime";
|
|
173
170
|
function ControlHints({ hints }) {
|
|
174
|
-
return /* @__PURE__ */ jsx(Text, {
|
|
171
|
+
return /* @__PURE__ */ jsx(Text, { children: hints.map((hint) => `[${hint.keys}] ${hint.label}`).join(" \xB7 ") });
|
|
175
172
|
}
|
|
176
173
|
var init_control_hints = __esm({
|
|
177
174
|
"packages/experience-design-system-cli/src/tui/control-hints.tsx"() {
|
|
178
175
|
"use strict";
|
|
179
|
-
init_home_theme();
|
|
180
176
|
}
|
|
181
177
|
});
|
|
182
178
|
|
|
@@ -232,7 +228,7 @@ function HomeScreen({ onNavigate }) {
|
|
|
232
228
|
}
|
|
233
229
|
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
234
230
|
/* @__PURE__ */ jsxs(Box, { flexDirection: "column", alignItems: "center", children: [
|
|
235
|
-
/* @__PURE__ */ jsx2(Text2, { bold: true,
|
|
231
|
+
/* @__PURE__ */ jsx2(Text2, { bold: true, children: HEADING }),
|
|
236
232
|
/* @__PURE__ */ jsx2(Text2, { children: brandBar(HEADING.length).map((segment, i) => /* @__PURE__ */ jsx2(Text2, { color: segment.color, children: segment.text }, i)) }),
|
|
237
233
|
/* @__PURE__ */ jsx2(Text2, { color: PALETTE.muted, children: SUBTITLE }),
|
|
238
234
|
/* @__PURE__ */ jsxs(Text2, { color: PALETTE.muted, children: [
|
|
@@ -249,8 +245,7 @@ function HomeScreen({ onNavigate }) {
|
|
|
249
245
|
Text2,
|
|
250
246
|
{
|
|
251
247
|
bold: focused && !dimmed,
|
|
252
|
-
|
|
253
|
-
color: focused && !dimmed ? PALETTE.accent : display.color,
|
|
248
|
+
color: dimmed ? PALETTE.muted : focused ? PALETTE.accent : display.color,
|
|
254
249
|
children: [
|
|
255
250
|
focused ? `${FOCUS_MARKER} ` : " ",
|
|
256
251
|
display.label
|
|
@@ -303,14 +298,13 @@ function ImportScreen({ exitCode, onDone }) {
|
|
|
303
298
|
});
|
|
304
299
|
const isSuccess = exitCode === 0;
|
|
305
300
|
return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
306
|
-
/* @__PURE__ */ jsx3(Text3, { bold: true, children: "Import" }),
|
|
307
301
|
/* @__PURE__ */ jsx3(Text3, { children: " " }),
|
|
308
302
|
isSuccess ? /* @__PURE__ */ jsx3(Text3, { color: PALETTE.success, children: "\u2713 Import complete" }) : /* @__PURE__ */ jsxs2(Text3, { color: PALETTE.error, children: [
|
|
309
303
|
"\u2717 Import failed: process exited with code ",
|
|
310
304
|
exitCode ?? "unknown"
|
|
311
305
|
] }),
|
|
312
306
|
/* @__PURE__ */ jsx3(Text3, { children: " " }),
|
|
313
|
-
/* @__PURE__ */ jsx3(Text3, {
|
|
307
|
+
/* @__PURE__ */ jsx3(Text3, { children: "[Enter] Back to Start" })
|
|
314
308
|
] });
|
|
315
309
|
}
|
|
316
310
|
var init_PageContainer = __esm({
|
|
@@ -367,16 +361,16 @@ function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
|
|
|
367
361
|
};
|
|
368
362
|
return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
369
363
|
/* @__PURE__ */ jsx4(Text4, { bold: true, color: PALETTE.success, children: "\u{1F44B} Hey! Let's import your design system into Contentful." }),
|
|
370
|
-
/* @__PURE__ */ jsx4(Text4, {
|
|
371
|
-
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column",
|
|
364
|
+
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: "I'll walk you through 5 steps to get your components into Contentful ExO." }),
|
|
365
|
+
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
|
|
372
366
|
/* @__PURE__ */ jsx4(Text4, { dimColor: true, children: RULE }),
|
|
373
367
|
OVERVIEW.map((item) => /* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
|
|
374
368
|
/* @__PURE__ */ jsx4(Text4, { bold: true, children: item.label }),
|
|
375
|
-
/* @__PURE__ */ jsx4(Text4, {
|
|
369
|
+
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: item.description })
|
|
376
370
|
] }, item.label)),
|
|
377
371
|
/* @__PURE__ */ jsx4(Text4, { dimColor: true, children: RULE })
|
|
378
372
|
] }),
|
|
379
|
-
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column",
|
|
373
|
+
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", gap: 1, children: [
|
|
380
374
|
/* @__PURE__ */ jsx4(Text4, { children: "Where is your component library?" }),
|
|
381
375
|
/* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
|
|
382
376
|
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.accent, children: "?" }),
|
|
@@ -384,7 +378,7 @@ function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
|
|
|
384
378
|
/* @__PURE__ */ jsx4(TextInput, { value: projectPath, onChange: setProjectPath, onSubmit: submit })
|
|
385
379
|
] })
|
|
386
380
|
] }),
|
|
387
|
-
/* @__PURE__ */ jsx4(Box3, {
|
|
381
|
+
/* @__PURE__ */ jsx4(Box3, { gap: 3, children: WELCOME_CONTROLS.map((control) => /* @__PURE__ */ jsxs3(Text4, { children: [
|
|
388
382
|
"[",
|
|
389
383
|
control.keys,
|
|
390
384
|
"] ",
|
|
@@ -516,7 +510,7 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
|
|
|
516
510
|
};
|
|
517
511
|
return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
518
512
|
/* @__PURE__ */ jsx5(Text5, { bold: true, children: "Design tokens" }),
|
|
519
|
-
/* @__PURE__ */ jsx5(Text5, {
|
|
513
|
+
/* @__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)." }),
|
|
520
514
|
/* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
|
|
521
515
|
/* @__PURE__ */ jsxs4(Box4, { gap: 1, children: [
|
|
522
516
|
/* @__PURE__ */ jsx5(Text5, { color: PALETTE.accent, children: "?" }),
|
|
@@ -528,13 +522,13 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
|
|
|
528
522
|
"\u2717 ",
|
|
529
523
|
failure.error
|
|
530
524
|
] }),
|
|
531
|
-
failure.resolvedPath && /* @__PURE__ */ jsxs4(Text5, {
|
|
525
|
+
failure.resolvedPath && /* @__PURE__ */ jsxs4(Text5, { color: PALETTE.muted, children: [
|
|
532
526
|
" Resolved to: ",
|
|
533
527
|
failure.resolvedPath
|
|
534
528
|
] })
|
|
535
529
|
] })
|
|
536
530
|
] }),
|
|
537
|
-
/* @__PURE__ */ jsx5(Box4, { marginTop: 1, gap: 3, children: TOKEN_INPUT_CONTROLS.map((control) => /* @__PURE__ */ jsxs4(Text5, {
|
|
531
|
+
/* @__PURE__ */ jsx5(Box4, { marginTop: 1, gap: 3, children: TOKEN_INPUT_CONTROLS.map((control) => /* @__PURE__ */ jsxs4(Text5, { children: [
|
|
538
532
|
"[",
|
|
539
533
|
control.keys,
|
|
540
534
|
"] ",
|
|
@@ -847,245 +841,6 @@ var init_screen3 = __esm({
|
|
|
847
841
|
}
|
|
848
842
|
});
|
|
849
843
|
|
|
850
|
-
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts
|
|
851
|
-
function keyAction2(input, key) {
|
|
852
|
-
if (key.escape) return "back";
|
|
853
|
-
if (key.tab) return "next-field";
|
|
854
|
-
if (key.ctrl && input === "s") return "skip";
|
|
855
|
-
return null;
|
|
856
|
-
}
|
|
857
|
-
function nextField(field) {
|
|
858
|
-
return FIELDS[(FIELDS.indexOf(field) + 1) % FIELDS.length];
|
|
859
|
-
}
|
|
860
|
-
function toConfiguredHost(host) {
|
|
861
|
-
const value = (host ?? "").trim().replace(/\/+$/, "");
|
|
862
|
-
return value === "" ? DEFAULT_HOST : value.replace(/^https:\/\//i, "");
|
|
863
|
-
}
|
|
864
|
-
function toApiHost(host) {
|
|
865
|
-
const value = host.trim().replace(/\/+$/, "");
|
|
866
|
-
if (value === "") return `https://${DEFAULT_HOST}`;
|
|
867
|
-
return /^[a-z][a-z\d+\-.]*:\/\//i.test(value) ? value : `https://${value}`;
|
|
868
|
-
}
|
|
869
|
-
function normalize(values) {
|
|
870
|
-
return {
|
|
871
|
-
spaceId: values.spaceId.trim(),
|
|
872
|
-
environmentId: values.environmentId.trim(),
|
|
873
|
-
cmaToken: values.cmaToken.trim(),
|
|
874
|
-
host: toConfiguredHost(values.host)
|
|
875
|
-
};
|
|
876
|
-
}
|
|
877
|
-
function missingField(values) {
|
|
878
|
-
return values.spaceId === "" || values.environmentId === "" || values.cmaToken === "";
|
|
879
|
-
}
|
|
880
|
-
function isUnchanged(current, initial) {
|
|
881
|
-
return FIELDS.every((field) => current[field] === initial[field]);
|
|
882
|
-
}
|
|
883
|
-
var FIELDS, DEFAULT_HOST;
|
|
884
|
-
var init_logic4 = __esm({
|
|
885
|
-
"packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts"() {
|
|
886
|
-
"use strict";
|
|
887
|
-
FIELDS = ["spaceId", "environmentId", "cmaToken", "host"];
|
|
888
|
-
DEFAULT_HOST = "api.contentful.com";
|
|
889
|
-
}
|
|
890
|
-
});
|
|
891
|
-
|
|
892
|
-
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/controls.ts
|
|
893
|
-
import { useInput as useInput6 } from "ink";
|
|
894
|
-
function useCredentialsControls(handlers) {
|
|
895
|
-
useInput6((input, key) => {
|
|
896
|
-
if (handlers.disabled) return;
|
|
897
|
-
const action = keyAction2(input, key);
|
|
898
|
-
if (action === "back") handlers.onBack();
|
|
899
|
-
else if (action === "next-field") handlers.onNextField();
|
|
900
|
-
else if (action === "skip") handlers.onSkip();
|
|
901
|
-
});
|
|
902
|
-
}
|
|
903
|
-
var CREDENTIALS_CONTROLS;
|
|
904
|
-
var init_controls4 = __esm({
|
|
905
|
-
"packages/experience-design-system-cli/src/tui/import/steps/04-credentials/controls.ts"() {
|
|
906
|
-
"use strict";
|
|
907
|
-
init_logic4();
|
|
908
|
-
CREDENTIALS_CONTROLS = [
|
|
909
|
-
{ keys: "Enter", label: "Next field / Continue" },
|
|
910
|
-
{ keys: "Tab", label: "Switch field" },
|
|
911
|
-
{ keys: "Ctrl+S", label: "Skip (no push)" },
|
|
912
|
-
{ keys: "Esc", label: "Back" }
|
|
913
|
-
];
|
|
914
|
-
}
|
|
915
|
-
});
|
|
916
|
-
|
|
917
|
-
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/validate.ts
|
|
918
|
-
function headers(token) {
|
|
919
|
-
return { Authorization: `Bearer ${token}`, "X-Contentful-User-Agent": USER_AGENT };
|
|
920
|
-
}
|
|
921
|
-
function isApsDenial(body) {
|
|
922
|
-
try {
|
|
923
|
-
const id = JSON.parse(body).sys?.id;
|
|
924
|
-
return id === "NotFound" || id === "AccessDenied";
|
|
925
|
-
} catch {
|
|
926
|
-
return false;
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
function messageFrom(body) {
|
|
930
|
-
try {
|
|
931
|
-
const message = JSON.parse(body).message;
|
|
932
|
-
return typeof message === "string" && message !== "" ? message : void 0;
|
|
933
|
-
} catch {
|
|
934
|
-
return void 0;
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
async function validateCredentials(values) {
|
|
938
|
-
const base = toApiHost(values.host);
|
|
939
|
-
let me;
|
|
940
|
-
try {
|
|
941
|
-
me = await fetch(`${base}/users/me`, { headers: headers(values.cmaToken) });
|
|
942
|
-
} catch (error) {
|
|
943
|
-
return { ok: false, error: `Could not reach ${base}: ${error instanceof Error ? error.message : String(error)}` };
|
|
944
|
-
}
|
|
945
|
-
if (me.status === 401) return { ok: false, error: "CMA token is invalid or revoked." };
|
|
946
|
-
if (!me.ok) return { ok: false, error: `Unexpected error validating the token (${me.status}).` };
|
|
947
|
-
let preflight;
|
|
948
|
-
try {
|
|
949
|
-
preflight = await fetch(
|
|
950
|
-
`${base}/spaces/${values.spaceId}/environments/${values.environmentId}/design_systems/preflight`,
|
|
951
|
-
{ headers: headers(values.cmaToken) }
|
|
952
|
-
);
|
|
953
|
-
} catch {
|
|
954
|
-
return { ok: true };
|
|
955
|
-
}
|
|
956
|
-
if (preflight.ok || preflight.status >= 500) return { ok: true };
|
|
957
|
-
const body = await preflight.text();
|
|
958
|
-
if (preflight.status === 404 && !isApsDenial(body)) return { ok: true };
|
|
959
|
-
const detail = messageFrom(body);
|
|
960
|
-
if (preflight.status === 403) {
|
|
961
|
-
return { ok: false, error: `Access denied. ${detail ?? "Your token cannot write design system components here."}` };
|
|
962
|
-
}
|
|
963
|
-
if (preflight.status === 404) {
|
|
964
|
-
return {
|
|
965
|
-
ok: false,
|
|
966
|
-
error: `Not found. Check the space ID, environment and API host.${detail ? ` (${detail})` : ""}`
|
|
967
|
-
};
|
|
968
|
-
}
|
|
969
|
-
return { ok: false, error: `Credential check failed (${preflight.status}).${detail ? ` ${detail}` : ""}` };
|
|
970
|
-
}
|
|
971
|
-
var USER_AGENT;
|
|
972
|
-
var init_validate = __esm({
|
|
973
|
-
"packages/experience-design-system-cli/src/tui/import/steps/04-credentials/validate.ts"() {
|
|
974
|
-
"use strict";
|
|
975
|
-
init_logic4();
|
|
976
|
-
USER_AGENT = "app contentful.experience-design-system-cli";
|
|
977
|
-
}
|
|
978
|
-
});
|
|
979
|
-
|
|
980
|
-
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
|
|
981
|
-
import { useRef, useState as useState6 } from "react";
|
|
982
|
-
import { Box as Box6, Text as Text7 } from "ink";
|
|
983
|
-
import TextInput3 from "ink-text-input";
|
|
984
|
-
import { Fragment, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
985
|
-
function CredentialsScreen({
|
|
986
|
-
onDone,
|
|
987
|
-
onBack,
|
|
988
|
-
initial = {},
|
|
989
|
-
validate = validateCredentials
|
|
990
|
-
}) {
|
|
991
|
-
const initialValues = useRef(
|
|
992
|
-
normalize({
|
|
993
|
-
spaceId: initial.spaceId ?? "",
|
|
994
|
-
environmentId: initial.environmentId || "master",
|
|
995
|
-
cmaToken: initial.cmaToken ?? "",
|
|
996
|
-
host: initial.host ?? ""
|
|
997
|
-
})
|
|
998
|
-
).current;
|
|
999
|
-
const [values, setValues] = useState6(initialValues);
|
|
1000
|
-
const [active, setActive] = useState6("spaceId");
|
|
1001
|
-
const [error, setError] = useState6(null);
|
|
1002
|
-
const [validating, setValidating] = useState6(false);
|
|
1003
|
-
const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
|
|
1004
|
-
useCredentialsControls({
|
|
1005
|
-
disabled: validating,
|
|
1006
|
-
onBack,
|
|
1007
|
-
onNextField: () => setActive(nextField),
|
|
1008
|
-
onSkip: () => onDone({ skipped: true })
|
|
1009
|
-
});
|
|
1010
|
-
const change = (field) => (value) => {
|
|
1011
|
-
setValues((current) => ({ ...current, [field]: value }));
|
|
1012
|
-
setError(null);
|
|
1013
|
-
};
|
|
1014
|
-
const submit = async (field) => {
|
|
1015
|
-
if (field !== "host") {
|
|
1016
|
-
setActive(nextField(field));
|
|
1017
|
-
return;
|
|
1018
|
-
}
|
|
1019
|
-
const credentials = normalize(values);
|
|
1020
|
-
if (missingField(credentials)) {
|
|
1021
|
-
setError("Space ID, environment and CMA token are all required.");
|
|
1022
|
-
return;
|
|
1023
|
-
}
|
|
1024
|
-
setValidating(true);
|
|
1025
|
-
const result = await validate(credentials);
|
|
1026
|
-
setValidating(false);
|
|
1027
|
-
if (result.ok) onDone({ skipped: false, credentials });
|
|
1028
|
-
else setError(result.error);
|
|
1029
|
-
};
|
|
1030
|
-
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
1031
|
-
/* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
|
|
1032
|
-
/* @__PURE__ */ jsx7(Text7, { bold: true, children: "Contentful credentials" }),
|
|
1033
|
-
/* @__PURE__ */ jsx7(Text7, { children: prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into." }),
|
|
1034
|
-
!prefilled && /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
1035
|
-
/* @__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." }),
|
|
1036
|
-
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Tip: save these under Settings \u2192 Configuration so they pre-fill here." })
|
|
1037
|
-
] })
|
|
1038
|
-
] }),
|
|
1039
|
-
/* @__PURE__ */ jsx7(Box6, { flexDirection: "column", children: FIELDS.map((field) => /* @__PURE__ */ jsxs6(Box6, { gap: 1, children: [
|
|
1040
|
-
/* @__PURE__ */ jsx7(Text7, { color: active === field ? PALETTE.accent : void 0, children: "?" }),
|
|
1041
|
-
/* @__PURE__ */ jsxs6(Text7, { bold: active === field, children: [
|
|
1042
|
-
LABELS[field],
|
|
1043
|
-
":"
|
|
1044
|
-
] }),
|
|
1045
|
-
/* @__PURE__ */ jsx7(
|
|
1046
|
-
TextInput3,
|
|
1047
|
-
{
|
|
1048
|
-
value: values[field],
|
|
1049
|
-
focus: active === field && !validating,
|
|
1050
|
-
mask: field === "cmaToken" ? "\u2022" : void 0,
|
|
1051
|
-
placeholder: field === "host" ? DEFAULT_HOST : void 0,
|
|
1052
|
-
onChange: change(field),
|
|
1053
|
-
onSubmit: () => void submit(field)
|
|
1054
|
-
}
|
|
1055
|
-
)
|
|
1056
|
-
] }, field)) }),
|
|
1057
|
-
active === "host" && /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Default: api.contentful.com \xB7 EU spaces: api.eu.contentful.com" }),
|
|
1058
|
-
error && /* @__PURE__ */ jsxs6(Text7, { color: PALETTE.error, children: [
|
|
1059
|
-
"\u2717 ",
|
|
1060
|
-
error
|
|
1061
|
-
] }),
|
|
1062
|
-
validating && /* @__PURE__ */ jsx7(Text7, { color: PALETTE.accent, children: "Validating credentials..." }),
|
|
1063
|
-
!validating && !error && !isUnchanged(normalize(values), initialValues) && /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Changed values are saved after they validate." }),
|
|
1064
|
-
/* @__PURE__ */ jsx7(Box6, { marginTop: 1, gap: 3, children: CREDENTIALS_CONTROLS.map((control) => /* @__PURE__ */ jsxs6(Text7, { dimColor: true, children: [
|
|
1065
|
-
"[",
|
|
1066
|
-
control.keys,
|
|
1067
|
-
"] ",
|
|
1068
|
-
control.label
|
|
1069
|
-
] }, control.keys)) })
|
|
1070
|
-
] });
|
|
1071
|
-
}
|
|
1072
|
-
var LABELS;
|
|
1073
|
-
var init_screen4 = __esm({
|
|
1074
|
-
"packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx"() {
|
|
1075
|
-
"use strict";
|
|
1076
|
-
init_home_theme();
|
|
1077
|
-
init_controls4();
|
|
1078
|
-
init_logic4();
|
|
1079
|
-
init_validate();
|
|
1080
|
-
LABELS = {
|
|
1081
|
-
spaceId: "Space ID",
|
|
1082
|
-
environmentId: "Environment",
|
|
1083
|
-
cmaToken: "CMA Token",
|
|
1084
|
-
host: "API Host"
|
|
1085
|
-
};
|
|
1086
|
-
}
|
|
1087
|
-
});
|
|
1088
|
-
|
|
1089
844
|
// packages/experience-design-system-cli/src/tui/import/steps/index.ts
|
|
1090
845
|
var init_steps = __esm({
|
|
1091
846
|
"packages/experience-design-system-cli/src/tui/import/steps/index.ts"() {
|
|
@@ -1093,7 +848,6 @@ var init_steps = __esm({
|
|
|
1093
848
|
init_screen();
|
|
1094
849
|
init_screen2();
|
|
1095
850
|
init_screen3();
|
|
1096
|
-
init_screen4();
|
|
1097
851
|
}
|
|
1098
852
|
});
|
|
1099
853
|
|
|
@@ -1114,8 +868,7 @@ async function spawnV1Import(options = {}) {
|
|
|
1114
868
|
const args = buildArgs(options);
|
|
1115
869
|
return new Promise((resolvePromise) => {
|
|
1116
870
|
const child = spawn3("node", [cliPath, ...args], {
|
|
1117
|
-
stdio: "inherit"
|
|
1118
|
-
env: options.skipCredentials ? { ...process.env, EDS_IMPORT_SKIP_CREDENTIALS: "1" } : process.env
|
|
871
|
+
stdio: "inherit"
|
|
1119
872
|
});
|
|
1120
873
|
child.on("close", (code) => {
|
|
1121
874
|
resolvePromise({ exitCode: code ?? 1, result: void 0, stdout: "", stderr: "" });
|
|
@@ -1393,20 +1146,20 @@ var init_help_info = __esm({
|
|
|
1393
1146
|
});
|
|
1394
1147
|
|
|
1395
1148
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
1396
|
-
import { useEffect as useEffect4, useState as
|
|
1397
|
-
import { Box as
|
|
1398
|
-
import { Fragment
|
|
1149
|
+
import { useEffect as useEffect4, useState as useState6 } from "react";
|
|
1150
|
+
import { Box as Box6, Text as Text7, useInput as useInput6 } from "ink";
|
|
1151
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1399
1152
|
function Section({ title, rows }) {
|
|
1400
|
-
return /* @__PURE__ */
|
|
1401
|
-
/* @__PURE__ */
|
|
1402
|
-
rows.map((row) => /* @__PURE__ */
|
|
1403
|
-
/* @__PURE__ */
|
|
1404
|
-
/* @__PURE__ */
|
|
1153
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
|
|
1154
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, color: PALETTE.accent, children: title }),
|
|
1155
|
+
rows.map((row) => /* @__PURE__ */ jsxs6(Box6, { gap: 1, children: [
|
|
1156
|
+
/* @__PURE__ */ jsx7(Box6, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx7(Text7, { color: PALETTE.muted, children: row.label }) }),
|
|
1157
|
+
/* @__PURE__ */ jsx7(Text7, { children: row.value })
|
|
1405
1158
|
] }, row.label))
|
|
1406
1159
|
] });
|
|
1407
1160
|
}
|
|
1408
1161
|
function HelpScreen({ onDone }) {
|
|
1409
|
-
const [info, setInfo] =
|
|
1162
|
+
const [info, setInfo] = useState6();
|
|
1410
1163
|
useEffect4(() => {
|
|
1411
1164
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
1412
1165
|
void readHelpInfo().then(setInfo);
|
|
@@ -1415,7 +1168,7 @@ function HelpScreen({ onDone }) {
|
|
|
1415
1168
|
void finishDebugRun({ outputs: {}, status: "success", exitMethod });
|
|
1416
1169
|
onDone();
|
|
1417
1170
|
};
|
|
1418
|
-
|
|
1171
|
+
useInput6((input, key) => {
|
|
1419
1172
|
if (key.return) {
|
|
1420
1173
|
leave("saved");
|
|
1421
1174
|
return;
|
|
@@ -1425,14 +1178,14 @@ function HelpScreen({ onDone }) {
|
|
|
1425
1178
|
return;
|
|
1426
1179
|
}
|
|
1427
1180
|
});
|
|
1428
|
-
return /* @__PURE__ */
|
|
1429
|
-
/* @__PURE__ */
|
|
1430
|
-
info ? /* @__PURE__ */
|
|
1431
|
-
/* @__PURE__ */
|
|
1432
|
-
/* @__PURE__ */
|
|
1433
|
-
/* @__PURE__ */
|
|
1434
|
-
] }) : /* @__PURE__ */
|
|
1435
|
-
/* @__PURE__ */
|
|
1181
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, gap: 1, children: [
|
|
1182
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, children: "Help" }),
|
|
1183
|
+
info ? /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
1184
|
+
/* @__PURE__ */ jsx7(Section, { title: "Where things are stored", rows: info.storage }),
|
|
1185
|
+
/* @__PURE__ */ jsx7(Section, { title: "Troubleshooting", rows: info.troubleshooting }),
|
|
1186
|
+
/* @__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." })
|
|
1187
|
+
] }) : /* @__PURE__ */ jsx7(Text7, { color: PALETTE.accent, children: "Loading..." }),
|
|
1188
|
+
/* @__PURE__ */ jsx7(
|
|
1436
1189
|
ControlHints,
|
|
1437
1190
|
{
|
|
1438
1191
|
hints: [
|
|
@@ -1454,20 +1207,20 @@ var init_PageContainer2 = __esm({
|
|
|
1454
1207
|
});
|
|
1455
1208
|
|
|
1456
1209
|
// packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
|
|
1457
|
-
import { useState as
|
|
1458
|
-
import { Box as
|
|
1459
|
-
import { jsx as
|
|
1210
|
+
import { useState as useState7 } from "react";
|
|
1211
|
+
import { Box as Box7, Text as Text8, useInput as useInput7 } from "ink";
|
|
1212
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1460
1213
|
function SettingsScreen({
|
|
1461
1214
|
onNavigate,
|
|
1462
1215
|
onBack
|
|
1463
1216
|
}) {
|
|
1464
|
-
const [focusIdx, setFocusIdx] =
|
|
1217
|
+
const [focusIdx, setFocusIdx] = useState7(0);
|
|
1465
1218
|
const items = [
|
|
1466
1219
|
{ label: "Configuration", screen: "settings-configuration" },
|
|
1467
1220
|
{ label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
|
|
1468
1221
|
{ label: "Debug Mode", screen: "settings-debug-mode" }
|
|
1469
1222
|
];
|
|
1470
|
-
|
|
1223
|
+
useInput7((input, key) => {
|
|
1471
1224
|
if (key.upArrow) {
|
|
1472
1225
|
setFocusIdx((i) => (i - 1 + items.length) % items.length);
|
|
1473
1226
|
return;
|
|
@@ -1487,15 +1240,15 @@ function SettingsScreen({
|
|
|
1487
1240
|
onBack();
|
|
1488
1241
|
}
|
|
1489
1242
|
});
|
|
1490
|
-
return /* @__PURE__ */
|
|
1491
|
-
/* @__PURE__ */
|
|
1492
|
-
/* @__PURE__ */
|
|
1493
|
-
items.map((item, i) => /* @__PURE__ */
|
|
1243
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1244
|
+
/* @__PURE__ */ jsx8(Text8, { bold: true, children: "Settings" }),
|
|
1245
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
1246
|
+
items.map((item, i) => /* @__PURE__ */ jsxs7(Text8, { color: i === focusIdx ? "cyan" : void 0, children: [
|
|
1494
1247
|
i === focusIdx ? "> " : " ",
|
|
1495
1248
|
item.label
|
|
1496
1249
|
] }, item.label)),
|
|
1497
|
-
/* @__PURE__ */
|
|
1498
|
-
/* @__PURE__ */
|
|
1250
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
1251
|
+
/* @__PURE__ */ jsx8(
|
|
1499
1252
|
ControlHints,
|
|
1500
1253
|
{
|
|
1501
1254
|
hints: [
|
|
@@ -1556,10 +1309,10 @@ var init_config_store = __esm({
|
|
|
1556
1309
|
});
|
|
1557
1310
|
|
|
1558
1311
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
1559
|
-
import { useEffect as useEffect5, useState as
|
|
1560
|
-
import { Box as
|
|
1561
|
-
import
|
|
1562
|
-
import { Fragment as
|
|
1312
|
+
import { useEffect as useEffect5, useState as useState8 } from "react";
|
|
1313
|
+
import { Box as Box8, Text as Text9, useInput as useInput8 } from "ink";
|
|
1314
|
+
import TextInput3 from "ink-text-input";
|
|
1315
|
+
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1563
1316
|
function debugFields(config) {
|
|
1564
1317
|
return {
|
|
1565
1318
|
space_id: config?.spaceId ?? "",
|
|
@@ -1571,13 +1324,13 @@ function debugFields(config) {
|
|
|
1571
1324
|
};
|
|
1572
1325
|
}
|
|
1573
1326
|
function ConfigurationScreen({ onDone }) {
|
|
1574
|
-
const [stage, setStage] =
|
|
1575
|
-
const [config, setConfig] =
|
|
1576
|
-
const [activeField, setActiveField] =
|
|
1577
|
-
const [notice, setNotice] =
|
|
1578
|
-
const [lastSaved, setLastSaved] =
|
|
1579
|
-
const [editing, setEditing] =
|
|
1580
|
-
const [valueBeforeEdit, setValueBeforeEdit] =
|
|
1327
|
+
const [stage, setStage] = useState8("loading");
|
|
1328
|
+
const [config, setConfig] = useState8(null);
|
|
1329
|
+
const [activeField, setActiveField] = useState8("spaceId");
|
|
1330
|
+
const [notice, setNotice] = useState8(null);
|
|
1331
|
+
const [lastSaved, setLastSaved] = useState8(null);
|
|
1332
|
+
const [editing, setEditing] = useState8(false);
|
|
1333
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState8("");
|
|
1581
1334
|
useEffect5(() => {
|
|
1582
1335
|
readCredentials().then((cfg) => {
|
|
1583
1336
|
setConfig(cfg);
|
|
@@ -1618,7 +1371,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1618
1371
|
);
|
|
1619
1372
|
onDone();
|
|
1620
1373
|
}
|
|
1621
|
-
|
|
1374
|
+
useInput8((input, key) => {
|
|
1622
1375
|
if (stage === "loading" || stage === "saving") return;
|
|
1623
1376
|
if (editing) {
|
|
1624
1377
|
if (key.escape) {
|
|
@@ -1655,46 +1408,46 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1655
1408
|
}
|
|
1656
1409
|
});
|
|
1657
1410
|
if (stage === "loading") {
|
|
1658
|
-
return /* @__PURE__ */
|
|
1659
|
-
/* @__PURE__ */
|
|
1660
|
-
/* @__PURE__ */
|
|
1661
|
-
/* @__PURE__ */
|
|
1411
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1412
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, children: "Configuration" }),
|
|
1413
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1414
|
+
/* @__PURE__ */ jsx9(Text9, { color: PALETTE.accent, children: "Loading..." })
|
|
1662
1415
|
] });
|
|
1663
1416
|
}
|
|
1664
|
-
return /* @__PURE__ */
|
|
1665
|
-
/* @__PURE__ */
|
|
1666
|
-
/* @__PURE__ */
|
|
1667
|
-
/* @__PURE__ */
|
|
1417
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1418
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, children: "Configuration" }),
|
|
1419
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1420
|
+
/* @__PURE__ */ jsx9(Box8, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
|
|
1668
1421
|
const isActive = activeField === field;
|
|
1669
1422
|
const value = fieldValue(field);
|
|
1670
1423
|
const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
|
|
1671
|
-
return /* @__PURE__ */
|
|
1672
|
-
/* @__PURE__ */
|
|
1673
|
-
/* @__PURE__ */
|
|
1424
|
+
return /* @__PURE__ */ jsxs8(Box8, { gap: 1, children: [
|
|
1425
|
+
/* @__PURE__ */ jsx9(Text9, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
1426
|
+
/* @__PURE__ */ jsxs8(Text9, { bold: isActive, children: [
|
|
1674
1427
|
FIELD_LABELS[field],
|
|
1675
1428
|
":"
|
|
1676
1429
|
] }),
|
|
1677
|
-
isActive && editing ? /* @__PURE__ */
|
|
1678
|
-
|
|
1430
|
+
isActive && editing ? /* @__PURE__ */ jsx9(
|
|
1431
|
+
TextInput3,
|
|
1679
1432
|
{
|
|
1680
1433
|
value,
|
|
1681
1434
|
onChange: (next) => setFieldValue(field, next),
|
|
1682
1435
|
onSubmit: () => setEditing(false),
|
|
1683
1436
|
mask: field === "cmaToken" ? "\u2022" : void 0
|
|
1684
1437
|
}
|
|
1685
|
-
) : /* @__PURE__ */
|
|
1438
|
+
) : /* @__PURE__ */ jsx9(Text9, { children: display || /* @__PURE__ */ jsx9(Text9, { color: PALETTE.muted, children: "(empty)" }) })
|
|
1686
1439
|
] }, field);
|
|
1687
1440
|
}) }),
|
|
1688
|
-
notice && /* @__PURE__ */
|
|
1689
|
-
/* @__PURE__ */
|
|
1690
|
-
/* @__PURE__ */
|
|
1441
|
+
notice && /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
1442
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1443
|
+
/* @__PURE__ */ jsxs8(Text9, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
1691
1444
|
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
1692
1445
|
" ",
|
|
1693
1446
|
notice.text
|
|
1694
1447
|
] })
|
|
1695
1448
|
] }),
|
|
1696
|
-
/* @__PURE__ */
|
|
1697
|
-
/* @__PURE__ */
|
|
1449
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1450
|
+
/* @__PURE__ */ jsx9(
|
|
1698
1451
|
ControlHints,
|
|
1699
1452
|
{
|
|
1700
1453
|
hints: editing ? [
|
|
@@ -1762,12 +1515,12 @@ var init_analytics_store = __esm({
|
|
|
1762
1515
|
});
|
|
1763
1516
|
|
|
1764
1517
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
1765
|
-
import { useEffect as useEffect6, useState as
|
|
1766
|
-
import { Box as
|
|
1767
|
-
import { Fragment as
|
|
1518
|
+
import { useEffect as useEffect6, useState as useState9 } from "react";
|
|
1519
|
+
import { Box as Box9, Text as Text10, useInput as useInput9 } from "ink";
|
|
1520
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1768
1521
|
function OptInAnalyticsScreen({ onDone }) {
|
|
1769
|
-
const [loading, setLoading] =
|
|
1770
|
-
const [enabled, setEnabled] =
|
|
1522
|
+
const [loading, setLoading] = useState9(true);
|
|
1523
|
+
const [enabled, setEnabled] = useState9(true);
|
|
1771
1524
|
useEffect6(() => {
|
|
1772
1525
|
readAnalyticsSetting().then((setting) => {
|
|
1773
1526
|
setEnabled(setting.enabled);
|
|
@@ -1780,7 +1533,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1780
1533
|
});
|
|
1781
1534
|
});
|
|
1782
1535
|
}, []);
|
|
1783
|
-
|
|
1536
|
+
useInput9((input, key) => {
|
|
1784
1537
|
if (loading) return;
|
|
1785
1538
|
if (key.return || input === " ") {
|
|
1786
1539
|
setEnabled((current) => {
|
|
@@ -1795,21 +1548,21 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1795
1548
|
onDone();
|
|
1796
1549
|
}
|
|
1797
1550
|
});
|
|
1798
|
-
return /* @__PURE__ */
|
|
1799
|
-
/* @__PURE__ */
|
|
1800
|
-
/* @__PURE__ */
|
|
1801
|
-
loading ? /* @__PURE__ */
|
|
1802
|
-
/* @__PURE__ */
|
|
1551
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1552
|
+
/* @__PURE__ */ jsx10(Text10, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
|
|
1553
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1554
|
+
loading ? /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
1555
|
+
/* @__PURE__ */ jsxs9(Text10, { children: [
|
|
1803
1556
|
"Share anonymous usage data:",
|
|
1804
1557
|
" ",
|
|
1805
|
-
/* @__PURE__ */
|
|
1558
|
+
/* @__PURE__ */ jsx10(Text10, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
1806
1559
|
] }),
|
|
1807
|
-
/* @__PURE__ */
|
|
1808
|
-
/* @__PURE__ */
|
|
1809
|
-
/* @__PURE__ */
|
|
1560
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1561
|
+
/* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "Shares which CLI commands are used and where imports succeed or fail." }),
|
|
1562
|
+
/* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "Never includes source code, file paths, credentials, or authored content." })
|
|
1810
1563
|
] }),
|
|
1811
|
-
/* @__PURE__ */
|
|
1812
|
-
/* @__PURE__ */
|
|
1564
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1565
|
+
/* @__PURE__ */ jsx10(
|
|
1813
1566
|
ControlHints,
|
|
1814
1567
|
{
|
|
1815
1568
|
hints: [
|
|
@@ -1820,7 +1573,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1820
1573
|
)
|
|
1821
1574
|
] });
|
|
1822
1575
|
}
|
|
1823
|
-
var
|
|
1576
|
+
var init_screen4 = __esm({
|
|
1824
1577
|
"packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx"() {
|
|
1825
1578
|
"use strict";
|
|
1826
1579
|
init_home_theme();
|
|
@@ -1831,11 +1584,11 @@ var init_screen5 = __esm({
|
|
|
1831
1584
|
});
|
|
1832
1585
|
|
|
1833
1586
|
// packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
|
|
1834
|
-
import { useEffect as useEffect7, useState as
|
|
1835
|
-
import { Box as
|
|
1836
|
-
import { jsx as
|
|
1587
|
+
import { useEffect as useEffect7, useState as useState10 } from "react";
|
|
1588
|
+
import { Box as Box10, Text as Text11, useInput as useInput10 } from "ink";
|
|
1589
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1837
1590
|
function UpgradeScreen({ onDone }) {
|
|
1838
|
-
const [upgradeCheck, setUpgradeCheck] =
|
|
1591
|
+
const [upgradeCheck, setUpgradeCheck] = useState10();
|
|
1839
1592
|
useEffect7(() => {
|
|
1840
1593
|
startDebugRun({
|
|
1841
1594
|
flow: "upgrade",
|
|
@@ -1845,7 +1598,7 @@ function UpgradeScreen({ onDone }) {
|
|
|
1845
1598
|
});
|
|
1846
1599
|
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
1847
1600
|
}, []);
|
|
1848
|
-
|
|
1601
|
+
useInput10((_input, key) => {
|
|
1849
1602
|
if (key.return) {
|
|
1850
1603
|
void finishDebugRun({
|
|
1851
1604
|
outputs: upgradeCheck ?? {},
|
|
@@ -1856,12 +1609,12 @@ function UpgradeScreen({ onDone }) {
|
|
|
1856
1609
|
return;
|
|
1857
1610
|
}
|
|
1858
1611
|
});
|
|
1859
|
-
return /* @__PURE__ */
|
|
1860
|
-
/* @__PURE__ */
|
|
1861
|
-
/* @__PURE__ */
|
|
1612
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1613
|
+
/* @__PURE__ */ jsx11(Text11, { bold: true, children: "Upgrade" }),
|
|
1614
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1862
1615
|
renderBody(upgradeCheck),
|
|
1863
|
-
/* @__PURE__ */
|
|
1864
|
-
/* @__PURE__ */
|
|
1616
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1617
|
+
/* @__PURE__ */ jsxs10(Text11, { bold: true, color: PALETTE.accent, children: [
|
|
1865
1618
|
FOCUS_MARKER,
|
|
1866
1619
|
" Go Back"
|
|
1867
1620
|
] })
|
|
@@ -1869,34 +1622,34 @@ function UpgradeScreen({ onDone }) {
|
|
|
1869
1622
|
}
|
|
1870
1623
|
function renderBody(upgradeCheck) {
|
|
1871
1624
|
if (!upgradeCheck) {
|
|
1872
|
-
return /* @__PURE__ */
|
|
1625
|
+
return /* @__PURE__ */ jsx11(Text11, { color: PALETTE.muted, children: "Checking for updates\u2026" });
|
|
1873
1626
|
}
|
|
1874
1627
|
if (upgradeCheck.status === "error") {
|
|
1875
|
-
return /* @__PURE__ */
|
|
1628
|
+
return /* @__PURE__ */ jsx11(Text11, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
|
|
1876
1629
|
}
|
|
1877
1630
|
if (upgradeCheck.status === "up-to-date") {
|
|
1878
|
-
return /* @__PURE__ */
|
|
1631
|
+
return /* @__PURE__ */ jsxs10(Text11, { color: PALETTE.success, children: [
|
|
1879
1632
|
"You're already on the latest version (v",
|
|
1880
1633
|
upgradeCheck.current,
|
|
1881
1634
|
")."
|
|
1882
1635
|
] });
|
|
1883
1636
|
}
|
|
1884
|
-
return /* @__PURE__ */
|
|
1885
|
-
/* @__PURE__ */
|
|
1886
|
-
/* @__PURE__ */
|
|
1637
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", children: [
|
|
1638
|
+
/* @__PURE__ */ jsxs10(Text11, { color: PALETTE.muted, children: [
|
|
1639
|
+
/* @__PURE__ */ jsxs10(Text11, { bold: true, color: PALETTE.success, children: [
|
|
1887
1640
|
"v",
|
|
1888
1641
|
upgradeCheck.latest
|
|
1889
1642
|
] }),
|
|
1890
1643
|
" ",
|
|
1891
1644
|
"is available (you're on ",
|
|
1892
|
-
/* @__PURE__ */
|
|
1645
|
+
/* @__PURE__ */ jsxs10(Text11, { bold: true, children: [
|
|
1893
1646
|
"v",
|
|
1894
1647
|
upgradeCheck.current
|
|
1895
1648
|
] }),
|
|
1896
1649
|
"). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
|
|
1897
1650
|
] }),
|
|
1898
|
-
/* @__PURE__ */
|
|
1899
|
-
/* @__PURE__ */
|
|
1651
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1652
|
+
/* @__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)) })
|
|
1900
1653
|
] });
|
|
1901
1654
|
}
|
|
1902
1655
|
var UPGRADE_COMMANDS;
|
|
@@ -1911,12 +1664,12 @@ var init_PageContainer4 = __esm({
|
|
|
1911
1664
|
});
|
|
1912
1665
|
|
|
1913
1666
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
1914
|
-
import { useEffect as useEffect8, useState as
|
|
1915
|
-
import { Box as
|
|
1916
|
-
import { jsx as
|
|
1667
|
+
import { useEffect as useEffect8, useState as useState11 } from "react";
|
|
1668
|
+
import { Box as Box11, Text as Text12, useInput as useInput11 } from "ink";
|
|
1669
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1917
1670
|
function DebugModeScreen({ onDone }) {
|
|
1918
|
-
const [loading, setLoading] =
|
|
1919
|
-
const [enabled, setEnabled] =
|
|
1671
|
+
const [loading, setLoading] = useState11(true);
|
|
1672
|
+
const [enabled, setEnabled] = useState11(true);
|
|
1920
1673
|
useEffect8(() => {
|
|
1921
1674
|
readDebugModeSetting().then((setting) => {
|
|
1922
1675
|
setEnabled(setting.enabled);
|
|
@@ -1929,7 +1682,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
1929
1682
|
});
|
|
1930
1683
|
});
|
|
1931
1684
|
}, []);
|
|
1932
|
-
|
|
1685
|
+
useInput11((input, key) => {
|
|
1933
1686
|
if (loading) return;
|
|
1934
1687
|
if (key.return || input === " ") {
|
|
1935
1688
|
setEnabled((current) => {
|
|
@@ -1944,16 +1697,16 @@ function DebugModeScreen({ onDone }) {
|
|
|
1944
1697
|
onDone();
|
|
1945
1698
|
}
|
|
1946
1699
|
});
|
|
1947
|
-
return /* @__PURE__ */
|
|
1948
|
-
/* @__PURE__ */
|
|
1949
|
-
/* @__PURE__ */
|
|
1950
|
-
loading ? /* @__PURE__ */
|
|
1700
|
+
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1701
|
+
/* @__PURE__ */ jsx12(Text12, { bold: true, children: "Settings \u203A Debug Mode" }),
|
|
1702
|
+
/* @__PURE__ */ jsx12(Text12, { children: " " }),
|
|
1703
|
+
loading ? /* @__PURE__ */ jsx12(Text12, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs11(Text12, { children: [
|
|
1951
1704
|
"Debug logging:",
|
|
1952
1705
|
" ",
|
|
1953
|
-
/* @__PURE__ */
|
|
1706
|
+
/* @__PURE__ */ jsx12(Text12, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
1954
1707
|
] }),
|
|
1955
|
-
/* @__PURE__ */
|
|
1956
|
-
/* @__PURE__ */
|
|
1708
|
+
/* @__PURE__ */ jsx12(Text12, { children: " " }),
|
|
1709
|
+
/* @__PURE__ */ jsx12(
|
|
1957
1710
|
ControlHints,
|
|
1958
1711
|
{
|
|
1959
1712
|
hints: [
|
|
@@ -1964,7 +1717,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
1964
1717
|
)
|
|
1965
1718
|
] });
|
|
1966
1719
|
}
|
|
1967
|
-
var
|
|
1720
|
+
var init_screen5 = __esm({
|
|
1968
1721
|
"packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx"() {
|
|
1969
1722
|
"use strict";
|
|
1970
1723
|
init_home_theme();
|
|
@@ -1979,39 +1732,29 @@ var app_exports = {};
|
|
|
1979
1732
|
__export(app_exports, {
|
|
1980
1733
|
runApp: () => runApp
|
|
1981
1734
|
});
|
|
1982
|
-
import { useEffect as useEffect9, useState as
|
|
1983
|
-
import { Fragment as
|
|
1735
|
+
import { useEffect as useEffect9, useState as useState12 } from "react";
|
|
1736
|
+
import { Fragment as Fragment4, jsx as jsx13 } from "react/jsx-runtime";
|
|
1984
1737
|
function App({ onLaunchImport, importExitCode }) {
|
|
1985
1738
|
const returnedFromImport = importExitCode !== void 0;
|
|
1986
|
-
const [screen, setScreen] =
|
|
1987
|
-
const [showImportResult, setShowImportResult] =
|
|
1988
|
-
const [projectPath, setProjectPath] =
|
|
1989
|
-
const [tokensPath, setTokensPath] =
|
|
1990
|
-
const [
|
|
1991
|
-
const [importDefaults, setImportDefaults] = useState13();
|
|
1739
|
+
const [screen, setScreen] = useState12(returnedFromImport ? "import" : "start");
|
|
1740
|
+
const [showImportResult, setShowImportResult] = useState12(returnedFromImport);
|
|
1741
|
+
const [projectPath, setProjectPath] = useState12();
|
|
1742
|
+
const [tokensPath, setTokensPath] = useState12();
|
|
1743
|
+
const [importDefaults, setImportDefaults] = useState12();
|
|
1992
1744
|
useEffect9(() => {
|
|
1993
1745
|
if (screen !== "import") {
|
|
1994
1746
|
setImportDefaults(void 0);
|
|
1995
1747
|
return;
|
|
1996
1748
|
}
|
|
1997
1749
|
void readCredentials().then(
|
|
1998
|
-
(saved) => setImportDefaults({
|
|
1999
|
-
componentDir: saved.defaultComponentDir ?? "",
|
|
2000
|
-
tokenFile: saved.defaultTokenFile ?? "",
|
|
2001
|
-
credentials: saved
|
|
2002
|
-
})
|
|
1750
|
+
(saved) => setImportDefaults({ componentDir: saved.defaultComponentDir ?? "", tokenFile: saved.defaultTokenFile ?? "" })
|
|
2003
1751
|
);
|
|
2004
1752
|
}, [screen]);
|
|
2005
|
-
const finishCredentials = async (result, project, tokens) => {
|
|
2006
|
-
if (!result.skipped) await writeCredentials({ ...result.credentials });
|
|
2007
|
-
onLaunchImport?.({ project, tokens, skipCredentials: result.skipped });
|
|
2008
|
-
};
|
|
2009
1753
|
const goToStart = () => setScreen("start");
|
|
2010
1754
|
const goToSettings = () => setScreen("settings");
|
|
2011
1755
|
const resetImport = () => {
|
|
2012
1756
|
setProjectPath(void 0);
|
|
2013
1757
|
setTokensPath(void 0);
|
|
2014
|
-
setPathConfirmed(false);
|
|
2015
1758
|
};
|
|
2016
1759
|
const finishImportResult = () => {
|
|
2017
1760
|
setShowImportResult(false);
|
|
@@ -2024,13 +1767,13 @@ function App({ onLaunchImport, importExitCode }) {
|
|
|
2024
1767
|
};
|
|
2025
1768
|
switch (screen) {
|
|
2026
1769
|
case "import":
|
|
2027
|
-
if (showImportResult) return /* @__PURE__ */
|
|
2028
|
-
if (importDefaults === void 0) return /* @__PURE__ */
|
|
1770
|
+
if (showImportResult) return /* @__PURE__ */ jsx13(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
|
|
1771
|
+
if (importDefaults === void 0) return /* @__PURE__ */ jsx13(Fragment4, {});
|
|
2029
1772
|
if (projectPath === void 0) {
|
|
2030
|
-
return /* @__PURE__ */
|
|
1773
|
+
return /* @__PURE__ */ jsx13(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
|
|
2031
1774
|
}
|
|
2032
1775
|
if (tokensPath === void 0) {
|
|
2033
|
-
return /* @__PURE__ */
|
|
1776
|
+
return /* @__PURE__ */ jsx13(
|
|
2034
1777
|
TokenInputScreen,
|
|
2035
1778
|
{
|
|
2036
1779
|
initialPath: importDefaults.tokenFile,
|
|
@@ -2039,45 +1782,35 @@ function App({ onLaunchImport, importExitCode }) {
|
|
|
2039
1782
|
}
|
|
2040
1783
|
);
|
|
2041
1784
|
}
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
PathValidationScreen,
|
|
2045
|
-
{
|
|
2046
|
-
projectPath,
|
|
2047
|
-
onConfirm: () => setPathConfirmed(true),
|
|
2048
|
-
onChangePath: resetImport,
|
|
2049
|
-
onBack: () => setTokensPath(void 0)
|
|
2050
|
-
}
|
|
2051
|
-
);
|
|
2052
|
-
}
|
|
2053
|
-
return /* @__PURE__ */ jsx14(
|
|
2054
|
-
CredentialsScreen,
|
|
1785
|
+
return /* @__PURE__ */ jsx13(
|
|
1786
|
+
PathValidationScreen,
|
|
2055
1787
|
{
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
1788
|
+
projectPath,
|
|
1789
|
+
onConfirm: (project) => onLaunchImport?.({ project, tokens: tokensPath }),
|
|
1790
|
+
onChangePath: resetImport,
|
|
1791
|
+
onBack: () => setTokensPath(void 0)
|
|
2059
1792
|
}
|
|
2060
1793
|
);
|
|
2061
1794
|
case "help":
|
|
2062
|
-
return /* @__PURE__ */
|
|
1795
|
+
return /* @__PURE__ */ jsx13(HelpScreen, { onDone: goToStart });
|
|
2063
1796
|
case "upgrade":
|
|
2064
|
-
return /* @__PURE__ */
|
|
1797
|
+
return /* @__PURE__ */ jsx13(UpgradeScreen, { onDone: goToStart });
|
|
2065
1798
|
case "settings":
|
|
2066
|
-
return /* @__PURE__ */
|
|
1799
|
+
return /* @__PURE__ */ jsx13(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
2067
1800
|
case "settings-configuration":
|
|
2068
|
-
return /* @__PURE__ */
|
|
1801
|
+
return /* @__PURE__ */ jsx13(ConfigurationScreen, { onDone: goToSettings });
|
|
2069
1802
|
case "settings-opt-in-analytics":
|
|
2070
|
-
return /* @__PURE__ */
|
|
1803
|
+
return /* @__PURE__ */ jsx13(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
2071
1804
|
case "settings-debug-mode":
|
|
2072
|
-
return /* @__PURE__ */
|
|
1805
|
+
return /* @__PURE__ */ jsx13(DebugModeScreen, { onDone: goToSettings });
|
|
2073
1806
|
case "start":
|
|
2074
|
-
return /* @__PURE__ */
|
|
1807
|
+
return /* @__PURE__ */ jsx13(HomeScreen, { onNavigate: setScreen });
|
|
2075
1808
|
}
|
|
2076
1809
|
}
|
|
2077
1810
|
async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
|
|
2078
1811
|
let requestedImport;
|
|
2079
1812
|
const instance = renderApp(
|
|
2080
|
-
/* @__PURE__ */
|
|
1813
|
+
/* @__PURE__ */ jsx13(
|
|
2081
1814
|
App,
|
|
2082
1815
|
{
|
|
2083
1816
|
importExitCode,
|
|
@@ -2116,9 +1849,9 @@ var init_app = __esm({
|
|
|
2116
1849
|
init_PageContainer2();
|
|
2117
1850
|
init_PageContainer3();
|
|
2118
1851
|
init_ContentfulConfigScreen();
|
|
2119
|
-
|
|
1852
|
+
init_screen4();
|
|
2120
1853
|
init_PageContainer4();
|
|
2121
|
-
|
|
1854
|
+
init_screen5();
|
|
2122
1855
|
init_config_store();
|
|
2123
1856
|
CLEAR_SCREEN = "\x1B[2J\x1B[H";
|
|
2124
1857
|
}
|