@contentful/experience-design-system-cli 2.35.1-dev-build-3ab9e99e.0 → 2.35.1-dev-build-a963233a.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 +245 -174
- package/dist/index.js +284 -190
- package/dist/package.json +2 -1
- package/dist/src/tui/debug-store.d.ts +0 -1
- package/dist/src/tui/import/steps/01-welcome/controls.d.ts +8 -0
- package/dist/src/tui/import/steps/01-welcome/logic.d.ts +8 -0
- package/dist/src/tui/import/steps/01-welcome/screen.d.ts +7 -0
- package/dist/src/tui/import/steps/index.d.ts +1 -0
- package/legacy/dist/src/import/tui/steps/WizardPreviewStep.d.ts +1 -2
- package/legacy/dist/src/index.js +7858 -7281
- package/legacy/package.json +2 -1
- package/package.json +3 -2
- package/legacy/dist/src/apply/dangling-token-defaults.d.ts +0 -17
- package/legacy/dist/src/helpers/fetch-existing-token-ids.d.ts +0 -11
- package/legacy/dist/src/lib/push-debug-log.d.ts +0 -29
package/dist/app.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// packages/experience-design-system-cli/app.tsx
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as useState9 } from "react";
|
|
3
3
|
|
|
4
4
|
// packages/experience-design-system-cli/src/tui/home/home.tsx
|
|
5
5
|
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
@@ -230,6 +230,80 @@ function ImportScreen({ exitCode, onDone }) {
|
|
|
230
230
|
] });
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
|
|
234
|
+
import { useState as useState3 } from "react";
|
|
235
|
+
import { Box as Box3, Text as Text3 } from "ink";
|
|
236
|
+
import TextInput from "ink-text-input";
|
|
237
|
+
|
|
238
|
+
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/controls.ts
|
|
239
|
+
import { useInput as useInput3 } from "ink";
|
|
240
|
+
|
|
241
|
+
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/logic.ts
|
|
242
|
+
function shouldQuit(value, input, key) {
|
|
243
|
+
if (key.escape) return true;
|
|
244
|
+
return value === "" && input === "q" && !key.ctrl && !key.meta;
|
|
245
|
+
}
|
|
246
|
+
function toProjectPath(value) {
|
|
247
|
+
const projectPath = value.trim();
|
|
248
|
+
return projectPath === "" ? null : projectPath;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/controls.ts
|
|
252
|
+
var WELCOME_CONTROLS = [
|
|
253
|
+
{ keys: "Enter", label: "Continue" },
|
|
254
|
+
{ keys: "Esc/q", label: "Back to menu" }
|
|
255
|
+
];
|
|
256
|
+
function useWelcomeControls(projectPath, onQuit) {
|
|
257
|
+
useInput3((input, key) => {
|
|
258
|
+
if (shouldQuit(projectPath, input, key)) onQuit();
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
|
|
263
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
264
|
+
var RULE = "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500";
|
|
265
|
+
var OVERVIEW = [
|
|
266
|
+
{ label: "Step 1", description: "Extract components from your codebase" },
|
|
267
|
+
{ label: "Step 2", description: "Review what was extracted" },
|
|
268
|
+
{ label: "Step 3", description: "Generate CDF definitions with Claude" },
|
|
269
|
+
{ label: "Step 4", description: "Review generated definitions" },
|
|
270
|
+
{ label: "Step 5", description: "Push to Contentful" }
|
|
271
|
+
];
|
|
272
|
+
function WelcomeScreen({ onContinue, onQuit }) {
|
|
273
|
+
const [projectPath, setProjectPath] = useState3("");
|
|
274
|
+
useWelcomeControls(projectPath, onQuit);
|
|
275
|
+
const submit = (value) => {
|
|
276
|
+
const path = toProjectPath(value);
|
|
277
|
+
if (path) onContinue(path);
|
|
278
|
+
};
|
|
279
|
+
return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
280
|
+
/* @__PURE__ */ jsx3(Text3, { bold: true, color: PALETTE.success, children: "\u{1F44B} Hey! Let's import your design system into Contentful." }),
|
|
281
|
+
/* @__PURE__ */ jsx3(Text3, { dimColor: true, children: "I'll walk you through 5 steps to get your components into Contentful ExO." }),
|
|
282
|
+
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", marginTop: 1, children: [
|
|
283
|
+
/* @__PURE__ */ jsx3(Text3, { dimColor: true, children: RULE }),
|
|
284
|
+
OVERVIEW.map((item) => /* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
|
|
285
|
+
/* @__PURE__ */ jsx3(Text3, { bold: true, children: item.label }),
|
|
286
|
+
/* @__PURE__ */ jsx3(Text3, { dimColor: true, children: item.description })
|
|
287
|
+
] }, item.label)),
|
|
288
|
+
/* @__PURE__ */ jsx3(Text3, { dimColor: true, children: RULE })
|
|
289
|
+
] }),
|
|
290
|
+
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", marginTop: 1, children: [
|
|
291
|
+
/* @__PURE__ */ jsx3(Text3, { children: "Where is your component library?" }),
|
|
292
|
+
/* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
|
|
293
|
+
/* @__PURE__ */ jsx3(Text3, { color: PALETTE.accent, children: "?" }),
|
|
294
|
+
/* @__PURE__ */ jsx3(Text3, { children: "Project path:" }),
|
|
295
|
+
/* @__PURE__ */ jsx3(TextInput, { value: projectPath, onChange: setProjectPath, onSubmit: submit })
|
|
296
|
+
] })
|
|
297
|
+
] }),
|
|
298
|
+
/* @__PURE__ */ jsx3(Box3, { marginTop: 1, gap: 3, children: WELCOME_CONTROLS.map((control) => /* @__PURE__ */ jsxs3(Text3, { dimColor: true, children: [
|
|
299
|
+
"[",
|
|
300
|
+
control.keys,
|
|
301
|
+
"] ",
|
|
302
|
+
control.label
|
|
303
|
+
] }, control.keys)) })
|
|
304
|
+
] });
|
|
305
|
+
}
|
|
306
|
+
|
|
233
307
|
// packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts
|
|
234
308
|
import { spawn } from "node:child_process";
|
|
235
309
|
|
|
@@ -251,6 +325,52 @@ ${candidates.join("\n")}`);
|
|
|
251
325
|
return found;
|
|
252
326
|
}
|
|
253
327
|
|
|
328
|
+
// packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts
|
|
329
|
+
function buildArgs(options) {
|
|
330
|
+
const args = ["import"];
|
|
331
|
+
if (options.project) {
|
|
332
|
+
args.push("--project", options.project);
|
|
333
|
+
}
|
|
334
|
+
return args;
|
|
335
|
+
}
|
|
336
|
+
async function spawnV1Import(options = {}) {
|
|
337
|
+
const cliPath = findLegacyCliPath();
|
|
338
|
+
const args = buildArgs(options);
|
|
339
|
+
return new Promise((resolvePromise) => {
|
|
340
|
+
const child = spawn("node", [cliPath, ...args], {
|
|
341
|
+
stdio: "inherit"
|
|
342
|
+
});
|
|
343
|
+
child.on("close", (code) => {
|
|
344
|
+
resolvePromise({ exitCode: code ?? 1, result: void 0, stdout: "", stderr: "" });
|
|
345
|
+
});
|
|
346
|
+
child.on("error", (err) => {
|
|
347
|
+
resolvePromise({ exitCode: 1, result: void 0, stdout: "", stderr: err.message });
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// packages/experience-design-system-cli/src/tui/import/terminal-input.ts
|
|
353
|
+
function getTerminalHandle() {
|
|
354
|
+
return process.stdin._handle;
|
|
355
|
+
}
|
|
356
|
+
async function stopReadingTerminal() {
|
|
357
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
358
|
+
const handle = getTerminalHandle();
|
|
359
|
+
if (!handle?.readStop) return;
|
|
360
|
+
handle.reading = false;
|
|
361
|
+
handle.readStop();
|
|
362
|
+
}
|
|
363
|
+
function startReadingTerminal() {
|
|
364
|
+
const handle = getTerminalHandle();
|
|
365
|
+
if (!handle?.readStart) return;
|
|
366
|
+
handle.reading = true;
|
|
367
|
+
handle.readStart();
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
371
|
+
import { useEffect as useEffect3 } from "react";
|
|
372
|
+
import { Box as Box4, Text as Text4, useInput as useInput4 } from "ink";
|
|
373
|
+
|
|
254
374
|
// packages/experience-design-system-cli/src/tui/debug-store.ts
|
|
255
375
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
256
376
|
import { existsSync as existsSync3, readdirSync } from "node:fs";
|
|
@@ -315,9 +435,6 @@ var SESSION_ID = generateSessionId();
|
|
|
315
435
|
function sessionDebugDir() {
|
|
316
436
|
return join5(sessionsRootDir(), SESSION_ID);
|
|
317
437
|
}
|
|
318
|
-
async function debugSessionDirIfEnabled() {
|
|
319
|
-
return await isDebugModeEnabled() ? sessionDebugDir() : void 0;
|
|
320
|
-
}
|
|
321
438
|
void isDebugModeEnabled().then((enabled) => {
|
|
322
439
|
if (!enabled) return void 0;
|
|
323
440
|
return mkdir2(sessionDebugDir(), { recursive: true });
|
|
@@ -425,54 +542,8 @@ process.once("SIGINT", () => {
|
|
|
425
542
|
});
|
|
426
543
|
});
|
|
427
544
|
|
|
428
|
-
// packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts
|
|
429
|
-
function buildArgs(options) {
|
|
430
|
-
const args = ["import"];
|
|
431
|
-
if (options.project) {
|
|
432
|
-
args.push("--project", options.project);
|
|
433
|
-
}
|
|
434
|
-
return args;
|
|
435
|
-
}
|
|
436
|
-
async function spawnV1Import(options = {}) {
|
|
437
|
-
const cliPath = findLegacyCliPath();
|
|
438
|
-
const args = buildArgs(options);
|
|
439
|
-
const debugSessionDir = await debugSessionDirIfEnabled();
|
|
440
|
-
return new Promise((resolvePromise) => {
|
|
441
|
-
const child = spawn("node", [cliPath, ...args], {
|
|
442
|
-
stdio: "inherit",
|
|
443
|
-
env: debugSessionDir ? { ...process.env, EDS_DEBUG_SESSION_DIR: debugSessionDir } : process.env
|
|
444
|
-
});
|
|
445
|
-
child.on("close", (code) => {
|
|
446
|
-
resolvePromise({ exitCode: code ?? 1, result: void 0, stdout: "", stderr: "" });
|
|
447
|
-
});
|
|
448
|
-
child.on("error", (err) => {
|
|
449
|
-
resolvePromise({ exitCode: 1, result: void 0, stdout: "", stderr: err.message });
|
|
450
|
-
});
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
// packages/experience-design-system-cli/src/tui/import/terminal-input.ts
|
|
455
|
-
function getTerminalHandle() {
|
|
456
|
-
return process.stdin._handle;
|
|
457
|
-
}
|
|
458
|
-
async function stopReadingTerminal() {
|
|
459
|
-
await new Promise((resolve) => setImmediate(resolve));
|
|
460
|
-
const handle = getTerminalHandle();
|
|
461
|
-
if (!handle?.readStop) return;
|
|
462
|
-
handle.reading = false;
|
|
463
|
-
handle.readStop();
|
|
464
|
-
}
|
|
465
|
-
function startReadingTerminal() {
|
|
466
|
-
const handle = getTerminalHandle();
|
|
467
|
-
if (!handle?.readStart) return;
|
|
468
|
-
handle.reading = true;
|
|
469
|
-
handle.readStart();
|
|
470
|
-
}
|
|
471
|
-
|
|
472
545
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
473
|
-
import {
|
|
474
|
-
import { Box as Box3, Text as Text3, useInput as useInput3 } from "ink";
|
|
475
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
546
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
476
547
|
function HelpScreen({ onDone }) {
|
|
477
548
|
useEffect3(() => {
|
|
478
549
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
@@ -481,7 +552,7 @@ function HelpScreen({ onDone }) {
|
|
|
481
552
|
void finishDebugRun({ outputs: {}, status: "success", exitMethod });
|
|
482
553
|
onDone();
|
|
483
554
|
};
|
|
484
|
-
|
|
555
|
+
useInput4((input, key) => {
|
|
485
556
|
if (key.return) {
|
|
486
557
|
leave("saved");
|
|
487
558
|
return;
|
|
@@ -491,30 +562,30 @@ function HelpScreen({ onDone }) {
|
|
|
491
562
|
return;
|
|
492
563
|
}
|
|
493
564
|
});
|
|
494
|
-
return /* @__PURE__ */
|
|
495
|
-
/* @__PURE__ */
|
|
496
|
-
/* @__PURE__ */
|
|
497
|
-
/* @__PURE__ */
|
|
498
|
-
/* @__PURE__ */
|
|
499
|
-
/* @__PURE__ */
|
|
565
|
+
return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
566
|
+
/* @__PURE__ */ jsx4(Text4, { bold: true, children: "Help" }),
|
|
567
|
+
/* @__PURE__ */ jsx4(Text4, { children: " " }),
|
|
568
|
+
/* @__PURE__ */ jsx4(Text4, { children: "This is a placeholder screen for v2 help content." }),
|
|
569
|
+
/* @__PURE__ */ jsx4(Text4, { children: " " }),
|
|
570
|
+
/* @__PURE__ */ jsx4(Text4, { dimColor: true, children: "[Enter] Complete [Esc/q] Exit \u2014 both return to Start" })
|
|
500
571
|
] });
|
|
501
572
|
}
|
|
502
573
|
|
|
503
574
|
// packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
|
|
504
|
-
import { useState as
|
|
505
|
-
import { Box as
|
|
506
|
-
import { jsx as
|
|
575
|
+
import { useState as useState4 } from "react";
|
|
576
|
+
import { Box as Box5, Text as Text5, useInput as useInput5 } from "ink";
|
|
577
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
507
578
|
function SettingsScreen({
|
|
508
579
|
onNavigate,
|
|
509
580
|
onBack
|
|
510
581
|
}) {
|
|
511
|
-
const [focusIdx, setFocusIdx] =
|
|
582
|
+
const [focusIdx, setFocusIdx] = useState4(0);
|
|
512
583
|
const items = [
|
|
513
584
|
{ label: "Configuration", screen: "settings-configuration" },
|
|
514
585
|
{ label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
|
|
515
586
|
{ label: "Debug Mode", screen: "settings-debug-mode" }
|
|
516
587
|
];
|
|
517
|
-
|
|
588
|
+
useInput5((input, key) => {
|
|
518
589
|
if (key.upArrow) {
|
|
519
590
|
setFocusIdx((i) => (i - 1 + items.length) % items.length);
|
|
520
591
|
return;
|
|
@@ -534,21 +605,21 @@ function SettingsScreen({
|
|
|
534
605
|
onBack();
|
|
535
606
|
}
|
|
536
607
|
});
|
|
537
|
-
return /* @__PURE__ */
|
|
538
|
-
/* @__PURE__ */
|
|
539
|
-
/* @__PURE__ */
|
|
540
|
-
items.map((item, i) => /* @__PURE__ */
|
|
608
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
609
|
+
/* @__PURE__ */ jsx5(Text5, { bold: true, children: "Settings" }),
|
|
610
|
+
/* @__PURE__ */ jsx5(Text5, { children: " " }),
|
|
611
|
+
items.map((item, i) => /* @__PURE__ */ jsxs5(Text5, { color: i === focusIdx ? "cyan" : void 0, children: [
|
|
541
612
|
i === focusIdx ? "> " : " ",
|
|
542
613
|
item.label
|
|
543
614
|
] }, item.label)),
|
|
544
|
-
/* @__PURE__ */
|
|
545
|
-
/* @__PURE__ */
|
|
615
|
+
/* @__PURE__ */ jsx5(Text5, { children: " " }),
|
|
616
|
+
/* @__PURE__ */ jsx5(Text5, { dimColor: true, children: "[\u2191/\u2193] Navigate [Enter] Select [Esc/q] Back to Start" })
|
|
546
617
|
] });
|
|
547
618
|
}
|
|
548
619
|
|
|
549
620
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
550
|
-
import { useEffect as useEffect4, useState as
|
|
551
|
-
import { Box as
|
|
621
|
+
import { useEffect as useEffect4, useState as useState5 } from "react";
|
|
622
|
+
import { Box as Box6, Text as Text6, useInput as useInput6 } from "ink";
|
|
552
623
|
|
|
553
624
|
// packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
|
|
554
625
|
import { readFile as readFile2, writeFile as writeFile3, mkdir as mkdir3 } from "node:fs/promises";
|
|
@@ -592,7 +663,7 @@ async function writeCredentials(config) {
|
|
|
592
663
|
}
|
|
593
664
|
|
|
594
665
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
595
|
-
import { Fragment, jsx as
|
|
666
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
596
667
|
var FIELD_ORDER = ["spaceId", "environmentId", "cmaToken", "host"];
|
|
597
668
|
function debugFields(config) {
|
|
598
669
|
return {
|
|
@@ -609,10 +680,10 @@ var FIELD_LABELS = {
|
|
|
609
680
|
host: "API Host (optional)"
|
|
610
681
|
};
|
|
611
682
|
function ConfigurationScreen({ onDone }) {
|
|
612
|
-
const [stage, setStage] =
|
|
613
|
-
const [config, setConfig] =
|
|
614
|
-
const [activeField, setActiveField] =
|
|
615
|
-
const [message, setMessage] =
|
|
683
|
+
const [stage, setStage] = useState5("loading");
|
|
684
|
+
const [config, setConfig] = useState5(null);
|
|
685
|
+
const [activeField, setActiveField] = useState5("spaceId");
|
|
686
|
+
const [message, setMessage] = useState5(null);
|
|
616
687
|
useEffect4(() => {
|
|
617
688
|
readCredentials().then((cfg) => {
|
|
618
689
|
setConfig(cfg);
|
|
@@ -645,7 +716,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
645
716
|
setStage("form");
|
|
646
717
|
});
|
|
647
718
|
}
|
|
648
|
-
|
|
719
|
+
useInput6((input, key) => {
|
|
649
720
|
if (stage === "loading" || stage === "saving") return;
|
|
650
721
|
if (stage === "saved") {
|
|
651
722
|
if (key.return || key.escape || input === "q") {
|
|
@@ -688,57 +759,57 @@ function ConfigurationScreen({ onDone }) {
|
|
|
688
759
|
}
|
|
689
760
|
});
|
|
690
761
|
if (stage === "loading") {
|
|
691
|
-
return /* @__PURE__ */
|
|
692
|
-
/* @__PURE__ */
|
|
693
|
-
/* @__PURE__ */
|
|
694
|
-
/* @__PURE__ */
|
|
762
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
763
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: "Configuration" }),
|
|
764
|
+
/* @__PURE__ */ jsx6(Text6, { children: " " }),
|
|
765
|
+
/* @__PURE__ */ jsx6(Text6, { color: PALETTE.accent, children: "Loading..." })
|
|
695
766
|
] });
|
|
696
767
|
}
|
|
697
768
|
if (stage === "saved") {
|
|
698
|
-
return /* @__PURE__ */
|
|
699
|
-
/* @__PURE__ */
|
|
700
|
-
/* @__PURE__ */
|
|
701
|
-
/* @__PURE__ */
|
|
769
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
770
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: "Configuration" }),
|
|
771
|
+
/* @__PURE__ */ jsx6(Text6, { children: " " }),
|
|
772
|
+
/* @__PURE__ */ jsxs6(Text6, { color: PALETTE.success, children: [
|
|
702
773
|
"\u2713 ",
|
|
703
774
|
message
|
|
704
775
|
] }),
|
|
705
|
-
/* @__PURE__ */
|
|
706
|
-
/* @__PURE__ */
|
|
776
|
+
/* @__PURE__ */ jsx6(Text6, { children: " " }),
|
|
777
|
+
/* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "[Enter] Back to Settings" })
|
|
707
778
|
] });
|
|
708
779
|
}
|
|
709
|
-
return /* @__PURE__ */
|
|
710
|
-
/* @__PURE__ */
|
|
711
|
-
/* @__PURE__ */
|
|
712
|
-
/* @__PURE__ */
|
|
713
|
-
/* @__PURE__ */
|
|
714
|
-
/* @__PURE__ */
|
|
780
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
781
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: "Configuration" }),
|
|
782
|
+
/* @__PURE__ */ jsx6(Text6, { children: " " }),
|
|
783
|
+
/* @__PURE__ */ jsx6(Text6, { children: "Contentful API Credentials" }),
|
|
784
|
+
/* @__PURE__ */ jsx6(Text6, { children: " " }),
|
|
785
|
+
/* @__PURE__ */ jsx6(Box6, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
|
|
715
786
|
const isActive = activeField === field;
|
|
716
787
|
const value = fieldValue(field);
|
|
717
788
|
const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
|
|
718
|
-
return /* @__PURE__ */
|
|
719
|
-
/* @__PURE__ */
|
|
720
|
-
/* @__PURE__ */
|
|
789
|
+
return /* @__PURE__ */ jsxs6(Box6, { gap: 1, children: [
|
|
790
|
+
/* @__PURE__ */ jsx6(Text6, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
791
|
+
/* @__PURE__ */ jsxs6(Text6, { bold: isActive, children: [
|
|
721
792
|
FIELD_LABELS[field],
|
|
722
793
|
":"
|
|
723
794
|
] }),
|
|
724
|
-
/* @__PURE__ */
|
|
795
|
+
/* @__PURE__ */ jsx6(Text6, { children: display || /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "(empty)" }) })
|
|
725
796
|
] }, field);
|
|
726
797
|
}) }),
|
|
727
|
-
message && /* @__PURE__ */
|
|
728
|
-
/* @__PURE__ */
|
|
729
|
-
/* @__PURE__ */
|
|
798
|
+
message && /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
799
|
+
/* @__PURE__ */ jsx6(Text6, { children: " " }),
|
|
800
|
+
/* @__PURE__ */ jsxs6(Text6, { color: PALETTE.error, children: [
|
|
730
801
|
"\u2717 ",
|
|
731
802
|
message
|
|
732
803
|
] })
|
|
733
804
|
] }),
|
|
734
|
-
/* @__PURE__ */
|
|
735
|
-
/* @__PURE__ */
|
|
805
|
+
/* @__PURE__ */ jsx6(Text6, { children: " " }),
|
|
806
|
+
/* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "[\u2191/\u2193] Switch field \xB7 [Enter] Save/Next \xB7 [Esc/q] Back" })
|
|
736
807
|
] });
|
|
737
808
|
}
|
|
738
809
|
|
|
739
810
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
740
|
-
import { useEffect as useEffect5, useState as
|
|
741
|
-
import { Box as
|
|
811
|
+
import { useEffect as useEffect5, useState as useState6 } from "react";
|
|
812
|
+
import { Box as Box7, Text as Text7, useInput as useInput7 } from "ink";
|
|
742
813
|
|
|
743
814
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
|
|
744
815
|
async function readAnalyticsSetting() {
|
|
@@ -756,10 +827,10 @@ async function writeAnalyticsSetting(setting) {
|
|
|
756
827
|
}
|
|
757
828
|
|
|
758
829
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
759
|
-
import { Fragment as Fragment2, jsx as
|
|
830
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
760
831
|
function OptInAnalyticsScreen({ onDone }) {
|
|
761
|
-
const [loading, setLoading] =
|
|
762
|
-
const [enabled, setEnabled] =
|
|
832
|
+
const [loading, setLoading] = useState6(true);
|
|
833
|
+
const [enabled, setEnabled] = useState6(true);
|
|
763
834
|
useEffect5(() => {
|
|
764
835
|
readAnalyticsSetting().then((setting) => {
|
|
765
836
|
setEnabled(setting.enabled);
|
|
@@ -772,7 +843,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
772
843
|
});
|
|
773
844
|
});
|
|
774
845
|
}, []);
|
|
775
|
-
|
|
846
|
+
useInput7((input, key) => {
|
|
776
847
|
if (loading) return;
|
|
777
848
|
if (key.return || input === " ") {
|
|
778
849
|
setEnabled((current) => {
|
|
@@ -787,31 +858,31 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
787
858
|
onDone();
|
|
788
859
|
}
|
|
789
860
|
});
|
|
790
|
-
return /* @__PURE__ */
|
|
791
|
-
/* @__PURE__ */
|
|
792
|
-
/* @__PURE__ */
|
|
793
|
-
loading ? /* @__PURE__ */
|
|
794
|
-
/* @__PURE__ */
|
|
861
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
862
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
|
|
863
|
+
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
864
|
+
loading ? /* @__PURE__ */ jsx7(Text7, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
865
|
+
/* @__PURE__ */ jsxs7(Text7, { children: [
|
|
795
866
|
"Share anonymous usage data:",
|
|
796
867
|
" ",
|
|
797
|
-
/* @__PURE__ */
|
|
868
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
798
869
|
] }),
|
|
799
|
-
/* @__PURE__ */
|
|
800
|
-
/* @__PURE__ */
|
|
801
|
-
/* @__PURE__ */
|
|
870
|
+
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
871
|
+
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Shares which CLI commands are used and where imports succeed or fail." }),
|
|
872
|
+
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Never includes source code, file paths, credentials, or authored content." })
|
|
802
873
|
] }),
|
|
803
|
-
/* @__PURE__ */
|
|
804
|
-
/* @__PURE__ */
|
|
874
|
+
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
875
|
+
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
|
|
805
876
|
] });
|
|
806
877
|
}
|
|
807
878
|
|
|
808
879
|
// packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
|
|
809
|
-
import { useEffect as useEffect6, useState as
|
|
810
|
-
import { Box as
|
|
811
|
-
import { jsx as
|
|
880
|
+
import { useEffect as useEffect6, useState as useState7 } from "react";
|
|
881
|
+
import { Box as Box8, Text as Text8, useInput as useInput8 } from "ink";
|
|
882
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
812
883
|
var UPGRADE_COMMANDS = ["git pull", "pnpm install", "pnpm build"];
|
|
813
884
|
function UpgradeScreen({ onDone }) {
|
|
814
|
-
const [upgradeCheck, setUpgradeCheck] =
|
|
885
|
+
const [upgradeCheck, setUpgradeCheck] = useState7();
|
|
815
886
|
useEffect6(() => {
|
|
816
887
|
startDebugRun({
|
|
817
888
|
flow: "upgrade",
|
|
@@ -821,7 +892,7 @@ function UpgradeScreen({ onDone }) {
|
|
|
821
892
|
});
|
|
822
893
|
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
823
894
|
}, []);
|
|
824
|
-
|
|
895
|
+
useInput8((_input, key) => {
|
|
825
896
|
if (key.return) {
|
|
826
897
|
void finishDebugRun({
|
|
827
898
|
outputs: upgradeCheck ?? {},
|
|
@@ -832,12 +903,12 @@ function UpgradeScreen({ onDone }) {
|
|
|
832
903
|
return;
|
|
833
904
|
}
|
|
834
905
|
});
|
|
835
|
-
return /* @__PURE__ */
|
|
836
|
-
/* @__PURE__ */
|
|
837
|
-
/* @__PURE__ */
|
|
906
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
907
|
+
/* @__PURE__ */ jsx8(Text8, { bold: true, children: "Upgrade" }),
|
|
908
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
838
909
|
renderBody(upgradeCheck),
|
|
839
|
-
/* @__PURE__ */
|
|
840
|
-
/* @__PURE__ */
|
|
910
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
911
|
+
/* @__PURE__ */ jsxs8(Text8, { bold: true, color: PALETTE.accent, children: [
|
|
841
912
|
FOCUS_MARKER,
|
|
842
913
|
" Go Back"
|
|
843
914
|
] })
|
|
@@ -845,44 +916,44 @@ function UpgradeScreen({ onDone }) {
|
|
|
845
916
|
}
|
|
846
917
|
function renderBody(upgradeCheck) {
|
|
847
918
|
if (!upgradeCheck) {
|
|
848
|
-
return /* @__PURE__ */
|
|
919
|
+
return /* @__PURE__ */ jsx8(Text8, { color: PALETTE.muted, children: "Checking for updates\u2026" });
|
|
849
920
|
}
|
|
850
921
|
if (upgradeCheck.status === "error") {
|
|
851
|
-
return /* @__PURE__ */
|
|
922
|
+
return /* @__PURE__ */ jsx8(Text8, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
|
|
852
923
|
}
|
|
853
924
|
if (upgradeCheck.status === "up-to-date") {
|
|
854
|
-
return /* @__PURE__ */
|
|
925
|
+
return /* @__PURE__ */ jsxs8(Text8, { color: PALETTE.success, children: [
|
|
855
926
|
"You're already on the latest version (v",
|
|
856
927
|
upgradeCheck.current,
|
|
857
928
|
")."
|
|
858
929
|
] });
|
|
859
930
|
}
|
|
860
|
-
return /* @__PURE__ */
|
|
861
|
-
/* @__PURE__ */
|
|
862
|
-
/* @__PURE__ */
|
|
931
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
|
|
932
|
+
/* @__PURE__ */ jsxs8(Text8, { color: PALETTE.muted, children: [
|
|
933
|
+
/* @__PURE__ */ jsxs8(Text8, { bold: true, color: PALETTE.success, children: [
|
|
863
934
|
"v",
|
|
864
935
|
upgradeCheck.latest
|
|
865
936
|
] }),
|
|
866
937
|
" ",
|
|
867
938
|
"is available (you're on ",
|
|
868
|
-
/* @__PURE__ */
|
|
939
|
+
/* @__PURE__ */ jsxs8(Text8, { bold: true, children: [
|
|
869
940
|
"v",
|
|
870
941
|
upgradeCheck.current
|
|
871
942
|
] }),
|
|
872
943
|
"). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
|
|
873
944
|
] }),
|
|
874
|
-
/* @__PURE__ */
|
|
875
|
-
/* @__PURE__ */
|
|
945
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
946
|
+
/* @__PURE__ */ jsx8(Box8, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx8(Text8, { bold: true, children: cmd }, cmd)) })
|
|
876
947
|
] });
|
|
877
948
|
}
|
|
878
949
|
|
|
879
950
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
880
|
-
import { useEffect as useEffect7, useState as
|
|
881
|
-
import { Box as
|
|
882
|
-
import { jsx as
|
|
951
|
+
import { useEffect as useEffect7, useState as useState8 } from "react";
|
|
952
|
+
import { Box as Box9, Text as Text9, useInput as useInput9 } from "ink";
|
|
953
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
883
954
|
function DebugModeScreen({ onDone }) {
|
|
884
|
-
const [loading, setLoading] =
|
|
885
|
-
const [enabled, setEnabled] =
|
|
955
|
+
const [loading, setLoading] = useState8(true);
|
|
956
|
+
const [enabled, setEnabled] = useState8(true);
|
|
886
957
|
useEffect7(() => {
|
|
887
958
|
readDebugModeSetting().then((setting) => {
|
|
888
959
|
setEnabled(setting.enabled);
|
|
@@ -895,7 +966,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
895
966
|
});
|
|
896
967
|
});
|
|
897
968
|
}, []);
|
|
898
|
-
|
|
969
|
+
useInput9((input, key) => {
|
|
899
970
|
if (loading) return;
|
|
900
971
|
if (key.return || input === " ") {
|
|
901
972
|
setEnabled((current) => {
|
|
@@ -910,61 +981,59 @@ function DebugModeScreen({ onDone }) {
|
|
|
910
981
|
onDone();
|
|
911
982
|
}
|
|
912
983
|
});
|
|
913
|
-
return /* @__PURE__ */
|
|
914
|
-
/* @__PURE__ */
|
|
915
|
-
/* @__PURE__ */
|
|
916
|
-
loading ? /* @__PURE__ */
|
|
984
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
985
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, children: "Settings \u203A Debug Mode" }),
|
|
986
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
987
|
+
loading ? /* @__PURE__ */ jsx9(Text9, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs9(Text9, { children: [
|
|
917
988
|
"Debug logging:",
|
|
918
989
|
" ",
|
|
919
|
-
/* @__PURE__ */
|
|
990
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
920
991
|
] }),
|
|
921
|
-
/* @__PURE__ */
|
|
922
|
-
/* @__PURE__ */
|
|
992
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
993
|
+
/* @__PURE__ */ jsx9(Text9, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
|
|
923
994
|
] });
|
|
924
995
|
}
|
|
925
996
|
|
|
926
997
|
// packages/experience-design-system-cli/app.tsx
|
|
927
|
-
import { jsx as
|
|
998
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
928
999
|
function App({ onLaunchImport, importExitCode }) {
|
|
929
1000
|
const returnedFromImport = importExitCode !== void 0;
|
|
930
|
-
const [screen, setScreen] =
|
|
1001
|
+
const [screen, setScreen] = useState9(returnedFromImport ? "import" : "start");
|
|
1002
|
+
const [showImportResult, setShowImportResult] = useState9(returnedFromImport);
|
|
931
1003
|
const goToStart = () => setScreen("start");
|
|
932
1004
|
const goToSettings = () => setScreen("settings");
|
|
933
|
-
const
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
return;
|
|
937
|
-
}
|
|
938
|
-
setScreen(next);
|
|
1005
|
+
const finishImportResult = () => {
|
|
1006
|
+
setShowImportResult(false);
|
|
1007
|
+
goToStart();
|
|
939
1008
|
};
|
|
940
1009
|
switch (screen) {
|
|
941
1010
|
case "import":
|
|
942
|
-
return /* @__PURE__ */
|
|
1011
|
+
return showImportResult ? /* @__PURE__ */ jsx10(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult }) : /* @__PURE__ */ jsx10(WelcomeScreen, { onContinue: (projectPath) => onLaunchImport?.(projectPath), onQuit: goToStart });
|
|
943
1012
|
case "help":
|
|
944
|
-
return /* @__PURE__ */
|
|
1013
|
+
return /* @__PURE__ */ jsx10(HelpScreen, { onDone: goToStart });
|
|
945
1014
|
case "upgrade":
|
|
946
|
-
return /* @__PURE__ */
|
|
1015
|
+
return /* @__PURE__ */ jsx10(UpgradeScreen, { onDone: goToStart });
|
|
947
1016
|
case "settings":
|
|
948
|
-
return /* @__PURE__ */
|
|
1017
|
+
return /* @__PURE__ */ jsx10(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
949
1018
|
case "settings-configuration":
|
|
950
|
-
return /* @__PURE__ */
|
|
1019
|
+
return /* @__PURE__ */ jsx10(ConfigurationScreen, { onDone: goToSettings });
|
|
951
1020
|
case "settings-opt-in-analytics":
|
|
952
|
-
return /* @__PURE__ */
|
|
1021
|
+
return /* @__PURE__ */ jsx10(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
953
1022
|
case "settings-debug-mode":
|
|
954
|
-
return /* @__PURE__ */
|
|
1023
|
+
return /* @__PURE__ */ jsx10(DebugModeScreen, { onDone: goToSettings });
|
|
955
1024
|
case "start":
|
|
956
|
-
return /* @__PURE__ */
|
|
1025
|
+
return /* @__PURE__ */ jsx10(HomeScreen, { onNavigate: setScreen });
|
|
957
1026
|
}
|
|
958
1027
|
}
|
|
959
1028
|
async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
|
|
960
|
-
let
|
|
1029
|
+
let requestedProjectPath;
|
|
961
1030
|
const instance = renderApp(
|
|
962
|
-
/* @__PURE__ */
|
|
1031
|
+
/* @__PURE__ */ jsx10(
|
|
963
1032
|
App,
|
|
964
1033
|
{
|
|
965
1034
|
importExitCode,
|
|
966
|
-
onLaunchImport: () => {
|
|
967
|
-
|
|
1035
|
+
onLaunchImport: (projectPath) => {
|
|
1036
|
+
requestedProjectPath = projectPath;
|
|
968
1037
|
instance.unmount();
|
|
969
1038
|
}
|
|
970
1039
|
}
|
|
@@ -972,13 +1041,15 @@ async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
|
|
|
972
1041
|
);
|
|
973
1042
|
await instance.waitUntilExit();
|
|
974
1043
|
await stopReadingTerminal();
|
|
975
|
-
return
|
|
1044
|
+
return requestedProjectPath;
|
|
976
1045
|
}
|
|
977
1046
|
async function runApp(renderApp) {
|
|
978
1047
|
let importExitCode;
|
|
979
|
-
|
|
980
|
-
|
|
1048
|
+
let projectPath = await renderUntilImportRequestedOrExit(renderApp, importExitCode);
|
|
1049
|
+
while (projectPath !== void 0) {
|
|
1050
|
+
importExitCode = (await spawnV1Import({ project: projectPath })).exitCode;
|
|
981
1051
|
startReadingTerminal();
|
|
1052
|
+
projectPath = await renderUntilImportRequestedOrExit(renderApp, importExitCode);
|
|
982
1053
|
}
|
|
983
1054
|
}
|
|
984
1055
|
export {
|