@contentful/experience-design-system-cli 2.35.1-dev-build-7780c1f7.0 → 2.35.1-dev-build-215f38d1.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 +342 -130
- package/dist/index.js +395 -134
- package/dist/package.json +2 -1
- package/dist/src/tui/import/spawn-v1-import.d.ts +2 -0
- 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/02-token-input/controls.d.ts +11 -0
- package/dist/src/tui/import/steps/02-token-input/logic.d.ts +9 -0
- package/dist/src/tui/import/steps/02-token-input/screen.d.ts +8 -0
- package/dist/src/tui/import/steps/02-token-input/validate-path.d.ts +12 -0
- package/dist/src/tui/import/steps/index.d.ts +2 -0
- package/legacy/dist/src/import/command.d.ts +1 -1
- package/legacy/dist/src/import/tui/WizardApp.d.ts +2 -1
- package/legacy/dist/src/index.js +7 -2
- package/legacy/package.json +2 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -297,6 +297,245 @@ var init_PageContainer = __esm({
|
|
|
297
297
|
}
|
|
298
298
|
});
|
|
299
299
|
|
|
300
|
+
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/logic.ts
|
|
301
|
+
function shouldQuit(value, input, key) {
|
|
302
|
+
if (key.escape) return true;
|
|
303
|
+
return value === "" && input === "q" && !key.ctrl && !key.meta;
|
|
304
|
+
}
|
|
305
|
+
function toProjectPath(value) {
|
|
306
|
+
const projectPath = value.trim();
|
|
307
|
+
return projectPath === "" ? null : projectPath;
|
|
308
|
+
}
|
|
309
|
+
var init_logic = __esm({
|
|
310
|
+
"packages/experience-design-system-cli/src/tui/import/steps/01-welcome/logic.ts"() {
|
|
311
|
+
"use strict";
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/controls.ts
|
|
316
|
+
import { useInput as useInput3 } from "ink";
|
|
317
|
+
function useWelcomeControls(projectPath, onQuit) {
|
|
318
|
+
useInput3((input, key) => {
|
|
319
|
+
if (shouldQuit(projectPath, input, key)) onQuit();
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
var WELCOME_CONTROLS;
|
|
323
|
+
var init_controls = __esm({
|
|
324
|
+
"packages/experience-design-system-cli/src/tui/import/steps/01-welcome/controls.ts"() {
|
|
325
|
+
"use strict";
|
|
326
|
+
init_logic();
|
|
327
|
+
WELCOME_CONTROLS = [
|
|
328
|
+
{ keys: "Enter", label: "Continue" },
|
|
329
|
+
{ keys: "Esc/q", label: "Back to menu" }
|
|
330
|
+
];
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
|
|
335
|
+
import { useState as useState3 } from "react";
|
|
336
|
+
import { Box as Box3, Text as Text3 } from "ink";
|
|
337
|
+
import TextInput from "ink-text-input";
|
|
338
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
339
|
+
function WelcomeScreen({ onContinue, onQuit }) {
|
|
340
|
+
const [projectPath, setProjectPath] = useState3("");
|
|
341
|
+
useWelcomeControls(projectPath, onQuit);
|
|
342
|
+
const submit = (value) => {
|
|
343
|
+
const path = toProjectPath(value);
|
|
344
|
+
if (path) onContinue(path);
|
|
345
|
+
};
|
|
346
|
+
return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
347
|
+
/* @__PURE__ */ jsx3(Text3, { bold: true, color: PALETTE.success, children: "\u{1F44B} Hey! Let's import your design system into Contentful." }),
|
|
348
|
+
/* @__PURE__ */ jsx3(Text3, { dimColor: true, children: "I'll walk you through 5 steps to get your components into Contentful ExO." }),
|
|
349
|
+
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", marginTop: 1, children: [
|
|
350
|
+
/* @__PURE__ */ jsx3(Text3, { dimColor: true, children: RULE }),
|
|
351
|
+
OVERVIEW.map((item) => /* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
|
|
352
|
+
/* @__PURE__ */ jsx3(Text3, { bold: true, children: item.label }),
|
|
353
|
+
/* @__PURE__ */ jsx3(Text3, { dimColor: true, children: item.description })
|
|
354
|
+
] }, item.label)),
|
|
355
|
+
/* @__PURE__ */ jsx3(Text3, { dimColor: true, children: RULE })
|
|
356
|
+
] }),
|
|
357
|
+
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", marginTop: 1, children: [
|
|
358
|
+
/* @__PURE__ */ jsx3(Text3, { children: "Where is your component library?" }),
|
|
359
|
+
/* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
|
|
360
|
+
/* @__PURE__ */ jsx3(Text3, { color: PALETTE.accent, children: "?" }),
|
|
361
|
+
/* @__PURE__ */ jsx3(Text3, { children: "Project path:" }),
|
|
362
|
+
/* @__PURE__ */ jsx3(TextInput, { value: projectPath, onChange: setProjectPath, onSubmit: submit })
|
|
363
|
+
] })
|
|
364
|
+
] }),
|
|
365
|
+
/* @__PURE__ */ jsx3(Box3, { marginTop: 1, gap: 3, children: WELCOME_CONTROLS.map((control) => /* @__PURE__ */ jsxs3(Text3, { dimColor: true, children: [
|
|
366
|
+
"[",
|
|
367
|
+
control.keys,
|
|
368
|
+
"] ",
|
|
369
|
+
control.label
|
|
370
|
+
] }, control.keys)) })
|
|
371
|
+
] });
|
|
372
|
+
}
|
|
373
|
+
var RULE, OVERVIEW;
|
|
374
|
+
var init_screen = __esm({
|
|
375
|
+
"packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx"() {
|
|
376
|
+
"use strict";
|
|
377
|
+
init_home_theme();
|
|
378
|
+
init_controls();
|
|
379
|
+
init_logic();
|
|
380
|
+
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";
|
|
381
|
+
OVERVIEW = [
|
|
382
|
+
{ label: "Step 1", description: "Extract components from your codebase" },
|
|
383
|
+
{ label: "Step 2", description: "Review what was extracted" },
|
|
384
|
+
{ label: "Step 3", description: "Generate CDF definitions with Claude" },
|
|
385
|
+
{ label: "Step 4", description: "Review generated definitions" },
|
|
386
|
+
{ label: "Step 5", description: "Push to Contentful" }
|
|
387
|
+
];
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/logic.ts
|
|
392
|
+
function isPlainKeyOnEmptyField(value, input, key, expected) {
|
|
393
|
+
return value === "" && input === expected && !key.ctrl && !key.meta;
|
|
394
|
+
}
|
|
395
|
+
function shouldGoBack(value, input, key) {
|
|
396
|
+
return key.escape || isPlainKeyOnEmptyField(value, input, key, "q");
|
|
397
|
+
}
|
|
398
|
+
function shouldSkip(value, input, key) {
|
|
399
|
+
return isPlainKeyOnEmptyField(value, input, key, "s");
|
|
400
|
+
}
|
|
401
|
+
function toTokenPath(value) {
|
|
402
|
+
const tokenPath = value.trim();
|
|
403
|
+
return tokenPath === "" ? null : tokenPath;
|
|
404
|
+
}
|
|
405
|
+
var init_logic2 = __esm({
|
|
406
|
+
"packages/experience-design-system-cli/src/tui/import/steps/02-token-input/logic.ts"() {
|
|
407
|
+
"use strict";
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/controls.ts
|
|
412
|
+
import { useInput as useInput4 } from "ink";
|
|
413
|
+
function useTokenInputControls(tokenPath, onSkip, onBack) {
|
|
414
|
+
useInput4((input, key) => {
|
|
415
|
+
if (shouldGoBack(tokenPath, input, key)) onBack();
|
|
416
|
+
else if (shouldSkip(tokenPath, input, key)) onSkip();
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
var TOKEN_INPUT_CONTROLS;
|
|
420
|
+
var init_controls2 = __esm({
|
|
421
|
+
"packages/experience-design-system-cli/src/tui/import/steps/02-token-input/controls.ts"() {
|
|
422
|
+
"use strict";
|
|
423
|
+
init_logic2();
|
|
424
|
+
TOKEN_INPUT_CONTROLS = [
|
|
425
|
+
{ keys: "Enter", label: "Continue (skips if empty)" },
|
|
426
|
+
{ keys: "s", label: "Skip" },
|
|
427
|
+
{ keys: "Esc/q", label: "Back" }
|
|
428
|
+
];
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts
|
|
433
|
+
import { statSync } from "node:fs";
|
|
434
|
+
import { homedir } from "node:os";
|
|
435
|
+
import { resolve } from "node:path";
|
|
436
|
+
function stripQuotes(value) {
|
|
437
|
+
const quoted = value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'");
|
|
438
|
+
return value.length >= 2 && quoted ? value.slice(1, -1) : value;
|
|
439
|
+
}
|
|
440
|
+
function expandHome(value) {
|
|
441
|
+
return value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? homedir() + value.slice(1) : value;
|
|
442
|
+
}
|
|
443
|
+
function validateTokenPath(rawPath) {
|
|
444
|
+
const path = resolve(expandHome(stripQuotes(rawPath.trim())));
|
|
445
|
+
let stats;
|
|
446
|
+
try {
|
|
447
|
+
stats = statSync(path);
|
|
448
|
+
} catch {
|
|
449
|
+
return { ok: false, error: `Path not found: ${path}`, resolvedPath: path };
|
|
450
|
+
}
|
|
451
|
+
if (stats.isDirectory()) {
|
|
452
|
+
return {
|
|
453
|
+
ok: false,
|
|
454
|
+
error: "That's a directory \u2014 provide a path to a token file (e.g. tokens.json), not a folder.",
|
|
455
|
+
resolvedPath: path
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
if (!stats.isFile()) {
|
|
459
|
+
return { ok: false, error: `Not a regular file: ${path}`, resolvedPath: path };
|
|
460
|
+
}
|
|
461
|
+
return { ok: true, path };
|
|
462
|
+
}
|
|
463
|
+
var init_validate_path = __esm({
|
|
464
|
+
"packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts"() {
|
|
465
|
+
"use strict";
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
|
|
470
|
+
import { useState as useState4 } from "react";
|
|
471
|
+
import { Box as Box4, Text as Text4 } from "ink";
|
|
472
|
+
import TextInput2 from "ink-text-input";
|
|
473
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
474
|
+
function TokenInputScreen({ onConfirm, onSkip, onBack }) {
|
|
475
|
+
const [tokenPath, setTokenPath] = useState4("");
|
|
476
|
+
const [failure, setFailure] = useState4(null);
|
|
477
|
+
useTokenInputControls(tokenPath, onSkip, onBack);
|
|
478
|
+
const change = (value) => {
|
|
479
|
+
setTokenPath(value);
|
|
480
|
+
setFailure(null);
|
|
481
|
+
};
|
|
482
|
+
const submit = (value) => {
|
|
483
|
+
const rawPath = toTokenPath(value);
|
|
484
|
+
if (!rawPath) {
|
|
485
|
+
onSkip();
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
const check = validateTokenPath(rawPath);
|
|
489
|
+
if (check.ok) onConfirm(check.path);
|
|
490
|
+
else setFailure({ error: check.error, resolvedPath: check.resolvedPath });
|
|
491
|
+
};
|
|
492
|
+
return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
493
|
+
/* @__PURE__ */ jsx4(Text4, { bold: true, children: "Design tokens" }),
|
|
494
|
+
/* @__PURE__ */ jsx4(Text4, { dimColor: true, children: "Point me to your raw token file (e.g. ~/design-tokens/tokens.json). You can use ~, relative, or absolute paths. Claude will map it to DTCG format." }),
|
|
495
|
+
/* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
|
|
496
|
+
/* @__PURE__ */ jsxs4(Box4, { gap: 1, children: [
|
|
497
|
+
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.accent, children: "?" }),
|
|
498
|
+
/* @__PURE__ */ jsx4(Text4, { children: "Token path:" }),
|
|
499
|
+
/* @__PURE__ */ jsx4(TextInput2, { value: tokenPath, onChange: change, onSubmit: submit })
|
|
500
|
+
] }),
|
|
501
|
+
failure && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
|
|
502
|
+
/* @__PURE__ */ jsxs4(Text4, { color: PALETTE.error, children: [
|
|
503
|
+
"\u2717 ",
|
|
504
|
+
failure.error
|
|
505
|
+
] }),
|
|
506
|
+
/* @__PURE__ */ jsxs4(Text4, { dimColor: true, children: [
|
|
507
|
+
" Resolved to: ",
|
|
508
|
+
failure.resolvedPath
|
|
509
|
+
] })
|
|
510
|
+
] })
|
|
511
|
+
] }),
|
|
512
|
+
/* @__PURE__ */ jsx4(Box4, { marginTop: 1, gap: 3, children: TOKEN_INPUT_CONTROLS.map((control) => /* @__PURE__ */ jsxs4(Text4, { dimColor: true, children: [
|
|
513
|
+
"[",
|
|
514
|
+
control.keys,
|
|
515
|
+
"] ",
|
|
516
|
+
control.label
|
|
517
|
+
] }, control.keys)) })
|
|
518
|
+
] });
|
|
519
|
+
}
|
|
520
|
+
var init_screen2 = __esm({
|
|
521
|
+
"packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx"() {
|
|
522
|
+
"use strict";
|
|
523
|
+
init_home_theme();
|
|
524
|
+
init_controls2();
|
|
525
|
+
init_logic2();
|
|
526
|
+
init_validate_path();
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
// packages/experience-design-system-cli/src/tui/import/steps/index.ts
|
|
531
|
+
var init_steps = __esm({
|
|
532
|
+
"packages/experience-design-system-cli/src/tui/import/steps/index.ts"() {
|
|
533
|
+
"use strict";
|
|
534
|
+
init_screen();
|
|
535
|
+
init_screen2();
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
|
|
300
539
|
// packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts
|
|
301
540
|
import { spawn as spawn2 } from "node:child_process";
|
|
302
541
|
function buildArgs(options) {
|
|
@@ -304,6 +543,12 @@ function buildArgs(options) {
|
|
|
304
543
|
if (options.project) {
|
|
305
544
|
args.push("--project", options.project);
|
|
306
545
|
}
|
|
546
|
+
if (options.tokens) {
|
|
547
|
+
args.push("--tokens", options.tokens);
|
|
548
|
+
}
|
|
549
|
+
if (options.skipTokenPrompt) {
|
|
550
|
+
args.push("--skip-token-prompt");
|
|
551
|
+
}
|
|
307
552
|
return args;
|
|
308
553
|
}
|
|
309
554
|
async function spawnV1Import(options = {}) {
|
|
@@ -333,7 +578,7 @@ function getTerminalHandle() {
|
|
|
333
578
|
return process.stdin._handle;
|
|
334
579
|
}
|
|
335
580
|
async function stopReadingTerminal() {
|
|
336
|
-
await new Promise((
|
|
581
|
+
await new Promise((resolve2) => setImmediate(resolve2));
|
|
337
582
|
const handle = getTerminalHandle();
|
|
338
583
|
if (!handle?.readStop) return;
|
|
339
584
|
handle.reading = false;
|
|
@@ -537,8 +782,8 @@ var init_debug_store = __esm({
|
|
|
537
782
|
|
|
538
783
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
539
784
|
import { useEffect as useEffect3 } from "react";
|
|
540
|
-
import { Box as
|
|
541
|
-
import { jsx as
|
|
785
|
+
import { Box as Box5, Text as Text5, useInput as useInput5 } from "ink";
|
|
786
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
542
787
|
function HelpScreen({ onDone }) {
|
|
543
788
|
useEffect3(() => {
|
|
544
789
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
@@ -547,7 +792,7 @@ function HelpScreen({ onDone }) {
|
|
|
547
792
|
void finishDebugRun({ outputs: {}, status: "success", exitMethod });
|
|
548
793
|
onDone();
|
|
549
794
|
};
|
|
550
|
-
|
|
795
|
+
useInput5((input, key) => {
|
|
551
796
|
if (key.return) {
|
|
552
797
|
leave("saved");
|
|
553
798
|
return;
|
|
@@ -557,12 +802,12 @@ function HelpScreen({ onDone }) {
|
|
|
557
802
|
return;
|
|
558
803
|
}
|
|
559
804
|
});
|
|
560
|
-
return /* @__PURE__ */
|
|
561
|
-
/* @__PURE__ */
|
|
562
|
-
/* @__PURE__ */
|
|
563
|
-
/* @__PURE__ */
|
|
564
|
-
/* @__PURE__ */
|
|
565
|
-
/* @__PURE__ */
|
|
805
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
806
|
+
/* @__PURE__ */ jsx5(Text5, { bold: true, children: "Help" }),
|
|
807
|
+
/* @__PURE__ */ jsx5(Text5, { children: " " }),
|
|
808
|
+
/* @__PURE__ */ jsx5(Text5, { children: "This is a placeholder screen for v2 help content." }),
|
|
809
|
+
/* @__PURE__ */ jsx5(Text5, { children: " " }),
|
|
810
|
+
/* @__PURE__ */ jsx5(Text5, { dimColor: true, children: "[Enter] Complete [Esc/q] Exit \u2014 both return to Start" })
|
|
566
811
|
] });
|
|
567
812
|
}
|
|
568
813
|
var init_PageContainer2 = __esm({
|
|
@@ -573,20 +818,20 @@ var init_PageContainer2 = __esm({
|
|
|
573
818
|
});
|
|
574
819
|
|
|
575
820
|
// packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
|
|
576
|
-
import { useState as
|
|
577
|
-
import { Box as
|
|
578
|
-
import { jsx as
|
|
821
|
+
import { useState as useState5 } from "react";
|
|
822
|
+
import { Box as Box6, Text as Text6, useInput as useInput6 } from "ink";
|
|
823
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
579
824
|
function SettingsScreen({
|
|
580
825
|
onNavigate,
|
|
581
826
|
onBack
|
|
582
827
|
}) {
|
|
583
|
-
const [focusIdx, setFocusIdx] =
|
|
828
|
+
const [focusIdx, setFocusIdx] = useState5(0);
|
|
584
829
|
const items = [
|
|
585
830
|
{ label: "Configuration", screen: "settings-configuration" },
|
|
586
831
|
{ label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
|
|
587
832
|
{ label: "Debug Mode", screen: "settings-debug-mode" }
|
|
588
833
|
];
|
|
589
|
-
|
|
834
|
+
useInput6((input, key) => {
|
|
590
835
|
if (key.upArrow) {
|
|
591
836
|
setFocusIdx((i) => (i - 1 + items.length) % items.length);
|
|
592
837
|
return;
|
|
@@ -606,15 +851,15 @@ function SettingsScreen({
|
|
|
606
851
|
onBack();
|
|
607
852
|
}
|
|
608
853
|
});
|
|
609
|
-
return /* @__PURE__ */
|
|
610
|
-
/* @__PURE__ */
|
|
611
|
-
/* @__PURE__ */
|
|
612
|
-
items.map((item, i) => /* @__PURE__ */
|
|
854
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
855
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: "Settings" }),
|
|
856
|
+
/* @__PURE__ */ jsx6(Text6, { children: " " }),
|
|
857
|
+
items.map((item, i) => /* @__PURE__ */ jsxs6(Text6, { color: i === focusIdx ? "cyan" : void 0, children: [
|
|
613
858
|
i === focusIdx ? "> " : " ",
|
|
614
859
|
item.label
|
|
615
860
|
] }, item.label)),
|
|
616
|
-
/* @__PURE__ */
|
|
617
|
-
/* @__PURE__ */
|
|
861
|
+
/* @__PURE__ */ jsx6(Text6, { children: " " }),
|
|
862
|
+
/* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "[\u2191/\u2193] Navigate [Enter] Select [Esc/q] Back to Start" })
|
|
618
863
|
] });
|
|
619
864
|
}
|
|
620
865
|
var init_PageContainer3 = __esm({
|
|
@@ -626,7 +871,7 @@ var init_PageContainer3 = __esm({
|
|
|
626
871
|
// packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
|
|
627
872
|
import { readFile as readFile2, writeFile as writeFile3, mkdir as mkdir3 } from "node:fs/promises";
|
|
628
873
|
import { join as join6 } from "node:path";
|
|
629
|
-
import { homedir } from "node:os";
|
|
874
|
+
import { homedir as homedir2 } from "node:os";
|
|
630
875
|
async function readV1Store() {
|
|
631
876
|
try {
|
|
632
877
|
const raw = await readFile2(V1_STORE_PATH, "utf8");
|
|
@@ -636,7 +881,7 @@ async function readV1Store() {
|
|
|
636
881
|
}
|
|
637
882
|
}
|
|
638
883
|
async function writeV1Store(data) {
|
|
639
|
-
await mkdir3(join6(
|
|
884
|
+
await mkdir3(join6(homedir2(), ".config", "experiences"), { recursive: true });
|
|
640
885
|
await writeFile3(V1_STORE_PATH, `${JSON.stringify(data, null, 2)}
|
|
641
886
|
`, { mode: 384 });
|
|
642
887
|
}
|
|
@@ -644,7 +889,7 @@ var V1_STORE_PATH;
|
|
|
644
889
|
var init_v1_store = __esm({
|
|
645
890
|
"packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts"() {
|
|
646
891
|
"use strict";
|
|
647
|
-
V1_STORE_PATH = join6(
|
|
892
|
+
V1_STORE_PATH = join6(homedir2(), ".config", "experiences", "credentials.json");
|
|
648
893
|
}
|
|
649
894
|
});
|
|
650
895
|
|
|
@@ -677,9 +922,9 @@ var init_config_store = __esm({
|
|
|
677
922
|
});
|
|
678
923
|
|
|
679
924
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
680
|
-
import { useEffect as useEffect4, useState as
|
|
681
|
-
import { Box as
|
|
682
|
-
import { Fragment, jsx as
|
|
925
|
+
import { useEffect as useEffect4, useState as useState6 } from "react";
|
|
926
|
+
import { Box as Box7, Text as Text7, useInput as useInput7 } from "ink";
|
|
927
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
683
928
|
function debugFields(config) {
|
|
684
929
|
return {
|
|
685
930
|
space_id: config?.spaceId ?? "",
|
|
@@ -689,10 +934,10 @@ function debugFields(config) {
|
|
|
689
934
|
};
|
|
690
935
|
}
|
|
691
936
|
function ConfigurationScreen({ onDone }) {
|
|
692
|
-
const [stage, setStage] =
|
|
693
|
-
const [config, setConfig] =
|
|
694
|
-
const [activeField, setActiveField] =
|
|
695
|
-
const [message, setMessage] =
|
|
937
|
+
const [stage, setStage] = useState6("loading");
|
|
938
|
+
const [config, setConfig] = useState6(null);
|
|
939
|
+
const [activeField, setActiveField] = useState6("spaceId");
|
|
940
|
+
const [message, setMessage] = useState6(null);
|
|
696
941
|
useEffect4(() => {
|
|
697
942
|
readCredentials().then((cfg) => {
|
|
698
943
|
setConfig(cfg);
|
|
@@ -725,7 +970,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
725
970
|
setStage("form");
|
|
726
971
|
});
|
|
727
972
|
}
|
|
728
|
-
|
|
973
|
+
useInput7((input, key) => {
|
|
729
974
|
if (stage === "loading" || stage === "saving") return;
|
|
730
975
|
if (stage === "saved") {
|
|
731
976
|
if (key.return || key.escape || input === "q") {
|
|
@@ -768,51 +1013,51 @@ function ConfigurationScreen({ onDone }) {
|
|
|
768
1013
|
}
|
|
769
1014
|
});
|
|
770
1015
|
if (stage === "loading") {
|
|
771
|
-
return /* @__PURE__ */
|
|
772
|
-
/* @__PURE__ */
|
|
773
|
-
/* @__PURE__ */
|
|
774
|
-
/* @__PURE__ */
|
|
1016
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1017
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
|
|
1018
|
+
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
1019
|
+
/* @__PURE__ */ jsx7(Text7, { color: PALETTE.accent, children: "Loading..." })
|
|
775
1020
|
] });
|
|
776
1021
|
}
|
|
777
1022
|
if (stage === "saved") {
|
|
778
|
-
return /* @__PURE__ */
|
|
779
|
-
/* @__PURE__ */
|
|
780
|
-
/* @__PURE__ */
|
|
781
|
-
/* @__PURE__ */
|
|
1023
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1024
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
|
|
1025
|
+
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
1026
|
+
/* @__PURE__ */ jsxs7(Text7, { color: PALETTE.success, children: [
|
|
782
1027
|
"\u2713 ",
|
|
783
1028
|
message
|
|
784
1029
|
] }),
|
|
785
|
-
/* @__PURE__ */
|
|
786
|
-
/* @__PURE__ */
|
|
1030
|
+
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
1031
|
+
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "[Enter] Back to Settings" })
|
|
787
1032
|
] });
|
|
788
1033
|
}
|
|
789
|
-
return /* @__PURE__ */
|
|
790
|
-
/* @__PURE__ */
|
|
791
|
-
/* @__PURE__ */
|
|
792
|
-
/* @__PURE__ */
|
|
793
|
-
/* @__PURE__ */
|
|
794
|
-
/* @__PURE__ */
|
|
1034
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1035
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
|
|
1036
|
+
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
1037
|
+
/* @__PURE__ */ jsx7(Text7, { children: "Contentful API Credentials" }),
|
|
1038
|
+
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
1039
|
+
/* @__PURE__ */ jsx7(Box7, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
|
|
795
1040
|
const isActive = activeField === field;
|
|
796
1041
|
const value = fieldValue(field);
|
|
797
1042
|
const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
|
|
798
|
-
return /* @__PURE__ */
|
|
799
|
-
/* @__PURE__ */
|
|
800
|
-
/* @__PURE__ */
|
|
1043
|
+
return /* @__PURE__ */ jsxs7(Box7, { gap: 1, children: [
|
|
1044
|
+
/* @__PURE__ */ jsx7(Text7, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
1045
|
+
/* @__PURE__ */ jsxs7(Text7, { bold: isActive, children: [
|
|
801
1046
|
FIELD_LABELS[field],
|
|
802
1047
|
":"
|
|
803
1048
|
] }),
|
|
804
|
-
/* @__PURE__ */
|
|
1049
|
+
/* @__PURE__ */ jsx7(Text7, { children: display || /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "(empty)" }) })
|
|
805
1050
|
] }, field);
|
|
806
1051
|
}) }),
|
|
807
|
-
message && /* @__PURE__ */
|
|
808
|
-
/* @__PURE__ */
|
|
809
|
-
/* @__PURE__ */
|
|
1052
|
+
message && /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
1053
|
+
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
1054
|
+
/* @__PURE__ */ jsxs7(Text7, { color: PALETTE.error, children: [
|
|
810
1055
|
"\u2717 ",
|
|
811
1056
|
message
|
|
812
1057
|
] })
|
|
813
1058
|
] }),
|
|
814
|
-
/* @__PURE__ */
|
|
815
|
-
/* @__PURE__ */
|
|
1059
|
+
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
1060
|
+
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "[\u2191/\u2193] Switch field \xB7 [Enter] Save/Next \xB7 [Esc/q] Back" })
|
|
816
1061
|
] });
|
|
817
1062
|
}
|
|
818
1063
|
var FIELD_ORDER, FIELD_LABELS;
|
|
@@ -854,12 +1099,12 @@ var init_analytics_store = __esm({
|
|
|
854
1099
|
});
|
|
855
1100
|
|
|
856
1101
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
857
|
-
import { useEffect as useEffect5, useState as
|
|
858
|
-
import { Box as
|
|
859
|
-
import { Fragment as Fragment2, jsx as
|
|
1102
|
+
import { useEffect as useEffect5, useState as useState7 } from "react";
|
|
1103
|
+
import { Box as Box8, Text as Text8, useInput as useInput8 } from "ink";
|
|
1104
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
860
1105
|
function OptInAnalyticsScreen({ onDone }) {
|
|
861
|
-
const [loading, setLoading] =
|
|
862
|
-
const [enabled, setEnabled] =
|
|
1106
|
+
const [loading, setLoading] = useState7(true);
|
|
1107
|
+
const [enabled, setEnabled] = useState7(true);
|
|
863
1108
|
useEffect5(() => {
|
|
864
1109
|
readAnalyticsSetting().then((setting) => {
|
|
865
1110
|
setEnabled(setting.enabled);
|
|
@@ -872,7 +1117,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
872
1117
|
});
|
|
873
1118
|
});
|
|
874
1119
|
}, []);
|
|
875
|
-
|
|
1120
|
+
useInput8((input, key) => {
|
|
876
1121
|
if (loading) return;
|
|
877
1122
|
if (key.return || input === " ") {
|
|
878
1123
|
setEnabled((current) => {
|
|
@@ -887,24 +1132,24 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
887
1132
|
onDone();
|
|
888
1133
|
}
|
|
889
1134
|
});
|
|
890
|
-
return /* @__PURE__ */
|
|
891
|
-
/* @__PURE__ */
|
|
892
|
-
/* @__PURE__ */
|
|
893
|
-
loading ? /* @__PURE__ */
|
|
894
|
-
/* @__PURE__ */
|
|
1135
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1136
|
+
/* @__PURE__ */ jsx8(Text8, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
|
|
1137
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
1138
|
+
loading ? /* @__PURE__ */ jsx8(Text8, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
1139
|
+
/* @__PURE__ */ jsxs8(Text8, { children: [
|
|
895
1140
|
"Share anonymous usage data:",
|
|
896
1141
|
" ",
|
|
897
|
-
/* @__PURE__ */
|
|
1142
|
+
/* @__PURE__ */ jsx8(Text8, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
898
1143
|
] }),
|
|
899
|
-
/* @__PURE__ */
|
|
900
|
-
/* @__PURE__ */
|
|
901
|
-
/* @__PURE__ */
|
|
1144
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
1145
|
+
/* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "Shares which CLI commands are used and where imports succeed or fail." }),
|
|
1146
|
+
/* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "Never includes source code, file paths, credentials, or authored content." })
|
|
902
1147
|
] }),
|
|
903
|
-
/* @__PURE__ */
|
|
904
|
-
/* @__PURE__ */
|
|
1148
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
1149
|
+
/* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
|
|
905
1150
|
] });
|
|
906
1151
|
}
|
|
907
|
-
var
|
|
1152
|
+
var init_screen3 = __esm({
|
|
908
1153
|
"packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx"() {
|
|
909
1154
|
"use strict";
|
|
910
1155
|
init_home_theme();
|
|
@@ -914,11 +1159,11 @@ var init_screen = __esm({
|
|
|
914
1159
|
});
|
|
915
1160
|
|
|
916
1161
|
// packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
|
|
917
|
-
import { useEffect as useEffect6, useState as
|
|
918
|
-
import { Box as
|
|
919
|
-
import { jsx as
|
|
1162
|
+
import { useEffect as useEffect6, useState as useState8 } from "react";
|
|
1163
|
+
import { Box as Box9, Text as Text9, useInput as useInput9 } from "ink";
|
|
1164
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
920
1165
|
function UpgradeScreen({ onDone }) {
|
|
921
|
-
const [upgradeCheck, setUpgradeCheck] =
|
|
1166
|
+
const [upgradeCheck, setUpgradeCheck] = useState8();
|
|
922
1167
|
useEffect6(() => {
|
|
923
1168
|
startDebugRun({
|
|
924
1169
|
flow: "upgrade",
|
|
@@ -928,7 +1173,7 @@ function UpgradeScreen({ onDone }) {
|
|
|
928
1173
|
});
|
|
929
1174
|
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
930
1175
|
}, []);
|
|
931
|
-
|
|
1176
|
+
useInput9((_input, key) => {
|
|
932
1177
|
if (key.return) {
|
|
933
1178
|
void finishDebugRun({
|
|
934
1179
|
outputs: upgradeCheck ?? {},
|
|
@@ -939,12 +1184,12 @@ function UpgradeScreen({ onDone }) {
|
|
|
939
1184
|
return;
|
|
940
1185
|
}
|
|
941
1186
|
});
|
|
942
|
-
return /* @__PURE__ */
|
|
943
|
-
/* @__PURE__ */
|
|
944
|
-
/* @__PURE__ */
|
|
1187
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1188
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, children: "Upgrade" }),
|
|
1189
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
945
1190
|
renderBody(upgradeCheck),
|
|
946
|
-
/* @__PURE__ */
|
|
947
|
-
/* @__PURE__ */
|
|
1191
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1192
|
+
/* @__PURE__ */ jsxs9(Text9, { bold: true, color: PALETTE.accent, children: [
|
|
948
1193
|
FOCUS_MARKER,
|
|
949
1194
|
" Go Back"
|
|
950
1195
|
] })
|
|
@@ -952,34 +1197,34 @@ function UpgradeScreen({ onDone }) {
|
|
|
952
1197
|
}
|
|
953
1198
|
function renderBody(upgradeCheck) {
|
|
954
1199
|
if (!upgradeCheck) {
|
|
955
|
-
return /* @__PURE__ */
|
|
1200
|
+
return /* @__PURE__ */ jsx9(Text9, { color: PALETTE.muted, children: "Checking for updates\u2026" });
|
|
956
1201
|
}
|
|
957
1202
|
if (upgradeCheck.status === "error") {
|
|
958
|
-
return /* @__PURE__ */
|
|
1203
|
+
return /* @__PURE__ */ jsx9(Text9, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
|
|
959
1204
|
}
|
|
960
1205
|
if (upgradeCheck.status === "up-to-date") {
|
|
961
|
-
return /* @__PURE__ */
|
|
1206
|
+
return /* @__PURE__ */ jsxs9(Text9, { color: PALETTE.success, children: [
|
|
962
1207
|
"You're already on the latest version (v",
|
|
963
1208
|
upgradeCheck.current,
|
|
964
1209
|
")."
|
|
965
1210
|
] });
|
|
966
1211
|
}
|
|
967
|
-
return /* @__PURE__ */
|
|
968
|
-
/* @__PURE__ */
|
|
969
|
-
/* @__PURE__ */
|
|
1212
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", children: [
|
|
1213
|
+
/* @__PURE__ */ jsxs9(Text9, { color: PALETTE.muted, children: [
|
|
1214
|
+
/* @__PURE__ */ jsxs9(Text9, { bold: true, color: PALETTE.success, children: [
|
|
970
1215
|
"v",
|
|
971
1216
|
upgradeCheck.latest
|
|
972
1217
|
] }),
|
|
973
1218
|
" ",
|
|
974
1219
|
"is available (you're on ",
|
|
975
|
-
/* @__PURE__ */
|
|
1220
|
+
/* @__PURE__ */ jsxs9(Text9, { bold: true, children: [
|
|
976
1221
|
"v",
|
|
977
1222
|
upgradeCheck.current
|
|
978
1223
|
] }),
|
|
979
1224
|
"). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
|
|
980
1225
|
] }),
|
|
981
|
-
/* @__PURE__ */
|
|
982
|
-
/* @__PURE__ */
|
|
1226
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1227
|
+
/* @__PURE__ */ jsx9(Box9, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx9(Text9, { bold: true, children: cmd }, cmd)) })
|
|
983
1228
|
] });
|
|
984
1229
|
}
|
|
985
1230
|
var UPGRADE_COMMANDS;
|
|
@@ -994,12 +1239,12 @@ var init_PageContainer4 = __esm({
|
|
|
994
1239
|
});
|
|
995
1240
|
|
|
996
1241
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
997
|
-
import { useEffect as useEffect7, useState as
|
|
998
|
-
import { Box as
|
|
999
|
-
import { jsx as
|
|
1242
|
+
import { useEffect as useEffect7, useState as useState9 } from "react";
|
|
1243
|
+
import { Box as Box10, Text as Text10, useInput as useInput10 } from "ink";
|
|
1244
|
+
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1000
1245
|
function DebugModeScreen({ onDone }) {
|
|
1001
|
-
const [loading, setLoading] =
|
|
1002
|
-
const [enabled, setEnabled] =
|
|
1246
|
+
const [loading, setLoading] = useState9(true);
|
|
1247
|
+
const [enabled, setEnabled] = useState9(true);
|
|
1003
1248
|
useEffect7(() => {
|
|
1004
1249
|
readDebugModeSetting().then((setting) => {
|
|
1005
1250
|
setEnabled(setting.enabled);
|
|
@@ -1012,7 +1257,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
1012
1257
|
});
|
|
1013
1258
|
});
|
|
1014
1259
|
}, []);
|
|
1015
|
-
|
|
1260
|
+
useInput10((input, key) => {
|
|
1016
1261
|
if (loading) return;
|
|
1017
1262
|
if (key.return || input === " ") {
|
|
1018
1263
|
setEnabled((current) => {
|
|
@@ -1027,19 +1272,19 @@ function DebugModeScreen({ onDone }) {
|
|
|
1027
1272
|
onDone();
|
|
1028
1273
|
}
|
|
1029
1274
|
});
|
|
1030
|
-
return /* @__PURE__ */
|
|
1031
|
-
/* @__PURE__ */
|
|
1032
|
-
/* @__PURE__ */
|
|
1033
|
-
loading ? /* @__PURE__ */
|
|
1275
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1276
|
+
/* @__PURE__ */ jsx10(Text10, { bold: true, children: "Settings \u203A Debug Mode" }),
|
|
1277
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1278
|
+
loading ? /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs10(Text10, { children: [
|
|
1034
1279
|
"Debug logging:",
|
|
1035
1280
|
" ",
|
|
1036
|
-
/* @__PURE__ */
|
|
1281
|
+
/* @__PURE__ */ jsx10(Text10, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
1037
1282
|
] }),
|
|
1038
|
-
/* @__PURE__ */
|
|
1039
|
-
/* @__PURE__ */
|
|
1283
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1284
|
+
/* @__PURE__ */ jsx10(Text10, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
|
|
1040
1285
|
] });
|
|
1041
1286
|
}
|
|
1042
|
-
var
|
|
1287
|
+
var init_screen4 = __esm({
|
|
1043
1288
|
"packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx"() {
|
|
1044
1289
|
"use strict";
|
|
1045
1290
|
init_home_theme();
|
|
@@ -1053,48 +1298,61 @@ var app_exports = {};
|
|
|
1053
1298
|
__export(app_exports, {
|
|
1054
1299
|
runApp: () => runApp
|
|
1055
1300
|
});
|
|
1056
|
-
import { useState as
|
|
1057
|
-
import { jsx as
|
|
1301
|
+
import { useState as useState10 } from "react";
|
|
1302
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1058
1303
|
function App({ onLaunchImport, importExitCode }) {
|
|
1059
1304
|
const returnedFromImport = importExitCode !== void 0;
|
|
1060
|
-
const [screen, setScreen] =
|
|
1305
|
+
const [screen, setScreen] = useState10(returnedFromImport ? "import" : "start");
|
|
1306
|
+
const [showImportResult, setShowImportResult] = useState10(returnedFromImport);
|
|
1307
|
+
const [projectPath, setProjectPath] = useState10();
|
|
1061
1308
|
const goToStart = () => setScreen("start");
|
|
1062
1309
|
const goToSettings = () => setScreen("settings");
|
|
1063
|
-
const
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1310
|
+
const finishImportResult = () => {
|
|
1311
|
+
setShowImportResult(false);
|
|
1312
|
+
setProjectPath(void 0);
|
|
1313
|
+
goToStart();
|
|
1314
|
+
};
|
|
1315
|
+
const leaveImport = () => {
|
|
1316
|
+
setProjectPath(void 0);
|
|
1317
|
+
goToStart();
|
|
1069
1318
|
};
|
|
1070
1319
|
switch (screen) {
|
|
1071
1320
|
case "import":
|
|
1072
|
-
return /* @__PURE__ */
|
|
1321
|
+
if (showImportResult) return /* @__PURE__ */ jsx11(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
|
|
1322
|
+
if (projectPath === void 0) return /* @__PURE__ */ jsx11(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport });
|
|
1323
|
+
return /* @__PURE__ */ jsx11(
|
|
1324
|
+
TokenInputScreen,
|
|
1325
|
+
{
|
|
1326
|
+
onConfirm: (tokens) => onLaunchImport?.({ project: projectPath, tokens }),
|
|
1327
|
+
onSkip: () => onLaunchImport?.({ project: projectPath, skipTokenPrompt: true }),
|
|
1328
|
+
onBack: () => setProjectPath(void 0)
|
|
1329
|
+
}
|
|
1330
|
+
);
|
|
1073
1331
|
case "help":
|
|
1074
|
-
return /* @__PURE__ */
|
|
1332
|
+
return /* @__PURE__ */ jsx11(HelpScreen, { onDone: goToStart });
|
|
1075
1333
|
case "upgrade":
|
|
1076
|
-
return /* @__PURE__ */
|
|
1334
|
+
return /* @__PURE__ */ jsx11(UpgradeScreen, { onDone: goToStart });
|
|
1077
1335
|
case "settings":
|
|
1078
|
-
return /* @__PURE__ */
|
|
1336
|
+
return /* @__PURE__ */ jsx11(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
1079
1337
|
case "settings-configuration":
|
|
1080
|
-
return /* @__PURE__ */
|
|
1338
|
+
return /* @__PURE__ */ jsx11(ConfigurationScreen, { onDone: goToSettings });
|
|
1081
1339
|
case "settings-opt-in-analytics":
|
|
1082
|
-
return /* @__PURE__ */
|
|
1340
|
+
return /* @__PURE__ */ jsx11(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
1083
1341
|
case "settings-debug-mode":
|
|
1084
|
-
return /* @__PURE__ */
|
|
1342
|
+
return /* @__PURE__ */ jsx11(DebugModeScreen, { onDone: goToSettings });
|
|
1085
1343
|
case "start":
|
|
1086
|
-
return /* @__PURE__ */
|
|
1344
|
+
return /* @__PURE__ */ jsx11(HomeScreen, { onNavigate: setScreen });
|
|
1087
1345
|
}
|
|
1088
1346
|
}
|
|
1089
1347
|
async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
|
|
1090
|
-
let
|
|
1348
|
+
let requestedImport;
|
|
1091
1349
|
const instance = renderApp(
|
|
1092
|
-
/* @__PURE__ */
|
|
1350
|
+
/* @__PURE__ */ jsx11(
|
|
1093
1351
|
App,
|
|
1094
1352
|
{
|
|
1095
1353
|
importExitCode,
|
|
1096
|
-
onLaunchImport: () => {
|
|
1097
|
-
|
|
1354
|
+
onLaunchImport: (options) => {
|
|
1355
|
+
requestedImport = options;
|
|
1098
1356
|
instance.unmount();
|
|
1099
1357
|
}
|
|
1100
1358
|
}
|
|
@@ -1102,13 +1360,15 @@ async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
|
|
|
1102
1360
|
);
|
|
1103
1361
|
await instance.waitUntilExit();
|
|
1104
1362
|
await stopReadingTerminal();
|
|
1105
|
-
return
|
|
1363
|
+
return requestedImport;
|
|
1106
1364
|
}
|
|
1107
1365
|
async function runApp(renderApp) {
|
|
1108
1366
|
let importExitCode;
|
|
1109
|
-
|
|
1110
|
-
|
|
1367
|
+
let requestedImport = await renderUntilImportRequestedOrExit(renderApp, importExitCode);
|
|
1368
|
+
while (requestedImport !== void 0) {
|
|
1369
|
+
importExitCode = (await spawnV1Import(requestedImport)).exitCode;
|
|
1111
1370
|
startReadingTerminal();
|
|
1371
|
+
requestedImport = await renderUntilImportRequestedOrExit(renderApp, importExitCode);
|
|
1112
1372
|
}
|
|
1113
1373
|
}
|
|
1114
1374
|
var init_app = __esm({
|
|
@@ -1116,14 +1376,15 @@ var init_app = __esm({
|
|
|
1116
1376
|
"use strict";
|
|
1117
1377
|
init_home();
|
|
1118
1378
|
init_PageContainer();
|
|
1379
|
+
init_steps();
|
|
1119
1380
|
init_spawn_v1_import();
|
|
1120
1381
|
init_terminal_input();
|
|
1121
1382
|
init_PageContainer2();
|
|
1122
1383
|
init_PageContainer3();
|
|
1123
1384
|
init_ContentfulConfigScreen();
|
|
1124
|
-
|
|
1385
|
+
init_screen3();
|
|
1125
1386
|
init_PageContainer4();
|
|
1126
|
-
|
|
1387
|
+
init_screen4();
|
|
1127
1388
|
}
|
|
1128
1389
|
});
|
|
1129
1390
|
|