@contentful/experience-design-system-cli 2.37.1-dev-build-320f5360.0 → 2.37.1-dev-build-35728844.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 +120 -111
- package/dist/index.js +121 -111
- package/dist/package.json +1 -1
- package/package.json +3 -3
package/dist/app.js
CHANGED
|
@@ -2568,7 +2568,7 @@ function ControlHints({ hints }) {
|
|
|
2568
2568
|
// packages/experience-design-system-cli/src/tui/home/home.tsx
|
|
2569
2569
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2570
2570
|
var VERSION = readPackageVersion();
|
|
2571
|
-
var HEADING = "Design System Import";
|
|
2571
|
+
var HEADING = "Contentful Design System Import";
|
|
2572
2572
|
var MIN_TERMINAL_WIDTH = 164;
|
|
2573
2573
|
var START_ITEMS = [
|
|
2574
2574
|
{ label: "Import", screen: "import" },
|
|
@@ -18170,7 +18170,7 @@ function FieldForm({
|
|
|
18170
18170
|
var FIELDS = ["spaceId", "environmentId", "cmaToken", "host"];
|
|
18171
18171
|
function credentialsPurpose(tokensOnly) {
|
|
18172
18172
|
const use = tokensOnly ? "We use it to push your design tokens" : "We use it to check what components already exist and to push your import";
|
|
18173
|
-
return `${use}
|
|
18173
|
+
return `${use}.`;
|
|
18174
18174
|
}
|
|
18175
18175
|
function normalize(values) {
|
|
18176
18176
|
return {
|
|
@@ -18231,73 +18231,8 @@ var FIELDS2 = [
|
|
|
18231
18231
|
];
|
|
18232
18232
|
var MENU = [
|
|
18233
18233
|
{ choice: "continue", label: "Continue", description: "Check the credentials and go on" },
|
|
18234
|
-
{ choice: "edit", label: "Edit", description: "Change the credentials" }
|
|
18235
|
-
{ choice: "skip", label: "Skip", description: "Save files only, nothing is pushed" },
|
|
18236
|
-
{ choice: "quit", label: "Quit", description: "Go back" }
|
|
18234
|
+
{ choice: "edit", label: "Edit", description: "Change the credentials" }
|
|
18237
18235
|
];
|
|
18238
|
-
function CredentialsReview({
|
|
18239
|
-
values,
|
|
18240
|
-
subtitle,
|
|
18241
|
-
notice,
|
|
18242
|
-
validating,
|
|
18243
|
-
onChoose,
|
|
18244
|
-
children
|
|
18245
|
-
}) {
|
|
18246
|
-
const [focus, setFocus] = useState9(0);
|
|
18247
|
-
useInput11((_input, key) => {
|
|
18248
|
-
if (validating) return;
|
|
18249
|
-
if (key.escape) onChoose("quit");
|
|
18250
|
-
else if (key.return) onChoose(MENU[focus].choice);
|
|
18251
|
-
else if (key.upArrow) setFocus((current) => (current - 1 + MENU.length) % MENU.length);
|
|
18252
|
-
else if (key.downArrow || key.tab) setFocus((current) => (current + 1) % MENU.length);
|
|
18253
|
-
});
|
|
18254
|
-
const labelWidth = formLabelWidth([...FIELDS2, ...MENU]);
|
|
18255
|
-
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", children: [
|
|
18256
|
-
/* @__PURE__ */ jsx15(StepHeader, { step: "setup" }),
|
|
18257
|
-
/* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingX: 2, paddingBottom: 1, children: [
|
|
18258
|
-
/* @__PURE__ */ jsx15(Text14, { bold: true, children: "Contentful Credentials" }),
|
|
18259
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18260
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: subtitle }),
|
|
18261
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18262
|
-
MENU.map((item, index) => {
|
|
18263
|
-
const focused = index === focus;
|
|
18264
|
-
return /* @__PURE__ */ jsxs14(Box14, { gap: 1, children: [
|
|
18265
|
-
/* @__PURE__ */ jsx15(Text14, { color: focused ? PALETTE.accent : void 0, children: focused ? "\u276F" : " " }),
|
|
18266
|
-
/* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: focused, color: focused ? PALETTE.accent : PALETTE.muted, children: item.label }) }),
|
|
18267
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: item.description })
|
|
18268
|
-
] }, item.choice);
|
|
18269
|
-
}),
|
|
18270
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18271
|
-
FIELDS2.map((field) => {
|
|
18272
|
-
const value = values[field.key];
|
|
18273
|
-
return /* @__PURE__ */ jsx15(FormReadOnlyRow, { label: field.label, labelWidth, children: /* @__PURE__ */ jsx15(Text14, { bold: value !== "", children: field.masked ? "\u2022".repeat(value.length) : value || "(empty)" }) }, field.key);
|
|
18274
|
-
}),
|
|
18275
|
-
notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
18276
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18277
|
-
/* @__PURE__ */ jsxs14(Text14, { color: PALETTE.error, children: [
|
|
18278
|
-
"\u2717 ",
|
|
18279
|
-
notice.text
|
|
18280
|
-
] })
|
|
18281
|
-
] }),
|
|
18282
|
-
validating && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
18283
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18284
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: "Validating credentials..." })
|
|
18285
|
-
] }),
|
|
18286
|
-
children,
|
|
18287
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18288
|
-
/* @__PURE__ */ jsx15(
|
|
18289
|
-
ControlHints,
|
|
18290
|
-
{
|
|
18291
|
-
hints: [
|
|
18292
|
-
{ keys: "\u2191/\u2193", label: "move" },
|
|
18293
|
-
{ keys: "\u23CE", label: MENU[focus].label.toLowerCase() },
|
|
18294
|
-
{ keys: "Esc", label: "back" }
|
|
18295
|
-
]
|
|
18296
|
-
}
|
|
18297
|
-
)
|
|
18298
|
-
] })
|
|
18299
|
-
] });
|
|
18300
|
-
}
|
|
18301
18236
|
function CredentialsScreen({
|
|
18302
18237
|
onDone,
|
|
18303
18238
|
onBack,
|
|
@@ -18318,6 +18253,9 @@ function CredentialsScreen({
|
|
|
18318
18253
|
const [validating, setValidating] = useState9(false);
|
|
18319
18254
|
const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
|
|
18320
18255
|
const [editing, setEditing] = useState9(!prefilled);
|
|
18256
|
+
const [focus, setFocus] = useState9(0);
|
|
18257
|
+
const [active, setActive] = useState9(0);
|
|
18258
|
+
const [beforeEdit, setBeforeEdit] = useState9(initialValues);
|
|
18321
18259
|
const submit = async () => {
|
|
18322
18260
|
const credentials = normalize(values);
|
|
18323
18261
|
if (missingField(credentials)) {
|
|
@@ -18330,57 +18268,128 @@ function CredentialsScreen({
|
|
|
18330
18268
|
if (result.ok) onDone({ skipped: false, credentials });
|
|
18331
18269
|
else setNotice({ kind: "error", text: result.error });
|
|
18332
18270
|
};
|
|
18333
|
-
const subtitle = prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into.";
|
|
18334
18271
|
const choose = (choice) => {
|
|
18335
18272
|
if (choice === "continue") void submit();
|
|
18336
18273
|
else if (choice === "edit") {
|
|
18337
18274
|
setNotice(null);
|
|
18275
|
+
setBeforeEdit(values);
|
|
18276
|
+
setActive(0);
|
|
18338
18277
|
setEditing(true);
|
|
18339
|
-
} else
|
|
18340
|
-
else onBack();
|
|
18278
|
+
} else onBack();
|
|
18341
18279
|
};
|
|
18342
|
-
|
|
18343
|
-
|
|
18280
|
+
const stopEditing = () => {
|
|
18281
|
+
setEditing(false);
|
|
18282
|
+
setFocus(0);
|
|
18283
|
+
};
|
|
18284
|
+
useInput11((_input, key) => {
|
|
18285
|
+
if (validating) return;
|
|
18286
|
+
if (editing) {
|
|
18287
|
+
if (key.escape) {
|
|
18288
|
+
if (!prefilled) onBack();
|
|
18289
|
+
else {
|
|
18290
|
+
setValues(beforeEdit);
|
|
18291
|
+
setNotice(null);
|
|
18292
|
+
stopEditing();
|
|
18293
|
+
}
|
|
18294
|
+
} else if (key.upArrow) setActive((current) => (current - 1 + FIELDS2.length) % FIELDS2.length);
|
|
18295
|
+
else if (key.downArrow || key.tab) setActive((current) => (current + 1) % FIELDS2.length);
|
|
18296
|
+
return;
|
|
18297
|
+
}
|
|
18298
|
+
if (key.escape) choose("quit");
|
|
18299
|
+
else if (key.return) choose(MENU[focus].choice);
|
|
18300
|
+
else if (key.upArrow) setFocus((current) => (current - 1 + MENU.length) % MENU.length);
|
|
18301
|
+
else if (key.downArrow || key.tab) setFocus((current) => (current + 1) % MENU.length);
|
|
18302
|
+
});
|
|
18303
|
+
const labelWidth = formLabelWidth([...FIELDS2, ...MENU]);
|
|
18304
|
+
const changed = !isUnchanged(normalize(values), initialValues);
|
|
18305
|
+
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", children: [
|
|
18306
|
+
/* @__PURE__ */ jsx15(StepHeader, { step: "setup" }),
|
|
18307
|
+
/* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingX: 2, paddingBottom: 1, children: [
|
|
18308
|
+
/* @__PURE__ */ jsx15(Text14, { bold: true, color: PALETTE.accent, children: "Contentful Credentials" }),
|
|
18344
18309
|
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18345
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "
|
|
18346
|
-
|
|
18347
|
-
|
|
18348
|
-
|
|
18349
|
-
|
|
18350
|
-
|
|
18351
|
-
|
|
18352
|
-
|
|
18353
|
-
|
|
18354
|
-
|
|
18355
|
-
|
|
18356
|
-
|
|
18357
|
-
|
|
18358
|
-
|
|
18359
|
-
|
|
18360
|
-
|
|
18361
|
-
|
|
18362
|
-
|
|
18363
|
-
|
|
18364
|
-
|
|
18365
|
-
|
|
18366
|
-
|
|
18367
|
-
|
|
18368
|
-
|
|
18369
|
-
|
|
18370
|
-
|
|
18371
|
-
|
|
18372
|
-
|
|
18373
|
-
|
|
18374
|
-
|
|
18375
|
-
|
|
18376
|
-
|
|
18377
|
-
|
|
18378
|
-
|
|
18379
|
-
|
|
18310
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into." }),
|
|
18311
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18312
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Actions" }),
|
|
18313
|
+
MENU.map((item, index) => {
|
|
18314
|
+
const focused = !editing && index === focus;
|
|
18315
|
+
return /* @__PURE__ */ jsxs14(Box14, { gap: 1, children: [
|
|
18316
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: focused ? "\u276F" : " " }),
|
|
18317
|
+
/* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: focused, color: focused ? PALETTE.accent : editing ? PALETTE.muted : PALETTE.text, children: item.label }) }),
|
|
18318
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: item.description })
|
|
18319
|
+
] }, item.choice);
|
|
18320
|
+
}),
|
|
18321
|
+
/* @__PURE__ */ jsxs14(
|
|
18322
|
+
Box14,
|
|
18323
|
+
{
|
|
18324
|
+
flexDirection: "column",
|
|
18325
|
+
marginTop: 1,
|
|
18326
|
+
borderStyle: "single",
|
|
18327
|
+
borderColor: PALETTE.border,
|
|
18328
|
+
borderBottom: false,
|
|
18329
|
+
borderLeft: false,
|
|
18330
|
+
borderRight: false,
|
|
18331
|
+
children: [
|
|
18332
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Space" }),
|
|
18333
|
+
FIELDS2.map((field, index) => {
|
|
18334
|
+
const open = editing && index === active;
|
|
18335
|
+
const value = values[field.key];
|
|
18336
|
+
const display = field.masked ? "\u2022".repeat(value.length) : value;
|
|
18337
|
+
return /* @__PURE__ */ jsxs14(Box14, { gap: 1, children: [
|
|
18338
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: open ? "\u276F" : " " }),
|
|
18339
|
+
/* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: open, color: open ? PALETTE.accent : PALETTE.muted, children: field.label }) }),
|
|
18340
|
+
open ? /* @__PURE__ */ jsx15(
|
|
18341
|
+
ClearableTextInput,
|
|
18342
|
+
{
|
|
18343
|
+
value,
|
|
18344
|
+
onChange: (next) => {
|
|
18345
|
+
setValues((current) => ({ ...current, [field.key]: next }));
|
|
18346
|
+
setNotice(null);
|
|
18347
|
+
},
|
|
18348
|
+
onSubmit: stopEditing,
|
|
18349
|
+
mask: field.masked ? "\u2022" : void 0
|
|
18350
|
+
}
|
|
18351
|
+
) : /* @__PURE__ */ jsx15(Text14, { color: display ? PALETTE.text : PALETTE.muted, children: display || (field.hint ?? "(empty)") })
|
|
18352
|
+
] }, field.key);
|
|
18353
|
+
})
|
|
18354
|
+
]
|
|
18355
|
+
}
|
|
18356
|
+
),
|
|
18357
|
+
notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
18358
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18359
|
+
/* @__PURE__ */ jsxs14(Text14, { color: PALETTE.error, children: [
|
|
18360
|
+
"\u2717 ",
|
|
18361
|
+
notice.text
|
|
18380
18362
|
] })
|
|
18381
|
-
]
|
|
18382
|
-
|
|
18383
|
-
|
|
18363
|
+
] }),
|
|
18364
|
+
validating && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
18365
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18366
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: "Validating credentials..." })
|
|
18367
|
+
] }),
|
|
18368
|
+
!prefilled && !validating && !notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
18369
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18370
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: credentialsPurpose(tokensOnly) }),
|
|
18371
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Tip: save these under Settings \u2192 Configuration so they pre-fill here." })
|
|
18372
|
+
] }),
|
|
18373
|
+
changed && !validating && !notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
18374
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18375
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Changed values are saved after they validate." })
|
|
18376
|
+
] }),
|
|
18377
|
+
editing && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
18378
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18379
|
+
/* @__PURE__ */ jsx15(
|
|
18380
|
+
ControlHints,
|
|
18381
|
+
{
|
|
18382
|
+
hints: [
|
|
18383
|
+
{ keys: "\u2191/\u2193", label: "field" },
|
|
18384
|
+
{ keys: "\u23CE", label: "save" },
|
|
18385
|
+
{ keys: "Ctrl+D", label: "clear" },
|
|
18386
|
+
{ keys: "Esc", label: prefilled ? "cancel" : "back" }
|
|
18387
|
+
]
|
|
18388
|
+
}
|
|
18389
|
+
)
|
|
18390
|
+
] })
|
|
18391
|
+
] })
|
|
18392
|
+
] });
|
|
18384
18393
|
}
|
|
18385
18394
|
|
|
18386
18395
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/logic.ts
|
package/dist/index.js
CHANGED
|
@@ -19369,7 +19369,7 @@ var init_home = __esm({
|
|
|
19369
19369
|
init_use_terminal_width();
|
|
19370
19370
|
init_ControlHints();
|
|
19371
19371
|
VERSION = readPackageVersion();
|
|
19372
|
-
HEADING = "Design System Import";
|
|
19372
|
+
HEADING = "Contentful Design System Import";
|
|
19373
19373
|
MIN_TERMINAL_WIDTH = 164;
|
|
19374
19374
|
START_ITEMS = [
|
|
19375
19375
|
{ label: "Import", screen: "import" },
|
|
@@ -20613,7 +20613,7 @@ var init_FieldForm = __esm({
|
|
|
20613
20613
|
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts
|
|
20614
20614
|
function credentialsPurpose(tokensOnly) {
|
|
20615
20615
|
const use = tokensOnly ? "We use it to push your design tokens" : "We use it to check what components already exist and to push your import";
|
|
20616
|
-
return `${use}
|
|
20616
|
+
return `${use}.`;
|
|
20617
20617
|
}
|
|
20618
20618
|
function normalize(values) {
|
|
20619
20619
|
return {
|
|
@@ -20689,69 +20689,6 @@ var init_validate4 = __esm({
|
|
|
20689
20689
|
import { useRef as useRef2, useState as useState9 } from "react";
|
|
20690
20690
|
import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
|
|
20691
20691
|
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
20692
|
-
function CredentialsReview({
|
|
20693
|
-
values,
|
|
20694
|
-
subtitle,
|
|
20695
|
-
notice,
|
|
20696
|
-
validating,
|
|
20697
|
-
onChoose,
|
|
20698
|
-
children
|
|
20699
|
-
}) {
|
|
20700
|
-
const [focus, setFocus] = useState9(0);
|
|
20701
|
-
useInput11((_input, key) => {
|
|
20702
|
-
if (validating) return;
|
|
20703
|
-
if (key.escape) onChoose("quit");
|
|
20704
|
-
else if (key.return) onChoose(MENU[focus].choice);
|
|
20705
|
-
else if (key.upArrow) setFocus((current) => (current - 1 + MENU.length) % MENU.length);
|
|
20706
|
-
else if (key.downArrow || key.tab) setFocus((current) => (current + 1) % MENU.length);
|
|
20707
|
-
});
|
|
20708
|
-
const labelWidth = formLabelWidth([...FIELDS2, ...MENU]);
|
|
20709
|
-
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", children: [
|
|
20710
|
-
/* @__PURE__ */ jsx15(StepHeader, { step: "setup" }),
|
|
20711
|
-
/* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingX: 2, paddingBottom: 1, children: [
|
|
20712
|
-
/* @__PURE__ */ jsx15(Text14, { bold: true, children: "Contentful Credentials" }),
|
|
20713
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20714
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: subtitle }),
|
|
20715
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20716
|
-
MENU.map((item, index) => {
|
|
20717
|
-
const focused = index === focus;
|
|
20718
|
-
return /* @__PURE__ */ jsxs14(Box14, { gap: 1, children: [
|
|
20719
|
-
/* @__PURE__ */ jsx15(Text14, { color: focused ? PALETTE.accent : void 0, children: focused ? "\u276F" : " " }),
|
|
20720
|
-
/* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: focused, color: focused ? PALETTE.accent : PALETTE.muted, children: item.label }) }),
|
|
20721
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: item.description })
|
|
20722
|
-
] }, item.choice);
|
|
20723
|
-
}),
|
|
20724
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20725
|
-
FIELDS2.map((field) => {
|
|
20726
|
-
const value = values[field.key];
|
|
20727
|
-
return /* @__PURE__ */ jsx15(FormReadOnlyRow, { label: field.label, labelWidth, children: /* @__PURE__ */ jsx15(Text14, { bold: value !== "", children: field.masked ? "\u2022".repeat(value.length) : value || "(empty)" }) }, field.key);
|
|
20728
|
-
}),
|
|
20729
|
-
notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
20730
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20731
|
-
/* @__PURE__ */ jsxs14(Text14, { color: PALETTE.error, children: [
|
|
20732
|
-
"\u2717 ",
|
|
20733
|
-
notice.text
|
|
20734
|
-
] })
|
|
20735
|
-
] }),
|
|
20736
|
-
validating && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
20737
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20738
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: "Validating credentials..." })
|
|
20739
|
-
] }),
|
|
20740
|
-
children,
|
|
20741
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20742
|
-
/* @__PURE__ */ jsx15(
|
|
20743
|
-
ControlHints,
|
|
20744
|
-
{
|
|
20745
|
-
hints: [
|
|
20746
|
-
{ keys: "\u2191/\u2193", label: "move" },
|
|
20747
|
-
{ keys: "\u23CE", label: MENU[focus].label.toLowerCase() },
|
|
20748
|
-
{ keys: "Esc", label: "back" }
|
|
20749
|
-
]
|
|
20750
|
-
}
|
|
20751
|
-
)
|
|
20752
|
-
] })
|
|
20753
|
-
] });
|
|
20754
|
-
}
|
|
20755
20692
|
function CredentialsScreen({
|
|
20756
20693
|
onDone,
|
|
20757
20694
|
onBack,
|
|
@@ -20772,6 +20709,9 @@ function CredentialsScreen({
|
|
|
20772
20709
|
const [validating, setValidating] = useState9(false);
|
|
20773
20710
|
const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
|
|
20774
20711
|
const [editing, setEditing] = useState9(!prefilled);
|
|
20712
|
+
const [focus, setFocus] = useState9(0);
|
|
20713
|
+
const [active, setActive] = useState9(0);
|
|
20714
|
+
const [beforeEdit, setBeforeEdit] = useState9(initialValues);
|
|
20775
20715
|
const submit = async () => {
|
|
20776
20716
|
const credentials = normalize(values);
|
|
20777
20717
|
if (missingField(credentials)) {
|
|
@@ -20784,57 +20724,128 @@ function CredentialsScreen({
|
|
|
20784
20724
|
if (result.ok) onDone({ skipped: false, credentials });
|
|
20785
20725
|
else setNotice({ kind: "error", text: result.error });
|
|
20786
20726
|
};
|
|
20787
|
-
const subtitle = prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into.";
|
|
20788
20727
|
const choose = (choice) => {
|
|
20789
20728
|
if (choice === "continue") void submit();
|
|
20790
20729
|
else if (choice === "edit") {
|
|
20791
20730
|
setNotice(null);
|
|
20731
|
+
setBeforeEdit(values);
|
|
20732
|
+
setActive(0);
|
|
20792
20733
|
setEditing(true);
|
|
20793
|
-
} else
|
|
20794
|
-
else onBack();
|
|
20734
|
+
} else onBack();
|
|
20795
20735
|
};
|
|
20796
|
-
|
|
20797
|
-
|
|
20736
|
+
const stopEditing = () => {
|
|
20737
|
+
setEditing(false);
|
|
20738
|
+
setFocus(0);
|
|
20739
|
+
};
|
|
20740
|
+
useInput11((_input, key) => {
|
|
20741
|
+
if (validating) return;
|
|
20742
|
+
if (editing) {
|
|
20743
|
+
if (key.escape) {
|
|
20744
|
+
if (!prefilled) onBack();
|
|
20745
|
+
else {
|
|
20746
|
+
setValues(beforeEdit);
|
|
20747
|
+
setNotice(null);
|
|
20748
|
+
stopEditing();
|
|
20749
|
+
}
|
|
20750
|
+
} else if (key.upArrow) setActive((current) => (current - 1 + FIELDS2.length) % FIELDS2.length);
|
|
20751
|
+
else if (key.downArrow || key.tab) setActive((current) => (current + 1) % FIELDS2.length);
|
|
20752
|
+
return;
|
|
20753
|
+
}
|
|
20754
|
+
if (key.escape) choose("quit");
|
|
20755
|
+
else if (key.return) choose(MENU[focus].choice);
|
|
20756
|
+
else if (key.upArrow) setFocus((current) => (current - 1 + MENU.length) % MENU.length);
|
|
20757
|
+
else if (key.downArrow || key.tab) setFocus((current) => (current + 1) % MENU.length);
|
|
20758
|
+
});
|
|
20759
|
+
const labelWidth = formLabelWidth([...FIELDS2, ...MENU]);
|
|
20760
|
+
const changed = !isUnchanged(normalize(values), initialValues);
|
|
20761
|
+
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", children: [
|
|
20762
|
+
/* @__PURE__ */ jsx15(StepHeader, { step: "setup" }),
|
|
20763
|
+
/* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingX: 2, paddingBottom: 1, children: [
|
|
20764
|
+
/* @__PURE__ */ jsx15(Text14, { bold: true, color: PALETTE.accent, children: "Contentful Credentials" }),
|
|
20798
20765
|
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20799
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "
|
|
20800
|
-
|
|
20801
|
-
|
|
20802
|
-
|
|
20803
|
-
|
|
20804
|
-
|
|
20805
|
-
|
|
20806
|
-
|
|
20807
|
-
|
|
20808
|
-
|
|
20809
|
-
|
|
20810
|
-
|
|
20811
|
-
|
|
20812
|
-
|
|
20813
|
-
|
|
20814
|
-
|
|
20815
|
-
|
|
20816
|
-
|
|
20817
|
-
|
|
20818
|
-
|
|
20819
|
-
|
|
20820
|
-
|
|
20821
|
-
|
|
20822
|
-
|
|
20823
|
-
|
|
20824
|
-
|
|
20825
|
-
|
|
20826
|
-
|
|
20827
|
-
|
|
20828
|
-
|
|
20829
|
-
|
|
20830
|
-
|
|
20831
|
-
|
|
20832
|
-
|
|
20833
|
-
|
|
20766
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into." }),
|
|
20767
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20768
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Actions" }),
|
|
20769
|
+
MENU.map((item, index) => {
|
|
20770
|
+
const focused = !editing && index === focus;
|
|
20771
|
+
return /* @__PURE__ */ jsxs14(Box14, { gap: 1, children: [
|
|
20772
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: focused ? "\u276F" : " " }),
|
|
20773
|
+
/* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: focused, color: focused ? PALETTE.accent : editing ? PALETTE.muted : PALETTE.text, children: item.label }) }),
|
|
20774
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: item.description })
|
|
20775
|
+
] }, item.choice);
|
|
20776
|
+
}),
|
|
20777
|
+
/* @__PURE__ */ jsxs14(
|
|
20778
|
+
Box14,
|
|
20779
|
+
{
|
|
20780
|
+
flexDirection: "column",
|
|
20781
|
+
marginTop: 1,
|
|
20782
|
+
borderStyle: "single",
|
|
20783
|
+
borderColor: PALETTE.border,
|
|
20784
|
+
borderBottom: false,
|
|
20785
|
+
borderLeft: false,
|
|
20786
|
+
borderRight: false,
|
|
20787
|
+
children: [
|
|
20788
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Space" }),
|
|
20789
|
+
FIELDS2.map((field, index) => {
|
|
20790
|
+
const open = editing && index === active;
|
|
20791
|
+
const value = values[field.key];
|
|
20792
|
+
const display = field.masked ? "\u2022".repeat(value.length) : value;
|
|
20793
|
+
return /* @__PURE__ */ jsxs14(Box14, { gap: 1, children: [
|
|
20794
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: open ? "\u276F" : " " }),
|
|
20795
|
+
/* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: open, color: open ? PALETTE.accent : PALETTE.muted, children: field.label }) }),
|
|
20796
|
+
open ? /* @__PURE__ */ jsx15(
|
|
20797
|
+
ClearableTextInput,
|
|
20798
|
+
{
|
|
20799
|
+
value,
|
|
20800
|
+
onChange: (next) => {
|
|
20801
|
+
setValues((current) => ({ ...current, [field.key]: next }));
|
|
20802
|
+
setNotice(null);
|
|
20803
|
+
},
|
|
20804
|
+
onSubmit: stopEditing,
|
|
20805
|
+
mask: field.masked ? "\u2022" : void 0
|
|
20806
|
+
}
|
|
20807
|
+
) : /* @__PURE__ */ jsx15(Text14, { color: display ? PALETTE.text : PALETTE.muted, children: display || (field.hint ?? "(empty)") })
|
|
20808
|
+
] }, field.key);
|
|
20809
|
+
})
|
|
20810
|
+
]
|
|
20811
|
+
}
|
|
20812
|
+
),
|
|
20813
|
+
notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
20814
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20815
|
+
/* @__PURE__ */ jsxs14(Text14, { color: PALETTE.error, children: [
|
|
20816
|
+
"\u2717 ",
|
|
20817
|
+
notice.text
|
|
20834
20818
|
] })
|
|
20835
|
-
]
|
|
20836
|
-
|
|
20837
|
-
|
|
20819
|
+
] }),
|
|
20820
|
+
validating && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
20821
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20822
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: "Validating credentials..." })
|
|
20823
|
+
] }),
|
|
20824
|
+
!prefilled && !validating && !notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
20825
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20826
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: credentialsPurpose(tokensOnly) }),
|
|
20827
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Tip: save these under Settings \u2192 Configuration so they pre-fill here." })
|
|
20828
|
+
] }),
|
|
20829
|
+
changed && !validating && !notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
20830
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20831
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Changed values are saved after they validate." })
|
|
20832
|
+
] }),
|
|
20833
|
+
editing && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
20834
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20835
|
+
/* @__PURE__ */ jsx15(
|
|
20836
|
+
ControlHints,
|
|
20837
|
+
{
|
|
20838
|
+
hints: [
|
|
20839
|
+
{ keys: "\u2191/\u2193", label: "field" },
|
|
20840
|
+
{ keys: "\u23CE", label: "save" },
|
|
20841
|
+
{ keys: "Ctrl+D", label: "clear" },
|
|
20842
|
+
{ keys: "Esc", label: prefilled ? "cancel" : "back" }
|
|
20843
|
+
]
|
|
20844
|
+
}
|
|
20845
|
+
)
|
|
20846
|
+
] })
|
|
20847
|
+
] })
|
|
20848
|
+
] });
|
|
20838
20849
|
}
|
|
20839
20850
|
var FIELDS2, MENU;
|
|
20840
20851
|
var init_screen5 = __esm({
|
|
@@ -20842,6 +20853,7 @@ var init_screen5 = __esm({
|
|
|
20842
20853
|
"use strict";
|
|
20843
20854
|
init_theme();
|
|
20844
20855
|
init_FieldForm();
|
|
20856
|
+
init_ClearableTextInput();
|
|
20845
20857
|
init_ControlHints();
|
|
20846
20858
|
init_StepHeader();
|
|
20847
20859
|
init_logic8();
|
|
@@ -20854,9 +20866,7 @@ var init_screen5 = __esm({
|
|
|
20854
20866
|
];
|
|
20855
20867
|
MENU = [
|
|
20856
20868
|
{ choice: "continue", label: "Continue", description: "Check the credentials and go on" },
|
|
20857
|
-
{ choice: "edit", label: "Edit", description: "Change the credentials" }
|
|
20858
|
-
{ choice: "skip", label: "Skip", description: "Save files only, nothing is pushed" },
|
|
20859
|
-
{ choice: "quit", label: "Quit", description: "Go back" }
|
|
20869
|
+
{ choice: "edit", label: "Edit", description: "Change the credentials" }
|
|
20860
20870
|
];
|
|
20861
20871
|
}
|
|
20862
20872
|
});
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.37.1-dev-build-
|
|
3
|
+
"version": "2.37.1-dev-build-35728844.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"ts-morph": "^27.0.2",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
47
47
|
"zod": "^4.6.5",
|
|
48
|
-
"@contentful/experience-design-system-
|
|
49
|
-
"@contentful/experience-design-system-
|
|
48
|
+
"@contentful/experience-design-system-types": "2.37.1-dev-build-35728844.0",
|
|
49
|
+
"@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-35728844.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@tsconfig/node24": "^24.0.4",
|