@contentful/experience-design-system-cli 2.35.1-dev-build-fa950e44.0 → 2.35.1-dev-build-236b6909.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 +127 -262
- package/dist/index.js +131 -289
- package/dist/package.json +1 -1
- package/dist/src/tui/import/spawn-v1-import.d.ts +0 -1
- package/dist/src/tui/import/steps/index.d.ts +0 -1
- package/legacy/dist/src/analyze/controller/run-analyze-extract.d.ts +12 -0
- package/legacy/dist/src/analyze/extract-command.d.ts +2 -5
- package/legacy/dist/src/analyze/helpers/resolve-composition-agent.d.ts +9 -0
- package/legacy/dist/src/analyze/helpers/resolve-no-cache.d.ts +4 -0
- package/legacy/dist/src/analyze/helpers/resolve-unreachable-mode.d.ts +1 -0
- package/legacy/dist/src/analyze/helpers/retry-db-write.d.ts +1 -0
- package/legacy/dist/src/analyze/orchestrator/execute-analyze-extract.d.ts +21 -0
- package/legacy/dist/src/analyze/services/collect-source-files.d.ts +1 -0
- package/legacy/dist/src/analyze/services/extract-with-cache.d.ts +17 -0
- package/legacy/dist/src/analyze/services/persist-extract-results.d.ts +11 -0
- package/legacy/dist/src/analyze/services/resolve-composition-mapping.d.ts +22 -0
- package/legacy/dist/src/analyze/services/resolve-source-directory.d.ts +1 -0
- package/legacy/dist/src/apply/command.d.ts +3 -41
- package/legacy/dist/src/apply/controller/run-apply.d.ts +1 -0
- package/legacy/dist/src/apply/helpers/build-apply-output.d.ts +55 -0
- package/legacy/dist/src/apply/helpers/has-breaking-changes.d.ts +2 -0
- package/legacy/dist/src/apply/helpers/poll-apply-operation.d.ts +9 -0
- package/legacy/dist/src/apply/helpers/read-token-files.d.ts +7 -0
- package/legacy/dist/src/apply/helpers/slot-validation.d.ts +20 -0
- package/legacy/dist/src/apply/services/apply-interactive.d.ts +13 -0
- package/legacy/dist/src/apply/services/apply-non-interactive.d.ts +10 -0
- package/legacy/dist/src/apply/services/resolve-apply-inputs.d.ts +14 -0
- package/legacy/dist/src/generate/command.d.ts +18 -0
- package/legacy/dist/src/generate/controller/run-generate-components.d.ts +2 -0
- package/legacy/dist/src/generate/controller/run-generate-tokens.d.ts +2 -0
- package/legacy/dist/src/generate/helpers/assert-file-exists.d.ts +1 -0
- package/legacy/dist/src/generate/helpers/normalize-component-for-cache.d.ts +6 -0
- package/legacy/dist/src/generate/helpers/parse-precomputed-cached-names.d.ts +1 -0
- package/legacy/dist/src/generate/helpers/print-fallback-instructions.d.ts +6 -0
- package/legacy/dist/src/generate/helpers/read-file-inline.d.ts +1 -0
- package/legacy/dist/src/generate/services/invoke-all-component-agents.d.ts +6 -0
- package/legacy/dist/src/generate/services/invoke-component-agent.d.ts +36 -0
- package/legacy/dist/src/generate/services/load-accepted-names.d.ts +1 -0
- package/legacy/dist/src/generate/services/resolve-component-cache.d.ts +13 -0
- package/legacy/dist/src/generate/services/resolve-generate-agent.d.ts +9 -0
- package/legacy/dist/src/generate/services/show-generate-view.d.ts +2 -0
- package/legacy/dist/src/generate/services/verify-agent-binary.d.ts +2 -0
- package/legacy/dist/src/index.js +2683 -2245
- package/legacy/dist/src/lib/pluralize.d.ts +1 -0
- package/legacy/dist/src/map-tokens/controller/run-map-tokens.d.ts +12 -0
- package/legacy/dist/src/map-tokens/services/render-map-tokens-result.d.ts +2 -0
- package/legacy/dist/src/map-tokens/services/resolve-token-name-paths.d.ts +8 -0
- package/legacy/package.json +1 -1
- package/package.json +2 -2
- package/dist/src/tui/import/steps/02-token-input/controls.d.ts +0 -11
- package/dist/src/tui/import/steps/02-token-input/logic.d.ts +0 -9
- package/dist/src/tui/import/steps/02-token-input/screen.d.ts +0 -8
- package/dist/src/tui/import/steps/02-token-input/validate-path.d.ts +0 -12
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";
|
|
@@ -304,123 +304,6 @@ function WelcomeScreen({ onContinue, onQuit }) {
|
|
|
304
304
|
] });
|
|
305
305
|
}
|
|
306
306
|
|
|
307
|
-
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
|
|
308
|
-
import { useState as useState4 } from "react";
|
|
309
|
-
import { Box as Box4, Text as Text4 } from "ink";
|
|
310
|
-
import TextInput2 from "ink-text-input";
|
|
311
|
-
|
|
312
|
-
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/controls.ts
|
|
313
|
-
import { useInput as useInput4 } from "ink";
|
|
314
|
-
|
|
315
|
-
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/logic.ts
|
|
316
|
-
function isPlainKeyOnEmptyField(value, input, key, expected) {
|
|
317
|
-
return value === "" && input === expected && !key.ctrl && !key.meta;
|
|
318
|
-
}
|
|
319
|
-
function shouldGoBack(value, input, key) {
|
|
320
|
-
return key.escape || isPlainKeyOnEmptyField(value, input, key, "q");
|
|
321
|
-
}
|
|
322
|
-
function shouldSkip(value, input, key) {
|
|
323
|
-
return isPlainKeyOnEmptyField(value, input, key, "s");
|
|
324
|
-
}
|
|
325
|
-
function toTokenPath(value) {
|
|
326
|
-
const tokenPath = value.trim();
|
|
327
|
-
return tokenPath === "" ? null : tokenPath;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/controls.ts
|
|
331
|
-
var TOKEN_INPUT_CONTROLS = [
|
|
332
|
-
{ keys: "Enter", label: "Continue (skips if empty)" },
|
|
333
|
-
{ keys: "s", label: "Skip" },
|
|
334
|
-
{ keys: "Esc/q", label: "Back" }
|
|
335
|
-
];
|
|
336
|
-
function useTokenInputControls(tokenPath, onSkip, onBack) {
|
|
337
|
-
useInput4((input, key) => {
|
|
338
|
-
if (shouldGoBack(tokenPath, input, key)) onBack();
|
|
339
|
-
else if (shouldSkip(tokenPath, input, key)) onSkip();
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts
|
|
344
|
-
import { statSync } from "node:fs";
|
|
345
|
-
import { homedir } from "node:os";
|
|
346
|
-
import { resolve } from "node:path";
|
|
347
|
-
function stripQuotes(value) {
|
|
348
|
-
const quoted = value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'");
|
|
349
|
-
return value.length >= 2 && quoted ? value.slice(1, -1) : value;
|
|
350
|
-
}
|
|
351
|
-
function expandHome(value) {
|
|
352
|
-
return value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? homedir() + value.slice(1) : value;
|
|
353
|
-
}
|
|
354
|
-
function validateTokenPath(rawPath) {
|
|
355
|
-
const path = resolve(expandHome(stripQuotes(rawPath.trim())));
|
|
356
|
-
let stats;
|
|
357
|
-
try {
|
|
358
|
-
stats = statSync(path);
|
|
359
|
-
} catch {
|
|
360
|
-
return { ok: false, error: `Path not found: ${path}`, resolvedPath: path };
|
|
361
|
-
}
|
|
362
|
-
if (stats.isDirectory()) {
|
|
363
|
-
return {
|
|
364
|
-
ok: false,
|
|
365
|
-
error: "That's a directory \u2014 provide a path to a token file (e.g. tokens.json), not a folder.",
|
|
366
|
-
resolvedPath: path
|
|
367
|
-
};
|
|
368
|
-
}
|
|
369
|
-
if (!stats.isFile()) {
|
|
370
|
-
return { ok: false, error: `Not a regular file: ${path}`, resolvedPath: path };
|
|
371
|
-
}
|
|
372
|
-
return { ok: true, path };
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
|
|
376
|
-
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
377
|
-
function TokenInputScreen({ onConfirm, onSkip, onBack }) {
|
|
378
|
-
const [tokenPath, setTokenPath] = useState4("");
|
|
379
|
-
const [failure, setFailure] = useState4(null);
|
|
380
|
-
useTokenInputControls(tokenPath, onSkip, onBack);
|
|
381
|
-
const change = (value) => {
|
|
382
|
-
setTokenPath(value);
|
|
383
|
-
setFailure(null);
|
|
384
|
-
};
|
|
385
|
-
const submit = (value) => {
|
|
386
|
-
const rawPath = toTokenPath(value);
|
|
387
|
-
if (!rawPath) {
|
|
388
|
-
onSkip();
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
391
|
-
const check = validateTokenPath(rawPath);
|
|
392
|
-
if (check.ok) onConfirm(check.path);
|
|
393
|
-
else setFailure({ error: check.error, resolvedPath: check.resolvedPath });
|
|
394
|
-
};
|
|
395
|
-
return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
396
|
-
/* @__PURE__ */ jsx4(Text4, { bold: true, children: "Design tokens" }),
|
|
397
|
-
/* @__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." }),
|
|
398
|
-
/* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
|
|
399
|
-
/* @__PURE__ */ jsxs4(Box4, { gap: 1, children: [
|
|
400
|
-
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.accent, children: "?" }),
|
|
401
|
-
/* @__PURE__ */ jsx4(Text4, { children: "Token path:" }),
|
|
402
|
-
/* @__PURE__ */ jsx4(TextInput2, { value: tokenPath, onChange: change, onSubmit: submit })
|
|
403
|
-
] }),
|
|
404
|
-
failure && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
|
|
405
|
-
/* @__PURE__ */ jsxs4(Text4, { color: PALETTE.error, children: [
|
|
406
|
-
"\u2717 ",
|
|
407
|
-
failure.error
|
|
408
|
-
] }),
|
|
409
|
-
/* @__PURE__ */ jsxs4(Text4, { dimColor: true, children: [
|
|
410
|
-
" Resolved to: ",
|
|
411
|
-
failure.resolvedPath
|
|
412
|
-
] })
|
|
413
|
-
] })
|
|
414
|
-
] }),
|
|
415
|
-
/* @__PURE__ */ jsx4(Box4, { marginTop: 1, gap: 3, children: TOKEN_INPUT_CONTROLS.map((control) => /* @__PURE__ */ jsxs4(Text4, { dimColor: true, children: [
|
|
416
|
-
"[",
|
|
417
|
-
control.keys,
|
|
418
|
-
"] ",
|
|
419
|
-
control.label
|
|
420
|
-
] }, control.keys)) })
|
|
421
|
-
] });
|
|
422
|
-
}
|
|
423
|
-
|
|
424
307
|
// packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts
|
|
425
308
|
import { spawn } from "node:child_process";
|
|
426
309
|
|
|
@@ -448,9 +331,6 @@ function buildArgs(options) {
|
|
|
448
331
|
if (options.project) {
|
|
449
332
|
args.push("--project", options.project);
|
|
450
333
|
}
|
|
451
|
-
if (options.tokens) {
|
|
452
|
-
args.push("--tokens", options.tokens);
|
|
453
|
-
}
|
|
454
334
|
return args;
|
|
455
335
|
}
|
|
456
336
|
async function spawnV1Import(options = {}) {
|
|
@@ -474,7 +354,7 @@ function getTerminalHandle() {
|
|
|
474
354
|
return process.stdin._handle;
|
|
475
355
|
}
|
|
476
356
|
async function stopReadingTerminal() {
|
|
477
|
-
await new Promise((
|
|
357
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
478
358
|
const handle = getTerminalHandle();
|
|
479
359
|
if (!handle?.readStop) return;
|
|
480
360
|
handle.reading = false;
|
|
@@ -489,7 +369,7 @@ function startReadingTerminal() {
|
|
|
489
369
|
|
|
490
370
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
491
371
|
import { useEffect as useEffect3 } from "react";
|
|
492
|
-
import { Box as
|
|
372
|
+
import { Box as Box4, Text as Text4, useInput as useInput4 } from "ink";
|
|
493
373
|
|
|
494
374
|
// packages/experience-design-system-cli/src/tui/debug-store.ts
|
|
495
375
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
@@ -663,7 +543,7 @@ process.once("SIGINT", () => {
|
|
|
663
543
|
});
|
|
664
544
|
|
|
665
545
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
666
|
-
import { jsx as
|
|
546
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
667
547
|
function HelpScreen({ onDone }) {
|
|
668
548
|
useEffect3(() => {
|
|
669
549
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
@@ -672,7 +552,7 @@ function HelpScreen({ onDone }) {
|
|
|
672
552
|
void finishDebugRun({ outputs: {}, status: "success", exitMethod });
|
|
673
553
|
onDone();
|
|
674
554
|
};
|
|
675
|
-
|
|
555
|
+
useInput4((input, key) => {
|
|
676
556
|
if (key.return) {
|
|
677
557
|
leave("saved");
|
|
678
558
|
return;
|
|
@@ -682,30 +562,30 @@ function HelpScreen({ onDone }) {
|
|
|
682
562
|
return;
|
|
683
563
|
}
|
|
684
564
|
});
|
|
685
|
-
return /* @__PURE__ */
|
|
686
|
-
/* @__PURE__ */
|
|
687
|
-
/* @__PURE__ */
|
|
688
|
-
/* @__PURE__ */
|
|
689
|
-
/* @__PURE__ */
|
|
690
|
-
/* @__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" })
|
|
691
571
|
] });
|
|
692
572
|
}
|
|
693
573
|
|
|
694
574
|
// packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
|
|
695
|
-
import { useState as
|
|
696
|
-
import { Box as
|
|
697
|
-
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";
|
|
698
578
|
function SettingsScreen({
|
|
699
579
|
onNavigate,
|
|
700
580
|
onBack
|
|
701
581
|
}) {
|
|
702
|
-
const [focusIdx, setFocusIdx] =
|
|
582
|
+
const [focusIdx, setFocusIdx] = useState4(0);
|
|
703
583
|
const items = [
|
|
704
584
|
{ label: "Configuration", screen: "settings-configuration" },
|
|
705
585
|
{ label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
|
|
706
586
|
{ label: "Debug Mode", screen: "settings-debug-mode" }
|
|
707
587
|
];
|
|
708
|
-
|
|
588
|
+
useInput5((input, key) => {
|
|
709
589
|
if (key.upArrow) {
|
|
710
590
|
setFocusIdx((i) => (i - 1 + items.length) % items.length);
|
|
711
591
|
return;
|
|
@@ -725,27 +605,27 @@ function SettingsScreen({
|
|
|
725
605
|
onBack();
|
|
726
606
|
}
|
|
727
607
|
});
|
|
728
|
-
return /* @__PURE__ */
|
|
729
|
-
/* @__PURE__ */
|
|
730
|
-
/* @__PURE__ */
|
|
731
|
-
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: [
|
|
732
612
|
i === focusIdx ? "> " : " ",
|
|
733
613
|
item.label
|
|
734
614
|
] }, item.label)),
|
|
735
|
-
/* @__PURE__ */
|
|
736
|
-
/* @__PURE__ */
|
|
615
|
+
/* @__PURE__ */ jsx5(Text5, { children: " " }),
|
|
616
|
+
/* @__PURE__ */ jsx5(Text5, { dimColor: true, children: "[\u2191/\u2193] Navigate [Enter] Select [Esc/q] Back to Start" })
|
|
737
617
|
] });
|
|
738
618
|
}
|
|
739
619
|
|
|
740
620
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
741
|
-
import { useEffect as useEffect4, useState as
|
|
742
|
-
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";
|
|
743
623
|
|
|
744
624
|
// packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
|
|
745
625
|
import { readFile as readFile2, writeFile as writeFile3, mkdir as mkdir3 } from "node:fs/promises";
|
|
746
626
|
import { join as join6 } from "node:path";
|
|
747
|
-
import { homedir
|
|
748
|
-
var V1_STORE_PATH = join6(
|
|
627
|
+
import { homedir } from "node:os";
|
|
628
|
+
var V1_STORE_PATH = join6(homedir(), ".config", "experiences", "credentials.json");
|
|
749
629
|
async function readV1Store() {
|
|
750
630
|
try {
|
|
751
631
|
const raw = await readFile2(V1_STORE_PATH, "utf8");
|
|
@@ -755,7 +635,7 @@ async function readV1Store() {
|
|
|
755
635
|
}
|
|
756
636
|
}
|
|
757
637
|
async function writeV1Store(data) {
|
|
758
|
-
await mkdir3(join6(
|
|
638
|
+
await mkdir3(join6(homedir(), ".config", "experiences"), { recursive: true });
|
|
759
639
|
await writeFile3(V1_STORE_PATH, `${JSON.stringify(data, null, 2)}
|
|
760
640
|
`, { mode: 384 });
|
|
761
641
|
}
|
|
@@ -783,7 +663,7 @@ async function writeCredentials(config) {
|
|
|
783
663
|
}
|
|
784
664
|
|
|
785
665
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
786
|
-
import { Fragment, jsx as
|
|
666
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
787
667
|
var FIELD_ORDER = ["spaceId", "environmentId", "cmaToken", "host"];
|
|
788
668
|
function debugFields(config) {
|
|
789
669
|
return {
|
|
@@ -800,10 +680,10 @@ var FIELD_LABELS = {
|
|
|
800
680
|
host: "API Host (optional)"
|
|
801
681
|
};
|
|
802
682
|
function ConfigurationScreen({ onDone }) {
|
|
803
|
-
const [stage, setStage] =
|
|
804
|
-
const [config, setConfig] =
|
|
805
|
-
const [activeField, setActiveField] =
|
|
806
|
-
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);
|
|
807
687
|
useEffect4(() => {
|
|
808
688
|
readCredentials().then((cfg) => {
|
|
809
689
|
setConfig(cfg);
|
|
@@ -836,7 +716,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
836
716
|
setStage("form");
|
|
837
717
|
});
|
|
838
718
|
}
|
|
839
|
-
|
|
719
|
+
useInput6((input, key) => {
|
|
840
720
|
if (stage === "loading" || stage === "saving") return;
|
|
841
721
|
if (stage === "saved") {
|
|
842
722
|
if (key.return || key.escape || input === "q") {
|
|
@@ -879,57 +759,57 @@ function ConfigurationScreen({ onDone }) {
|
|
|
879
759
|
}
|
|
880
760
|
});
|
|
881
761
|
if (stage === "loading") {
|
|
882
|
-
return /* @__PURE__ */
|
|
883
|
-
/* @__PURE__ */
|
|
884
|
-
/* @__PURE__ */
|
|
885
|
-
/* @__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..." })
|
|
886
766
|
] });
|
|
887
767
|
}
|
|
888
768
|
if (stage === "saved") {
|
|
889
|
-
return /* @__PURE__ */
|
|
890
|
-
/* @__PURE__ */
|
|
891
|
-
/* @__PURE__ */
|
|
892
|
-
/* @__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: [
|
|
893
773
|
"\u2713 ",
|
|
894
774
|
message
|
|
895
775
|
] }),
|
|
896
|
-
/* @__PURE__ */
|
|
897
|
-
/* @__PURE__ */
|
|
776
|
+
/* @__PURE__ */ jsx6(Text6, { children: " " }),
|
|
777
|
+
/* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "[Enter] Back to Settings" })
|
|
898
778
|
] });
|
|
899
779
|
}
|
|
900
|
-
return /* @__PURE__ */
|
|
901
|
-
/* @__PURE__ */
|
|
902
|
-
/* @__PURE__ */
|
|
903
|
-
/* @__PURE__ */
|
|
904
|
-
/* @__PURE__ */
|
|
905
|
-
/* @__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) => {
|
|
906
786
|
const isActive = activeField === field;
|
|
907
787
|
const value = fieldValue(field);
|
|
908
788
|
const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
|
|
909
|
-
return /* @__PURE__ */
|
|
910
|
-
/* @__PURE__ */
|
|
911
|
-
/* @__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: [
|
|
912
792
|
FIELD_LABELS[field],
|
|
913
793
|
":"
|
|
914
794
|
] }),
|
|
915
|
-
/* @__PURE__ */
|
|
795
|
+
/* @__PURE__ */ jsx6(Text6, { children: display || /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "(empty)" }) })
|
|
916
796
|
] }, field);
|
|
917
797
|
}) }),
|
|
918
|
-
message && /* @__PURE__ */
|
|
919
|
-
/* @__PURE__ */
|
|
920
|
-
/* @__PURE__ */
|
|
798
|
+
message && /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
799
|
+
/* @__PURE__ */ jsx6(Text6, { children: " " }),
|
|
800
|
+
/* @__PURE__ */ jsxs6(Text6, { color: PALETTE.error, children: [
|
|
921
801
|
"\u2717 ",
|
|
922
802
|
message
|
|
923
803
|
] })
|
|
924
804
|
] }),
|
|
925
|
-
/* @__PURE__ */
|
|
926
|
-
/* @__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" })
|
|
927
807
|
] });
|
|
928
808
|
}
|
|
929
809
|
|
|
930
810
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
931
|
-
import { useEffect as useEffect5, useState as
|
|
932
|
-
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";
|
|
933
813
|
|
|
934
814
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
|
|
935
815
|
async function readAnalyticsSetting() {
|
|
@@ -947,10 +827,10 @@ async function writeAnalyticsSetting(setting) {
|
|
|
947
827
|
}
|
|
948
828
|
|
|
949
829
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
950
|
-
import { Fragment as Fragment2, jsx as
|
|
830
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
951
831
|
function OptInAnalyticsScreen({ onDone }) {
|
|
952
|
-
const [loading, setLoading] =
|
|
953
|
-
const [enabled, setEnabled] =
|
|
832
|
+
const [loading, setLoading] = useState6(true);
|
|
833
|
+
const [enabled, setEnabled] = useState6(true);
|
|
954
834
|
useEffect5(() => {
|
|
955
835
|
readAnalyticsSetting().then((setting) => {
|
|
956
836
|
setEnabled(setting.enabled);
|
|
@@ -963,7 +843,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
963
843
|
});
|
|
964
844
|
});
|
|
965
845
|
}, []);
|
|
966
|
-
|
|
846
|
+
useInput7((input, key) => {
|
|
967
847
|
if (loading) return;
|
|
968
848
|
if (key.return || input === " ") {
|
|
969
849
|
setEnabled((current) => {
|
|
@@ -978,31 +858,31 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
978
858
|
onDone();
|
|
979
859
|
}
|
|
980
860
|
});
|
|
981
|
-
return /* @__PURE__ */
|
|
982
|
-
/* @__PURE__ */
|
|
983
|
-
/* @__PURE__ */
|
|
984
|
-
loading ? /* @__PURE__ */
|
|
985
|
-
/* @__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: [
|
|
986
866
|
"Share anonymous usage data:",
|
|
987
867
|
" ",
|
|
988
|
-
/* @__PURE__ */
|
|
868
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
989
869
|
] }),
|
|
990
|
-
/* @__PURE__ */
|
|
991
|
-
/* @__PURE__ */
|
|
992
|
-
/* @__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." })
|
|
993
873
|
] }),
|
|
994
|
-
/* @__PURE__ */
|
|
995
|
-
/* @__PURE__ */
|
|
874
|
+
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
875
|
+
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
|
|
996
876
|
] });
|
|
997
877
|
}
|
|
998
878
|
|
|
999
879
|
// packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
|
|
1000
|
-
import { useEffect as useEffect6, useState as
|
|
1001
|
-
import { Box as
|
|
1002
|
-
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";
|
|
1003
883
|
var UPGRADE_COMMANDS = ["git pull", "pnpm install", "pnpm build"];
|
|
1004
884
|
function UpgradeScreen({ onDone }) {
|
|
1005
|
-
const [upgradeCheck, setUpgradeCheck] =
|
|
885
|
+
const [upgradeCheck, setUpgradeCheck] = useState7();
|
|
1006
886
|
useEffect6(() => {
|
|
1007
887
|
startDebugRun({
|
|
1008
888
|
flow: "upgrade",
|
|
@@ -1012,7 +892,7 @@ function UpgradeScreen({ onDone }) {
|
|
|
1012
892
|
});
|
|
1013
893
|
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
1014
894
|
}, []);
|
|
1015
|
-
|
|
895
|
+
useInput8((_input, key) => {
|
|
1016
896
|
if (key.return) {
|
|
1017
897
|
void finishDebugRun({
|
|
1018
898
|
outputs: upgradeCheck ?? {},
|
|
@@ -1023,12 +903,12 @@ function UpgradeScreen({ onDone }) {
|
|
|
1023
903
|
return;
|
|
1024
904
|
}
|
|
1025
905
|
});
|
|
1026
|
-
return /* @__PURE__ */
|
|
1027
|
-
/* @__PURE__ */
|
|
1028
|
-
/* @__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: " " }),
|
|
1029
909
|
renderBody(upgradeCheck),
|
|
1030
|
-
/* @__PURE__ */
|
|
1031
|
-
/* @__PURE__ */
|
|
910
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
911
|
+
/* @__PURE__ */ jsxs8(Text8, { bold: true, color: PALETTE.accent, children: [
|
|
1032
912
|
FOCUS_MARKER,
|
|
1033
913
|
" Go Back"
|
|
1034
914
|
] })
|
|
@@ -1036,44 +916,44 @@ function UpgradeScreen({ onDone }) {
|
|
|
1036
916
|
}
|
|
1037
917
|
function renderBody(upgradeCheck) {
|
|
1038
918
|
if (!upgradeCheck) {
|
|
1039
|
-
return /* @__PURE__ */
|
|
919
|
+
return /* @__PURE__ */ jsx8(Text8, { color: PALETTE.muted, children: "Checking for updates\u2026" });
|
|
1040
920
|
}
|
|
1041
921
|
if (upgradeCheck.status === "error") {
|
|
1042
|
-
return /* @__PURE__ */
|
|
922
|
+
return /* @__PURE__ */ jsx8(Text8, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
|
|
1043
923
|
}
|
|
1044
924
|
if (upgradeCheck.status === "up-to-date") {
|
|
1045
|
-
return /* @__PURE__ */
|
|
925
|
+
return /* @__PURE__ */ jsxs8(Text8, { color: PALETTE.success, children: [
|
|
1046
926
|
"You're already on the latest version (v",
|
|
1047
927
|
upgradeCheck.current,
|
|
1048
928
|
")."
|
|
1049
929
|
] });
|
|
1050
930
|
}
|
|
1051
|
-
return /* @__PURE__ */
|
|
1052
|
-
/* @__PURE__ */
|
|
1053
|
-
/* @__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: [
|
|
1054
934
|
"v",
|
|
1055
935
|
upgradeCheck.latest
|
|
1056
936
|
] }),
|
|
1057
937
|
" ",
|
|
1058
938
|
"is available (you're on ",
|
|
1059
|
-
/* @__PURE__ */
|
|
939
|
+
/* @__PURE__ */ jsxs8(Text8, { bold: true, children: [
|
|
1060
940
|
"v",
|
|
1061
941
|
upgradeCheck.current
|
|
1062
942
|
] }),
|
|
1063
943
|
"). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
|
|
1064
944
|
] }),
|
|
1065
|
-
/* @__PURE__ */
|
|
1066
|
-
/* @__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)) })
|
|
1067
947
|
] });
|
|
1068
948
|
}
|
|
1069
949
|
|
|
1070
950
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
1071
|
-
import { useEffect as useEffect7, useState as
|
|
1072
|
-
import { Box as
|
|
1073
|
-
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";
|
|
1074
954
|
function DebugModeScreen({ onDone }) {
|
|
1075
|
-
const [loading, setLoading] =
|
|
1076
|
-
const [enabled, setEnabled] =
|
|
955
|
+
const [loading, setLoading] = useState8(true);
|
|
956
|
+
const [enabled, setEnabled] = useState8(true);
|
|
1077
957
|
useEffect7(() => {
|
|
1078
958
|
readDebugModeSetting().then((setting) => {
|
|
1079
959
|
setEnabled(setting.enabled);
|
|
@@ -1086,7 +966,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
1086
966
|
});
|
|
1087
967
|
});
|
|
1088
968
|
}, []);
|
|
1089
|
-
|
|
969
|
+
useInput9((input, key) => {
|
|
1090
970
|
if (loading) return;
|
|
1091
971
|
if (key.return || input === " ") {
|
|
1092
972
|
setEnabled((current) => {
|
|
@@ -1101,74 +981,59 @@ function DebugModeScreen({ onDone }) {
|
|
|
1101
981
|
onDone();
|
|
1102
982
|
}
|
|
1103
983
|
});
|
|
1104
|
-
return /* @__PURE__ */
|
|
1105
|
-
/* @__PURE__ */
|
|
1106
|
-
/* @__PURE__ */
|
|
1107
|
-
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: [
|
|
1108
988
|
"Debug logging:",
|
|
1109
989
|
" ",
|
|
1110
|
-
/* @__PURE__ */
|
|
990
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
1111
991
|
] }),
|
|
1112
|
-
/* @__PURE__ */
|
|
1113
|
-
/* @__PURE__ */
|
|
992
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
993
|
+
/* @__PURE__ */ jsx9(Text9, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
|
|
1114
994
|
] });
|
|
1115
995
|
}
|
|
1116
996
|
|
|
1117
997
|
// packages/experience-design-system-cli/app.tsx
|
|
1118
|
-
import { jsx as
|
|
998
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1119
999
|
function App({ onLaunchImport, importExitCode }) {
|
|
1120
1000
|
const returnedFromImport = importExitCode !== void 0;
|
|
1121
|
-
const [screen, setScreen] =
|
|
1122
|
-
const [showImportResult, setShowImportResult] =
|
|
1123
|
-
const [projectPath, setProjectPath] = useState10();
|
|
1001
|
+
const [screen, setScreen] = useState9(returnedFromImport ? "import" : "start");
|
|
1002
|
+
const [showImportResult, setShowImportResult] = useState9(returnedFromImport);
|
|
1124
1003
|
const goToStart = () => setScreen("start");
|
|
1125
1004
|
const goToSettings = () => setScreen("settings");
|
|
1126
1005
|
const finishImportResult = () => {
|
|
1127
1006
|
setShowImportResult(false);
|
|
1128
|
-
setProjectPath(void 0);
|
|
1129
|
-
goToStart();
|
|
1130
|
-
};
|
|
1131
|
-
const leaveImport = () => {
|
|
1132
|
-
setProjectPath(void 0);
|
|
1133
1007
|
goToStart();
|
|
1134
1008
|
};
|
|
1135
1009
|
switch (screen) {
|
|
1136
1010
|
case "import":
|
|
1137
|
-
|
|
1138
|
-
if (projectPath === void 0) return /* @__PURE__ */ jsx11(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport });
|
|
1139
|
-
return /* @__PURE__ */ jsx11(
|
|
1140
|
-
TokenInputScreen,
|
|
1141
|
-
{
|
|
1142
|
-
onConfirm: (tokens) => onLaunchImport?.({ project: projectPath, tokens }),
|
|
1143
|
-
onSkip: () => onLaunchImport?.({ project: projectPath }),
|
|
1144
|
-
onBack: () => setProjectPath(void 0)
|
|
1145
|
-
}
|
|
1146
|
-
);
|
|
1011
|
+
return showImportResult ? /* @__PURE__ */ jsx10(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult }) : /* @__PURE__ */ jsx10(WelcomeScreen, { onContinue: (projectPath) => onLaunchImport?.(projectPath), onQuit: goToStart });
|
|
1147
1012
|
case "help":
|
|
1148
|
-
return /* @__PURE__ */
|
|
1013
|
+
return /* @__PURE__ */ jsx10(HelpScreen, { onDone: goToStart });
|
|
1149
1014
|
case "upgrade":
|
|
1150
|
-
return /* @__PURE__ */
|
|
1015
|
+
return /* @__PURE__ */ jsx10(UpgradeScreen, { onDone: goToStart });
|
|
1151
1016
|
case "settings":
|
|
1152
|
-
return /* @__PURE__ */
|
|
1017
|
+
return /* @__PURE__ */ jsx10(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
1153
1018
|
case "settings-configuration":
|
|
1154
|
-
return /* @__PURE__ */
|
|
1019
|
+
return /* @__PURE__ */ jsx10(ConfigurationScreen, { onDone: goToSettings });
|
|
1155
1020
|
case "settings-opt-in-analytics":
|
|
1156
|
-
return /* @__PURE__ */
|
|
1021
|
+
return /* @__PURE__ */ jsx10(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
1157
1022
|
case "settings-debug-mode":
|
|
1158
|
-
return /* @__PURE__ */
|
|
1023
|
+
return /* @__PURE__ */ jsx10(DebugModeScreen, { onDone: goToSettings });
|
|
1159
1024
|
case "start":
|
|
1160
|
-
return /* @__PURE__ */
|
|
1025
|
+
return /* @__PURE__ */ jsx10(HomeScreen, { onNavigate: setScreen });
|
|
1161
1026
|
}
|
|
1162
1027
|
}
|
|
1163
1028
|
async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
|
|
1164
|
-
let
|
|
1029
|
+
let requestedProjectPath;
|
|
1165
1030
|
const instance = renderApp(
|
|
1166
|
-
/* @__PURE__ */
|
|
1031
|
+
/* @__PURE__ */ jsx10(
|
|
1167
1032
|
App,
|
|
1168
1033
|
{
|
|
1169
1034
|
importExitCode,
|
|
1170
|
-
onLaunchImport: (
|
|
1171
|
-
|
|
1035
|
+
onLaunchImport: (projectPath) => {
|
|
1036
|
+
requestedProjectPath = projectPath;
|
|
1172
1037
|
instance.unmount();
|
|
1173
1038
|
}
|
|
1174
1039
|
}
|
|
@@ -1176,15 +1041,15 @@ async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
|
|
|
1176
1041
|
);
|
|
1177
1042
|
await instance.waitUntilExit();
|
|
1178
1043
|
await stopReadingTerminal();
|
|
1179
|
-
return
|
|
1044
|
+
return requestedProjectPath;
|
|
1180
1045
|
}
|
|
1181
1046
|
async function runApp(renderApp) {
|
|
1182
1047
|
let importExitCode;
|
|
1183
|
-
let
|
|
1184
|
-
while (
|
|
1185
|
-
importExitCode = (await spawnV1Import(
|
|
1048
|
+
let projectPath = await renderUntilImportRequestedOrExit(renderApp, importExitCode);
|
|
1049
|
+
while (projectPath !== void 0) {
|
|
1050
|
+
importExitCode = (await spawnV1Import({ project: projectPath })).exitCode;
|
|
1186
1051
|
startReadingTerminal();
|
|
1187
|
-
|
|
1052
|
+
projectPath = await renderUntilImportRequestedOrExit(renderApp, importExitCode);
|
|
1188
1053
|
}
|
|
1189
1054
|
}
|
|
1190
1055
|
export {
|