@contentful/experience-design-system-cli 2.35.1-dev-build-3eb7b118.0 → 2.35.1-dev-build-525507db.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 +35 -45
- package/dist/index.js +35 -45
- package/dist/package.json +1 -1
- package/legacy/package.json +1 -1
- package/package.json +2 -2
package/dist/app.js
CHANGED
|
@@ -756,6 +756,7 @@ function SettingsScreen({
|
|
|
756
756
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
757
757
|
import { useEffect as useEffect4, useState as useState6 } from "react";
|
|
758
758
|
import { Box as Box7, Text as Text7, useInput as useInput7 } from "ink";
|
|
759
|
+
import TextInput3 from "ink-text-input";
|
|
759
760
|
|
|
760
761
|
// packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
|
|
761
762
|
var readV1Store = readSettings;
|
|
@@ -817,7 +818,8 @@ function ConfigurationScreen({ onDone }) {
|
|
|
817
818
|
const [stage, setStage] = useState6("loading");
|
|
818
819
|
const [config, setConfig] = useState6(null);
|
|
819
820
|
const [activeField, setActiveField] = useState6("spaceId");
|
|
820
|
-
const [
|
|
821
|
+
const [notice, setNotice] = useState6(null);
|
|
822
|
+
const [lastSaved, setLastSaved] = useState6(null);
|
|
821
823
|
const [editing, setEditing] = useState6(false);
|
|
822
824
|
const [valueBeforeEdit, setValueBeforeEdit] = useState6("");
|
|
823
825
|
useEffect4(() => {
|
|
@@ -839,56 +841,48 @@ function ConfigurationScreen({ onDone }) {
|
|
|
839
841
|
function setFieldValue(field, value) {
|
|
840
842
|
if (!config) return;
|
|
841
843
|
setConfig({ ...config, [field]: value });
|
|
844
|
+
setNotice(null);
|
|
842
845
|
}
|
|
843
846
|
function handleSave() {
|
|
844
847
|
if (!config) return;
|
|
845
848
|
setStage("saving");
|
|
846
|
-
|
|
849
|
+
setNotice(null);
|
|
847
850
|
writeCredentials(config).then(() => {
|
|
848
|
-
|
|
849
|
-
|
|
851
|
+
setLastSaved(config);
|
|
852
|
+
setNotice({ kind: "success", text: "Configuration saved" });
|
|
853
|
+
setStage("form");
|
|
850
854
|
}).catch((err) => {
|
|
851
|
-
|
|
855
|
+
setNotice({ kind: "error", text: err instanceof Error ? err.message : "Failed to save" });
|
|
852
856
|
setStage("form");
|
|
853
857
|
});
|
|
854
858
|
}
|
|
859
|
+
function quit() {
|
|
860
|
+
void finishDebugRun(
|
|
861
|
+
lastSaved ? { outputs: debugFields(lastSaved), status: "success", exitMethod: "saved" } : { outputs: {}, status: "success", exitMethod: "discarded" }
|
|
862
|
+
);
|
|
863
|
+
onDone();
|
|
864
|
+
}
|
|
855
865
|
useInput7((input, key) => {
|
|
856
866
|
if (stage === "loading" || stage === "saving") return;
|
|
857
|
-
if (stage === "saved") {
|
|
858
|
-
if (key.return || key.escape || input === "q") {
|
|
859
|
-
void finishDebugRun({ outputs: debugFields(config), status: "success", exitMethod: "saved" });
|
|
860
|
-
onDone();
|
|
861
|
-
}
|
|
862
|
-
return;
|
|
863
|
-
}
|
|
864
867
|
if (editing) {
|
|
865
|
-
if (key.return) {
|
|
866
|
-
setEditing(false);
|
|
867
|
-
return;
|
|
868
|
-
}
|
|
869
868
|
if (key.escape) {
|
|
870
869
|
setFieldValue(activeField, valueBeforeEdit);
|
|
871
870
|
setEditing(false);
|
|
872
|
-
return;
|
|
873
|
-
}
|
|
874
|
-
if (key.backspace || key.delete) {
|
|
875
|
-
setFieldValue(activeField, fieldValue(activeField).slice(0, -1));
|
|
876
|
-
return;
|
|
877
|
-
}
|
|
878
|
-
if (input && !key.ctrl && !key.meta && !key.tab && !key.upArrow && !key.downArrow) {
|
|
879
|
-
setFieldValue(activeField, fieldValue(activeField) + input);
|
|
880
871
|
}
|
|
881
872
|
return;
|
|
882
873
|
}
|
|
883
874
|
if (key.escape || input === "q") {
|
|
884
|
-
|
|
885
|
-
onDone();
|
|
875
|
+
quit();
|
|
886
876
|
return;
|
|
887
877
|
}
|
|
888
878
|
if (input === "s") {
|
|
889
879
|
handleSave();
|
|
890
880
|
return;
|
|
891
881
|
}
|
|
882
|
+
if (input === "c") {
|
|
883
|
+
setFieldValue(activeField, "");
|
|
884
|
+
return;
|
|
885
|
+
}
|
|
892
886
|
if (key.tab || key.downArrow) {
|
|
893
887
|
const idx = FIELD_ORDER.indexOf(activeField);
|
|
894
888
|
setActiveField(FIELD_ORDER[(idx + 1) % FIELD_ORDER.length]);
|
|
@@ -911,18 +905,6 @@ function ConfigurationScreen({ onDone }) {
|
|
|
911
905
|
/* @__PURE__ */ jsx7(Text7, { color: PALETTE.accent, children: "Loading..." })
|
|
912
906
|
] });
|
|
913
907
|
}
|
|
914
|
-
if (stage === "saved") {
|
|
915
|
-
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
916
|
-
/* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
|
|
917
|
-
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
918
|
-
/* @__PURE__ */ jsxs7(Text7, { color: PALETTE.success, children: [
|
|
919
|
-
"\u2713 ",
|
|
920
|
-
message
|
|
921
|
-
] }),
|
|
922
|
-
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
923
|
-
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "[Enter] Back to Settings" })
|
|
924
|
-
] });
|
|
925
|
-
}
|
|
926
908
|
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
927
909
|
/* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
|
|
928
910
|
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
@@ -938,19 +920,27 @@ function ConfigurationScreen({ onDone }) {
|
|
|
938
920
|
FIELD_LABELS[field],
|
|
939
921
|
":"
|
|
940
922
|
] }),
|
|
941
|
-
|
|
942
|
-
|
|
923
|
+
isActive && editing ? /* @__PURE__ */ jsx7(
|
|
924
|
+
TextInput3,
|
|
925
|
+
{
|
|
926
|
+
value,
|
|
927
|
+
onChange: (next) => setFieldValue(field, next),
|
|
928
|
+
onSubmit: () => setEditing(false),
|
|
929
|
+
mask: field === "cmaToken" ? "\u2022" : void 0
|
|
930
|
+
}
|
|
931
|
+
) : /* @__PURE__ */ jsx7(Text7, { children: display || /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "(empty)" }) })
|
|
943
932
|
] }, field);
|
|
944
933
|
}) }),
|
|
945
|
-
|
|
934
|
+
notice && /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
946
935
|
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
947
|
-
/* @__PURE__ */ jsxs7(Text7, { color: PALETTE.error, children: [
|
|
948
|
-
"\
|
|
949
|
-
|
|
936
|
+
/* @__PURE__ */ jsxs7(Text7, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
937
|
+
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
938
|
+
" ",
|
|
939
|
+
notice.text
|
|
950
940
|
] })
|
|
951
941
|
] }),
|
|
952
942
|
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
953
|
-
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: editing ? "[type] Edit
|
|
943
|
+
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: editing ? "[type] Edit \xB7 [\u2190/\u2192] Move cursor \xB7 [Enter] Done \xB7 [Esc] Cancel edit" : "[\u2191/\u2193] Switch field \xB7 [Enter] Edit \xB7 [c] Clear field \xB7 [s] Save \xB7 [Esc/q] Quit without saving" })
|
|
954
944
|
] });
|
|
955
945
|
}
|
|
956
946
|
|
package/dist/index.js
CHANGED
|
@@ -933,6 +933,7 @@ var init_config_store = __esm({
|
|
|
933
933
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
934
934
|
import { useEffect as useEffect4, useState as useState6 } from "react";
|
|
935
935
|
import { Box as Box7, Text as Text7, useInput as useInput7 } from "ink";
|
|
936
|
+
import TextInput3 from "ink-text-input";
|
|
936
937
|
import { Fragment, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
937
938
|
function debugFields(config) {
|
|
938
939
|
return {
|
|
@@ -948,7 +949,8 @@ function ConfigurationScreen({ onDone }) {
|
|
|
948
949
|
const [stage, setStage] = useState6("loading");
|
|
949
950
|
const [config, setConfig] = useState6(null);
|
|
950
951
|
const [activeField, setActiveField] = useState6("spaceId");
|
|
951
|
-
const [
|
|
952
|
+
const [notice, setNotice] = useState6(null);
|
|
953
|
+
const [lastSaved, setLastSaved] = useState6(null);
|
|
952
954
|
const [editing, setEditing] = useState6(false);
|
|
953
955
|
const [valueBeforeEdit, setValueBeforeEdit] = useState6("");
|
|
954
956
|
useEffect4(() => {
|
|
@@ -970,56 +972,48 @@ function ConfigurationScreen({ onDone }) {
|
|
|
970
972
|
function setFieldValue(field, value) {
|
|
971
973
|
if (!config) return;
|
|
972
974
|
setConfig({ ...config, [field]: value });
|
|
975
|
+
setNotice(null);
|
|
973
976
|
}
|
|
974
977
|
function handleSave() {
|
|
975
978
|
if (!config) return;
|
|
976
979
|
setStage("saving");
|
|
977
|
-
|
|
980
|
+
setNotice(null);
|
|
978
981
|
writeCredentials(config).then(() => {
|
|
979
|
-
|
|
980
|
-
|
|
982
|
+
setLastSaved(config);
|
|
983
|
+
setNotice({ kind: "success", text: "Configuration saved" });
|
|
984
|
+
setStage("form");
|
|
981
985
|
}).catch((err) => {
|
|
982
|
-
|
|
986
|
+
setNotice({ kind: "error", text: err instanceof Error ? err.message : "Failed to save" });
|
|
983
987
|
setStage("form");
|
|
984
988
|
});
|
|
985
989
|
}
|
|
990
|
+
function quit() {
|
|
991
|
+
void finishDebugRun(
|
|
992
|
+
lastSaved ? { outputs: debugFields(lastSaved), status: "success", exitMethod: "saved" } : { outputs: {}, status: "success", exitMethod: "discarded" }
|
|
993
|
+
);
|
|
994
|
+
onDone();
|
|
995
|
+
}
|
|
986
996
|
useInput7((input, key) => {
|
|
987
997
|
if (stage === "loading" || stage === "saving") return;
|
|
988
|
-
if (stage === "saved") {
|
|
989
|
-
if (key.return || key.escape || input === "q") {
|
|
990
|
-
void finishDebugRun({ outputs: debugFields(config), status: "success", exitMethod: "saved" });
|
|
991
|
-
onDone();
|
|
992
|
-
}
|
|
993
|
-
return;
|
|
994
|
-
}
|
|
995
998
|
if (editing) {
|
|
996
|
-
if (key.return) {
|
|
997
|
-
setEditing(false);
|
|
998
|
-
return;
|
|
999
|
-
}
|
|
1000
999
|
if (key.escape) {
|
|
1001
1000
|
setFieldValue(activeField, valueBeforeEdit);
|
|
1002
1001
|
setEditing(false);
|
|
1003
|
-
return;
|
|
1004
|
-
}
|
|
1005
|
-
if (key.backspace || key.delete) {
|
|
1006
|
-
setFieldValue(activeField, fieldValue(activeField).slice(0, -1));
|
|
1007
|
-
return;
|
|
1008
|
-
}
|
|
1009
|
-
if (input && !key.ctrl && !key.meta && !key.tab && !key.upArrow && !key.downArrow) {
|
|
1010
|
-
setFieldValue(activeField, fieldValue(activeField) + input);
|
|
1011
1002
|
}
|
|
1012
1003
|
return;
|
|
1013
1004
|
}
|
|
1014
1005
|
if (key.escape || input === "q") {
|
|
1015
|
-
|
|
1016
|
-
onDone();
|
|
1006
|
+
quit();
|
|
1017
1007
|
return;
|
|
1018
1008
|
}
|
|
1019
1009
|
if (input === "s") {
|
|
1020
1010
|
handleSave();
|
|
1021
1011
|
return;
|
|
1022
1012
|
}
|
|
1013
|
+
if (input === "c") {
|
|
1014
|
+
setFieldValue(activeField, "");
|
|
1015
|
+
return;
|
|
1016
|
+
}
|
|
1023
1017
|
if (key.tab || key.downArrow) {
|
|
1024
1018
|
const idx = FIELD_ORDER.indexOf(activeField);
|
|
1025
1019
|
setActiveField(FIELD_ORDER[(idx + 1) % FIELD_ORDER.length]);
|
|
@@ -1042,18 +1036,6 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1042
1036
|
/* @__PURE__ */ jsx7(Text7, { color: PALETTE.accent, children: "Loading..." })
|
|
1043
1037
|
] });
|
|
1044
1038
|
}
|
|
1045
|
-
if (stage === "saved") {
|
|
1046
|
-
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1047
|
-
/* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
|
|
1048
|
-
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
1049
|
-
/* @__PURE__ */ jsxs7(Text7, { color: PALETTE.success, children: [
|
|
1050
|
-
"\u2713 ",
|
|
1051
|
-
message
|
|
1052
|
-
] }),
|
|
1053
|
-
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
1054
|
-
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "[Enter] Back to Settings" })
|
|
1055
|
-
] });
|
|
1056
|
-
}
|
|
1057
1039
|
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1058
1040
|
/* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
|
|
1059
1041
|
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
@@ -1069,19 +1051,27 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1069
1051
|
FIELD_LABELS[field],
|
|
1070
1052
|
":"
|
|
1071
1053
|
] }),
|
|
1072
|
-
|
|
1073
|
-
|
|
1054
|
+
isActive && editing ? /* @__PURE__ */ jsx7(
|
|
1055
|
+
TextInput3,
|
|
1056
|
+
{
|
|
1057
|
+
value,
|
|
1058
|
+
onChange: (next) => setFieldValue(field, next),
|
|
1059
|
+
onSubmit: () => setEditing(false),
|
|
1060
|
+
mask: field === "cmaToken" ? "\u2022" : void 0
|
|
1061
|
+
}
|
|
1062
|
+
) : /* @__PURE__ */ jsx7(Text7, { children: display || /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "(empty)" }) })
|
|
1074
1063
|
] }, field);
|
|
1075
1064
|
}) }),
|
|
1076
|
-
|
|
1065
|
+
notice && /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
1077
1066
|
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
1078
|
-
/* @__PURE__ */ jsxs7(Text7, { color: PALETTE.error, children: [
|
|
1079
|
-
"\
|
|
1080
|
-
|
|
1067
|
+
/* @__PURE__ */ jsxs7(Text7, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
1068
|
+
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
1069
|
+
" ",
|
|
1070
|
+
notice.text
|
|
1081
1071
|
] })
|
|
1082
1072
|
] }),
|
|
1083
1073
|
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
1084
|
-
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: editing ? "[type] Edit
|
|
1074
|
+
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: editing ? "[type] Edit \xB7 [\u2190/\u2192] Move cursor \xB7 [Enter] Done \xB7 [Esc] Cancel edit" : "[\u2191/\u2193] Switch field \xB7 [Enter] Edit \xB7 [c] Clear field \xB7 [s] Save \xB7 [Esc/q] Quit without saving" })
|
|
1085
1075
|
] });
|
|
1086
1076
|
}
|
|
1087
1077
|
var FIELD_ORDER, FIELD_LABELS;
|
package/dist/package.json
CHANGED
package/legacy/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.35.1-dev-build-
|
|
3
|
+
"version": "2.35.1-dev-build-525507db.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"svelte": "^5.56.4",
|
|
43
43
|
"ts-morph": "^27.0.2",
|
|
44
44
|
"typescript": "^5.9.3",
|
|
45
|
-
"@contentful/experience-design-system-types": "2.35.1-dev-build-
|
|
45
|
+
"@contentful/experience-design-system-types": "2.35.1-dev-build-525507db.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@tsconfig/node24": "^24.0.4",
|