@contentful/experience-design-system-cli 2.37.1-dev-build-932fd115.0 → 2.37.1-dev-build-91b5f8aa.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 +341 -154
- package/dist/index.js +436 -163
- package/dist/package.json +1 -1
- package/dist/src/tui/import/shared/error-step/controls.d.ts +7 -0
- package/dist/src/tui/import/shared/error-step/error-step.d.ts +10 -0
- package/dist/src/tui/import/shared/error-step/logic.d.ts +15 -0
- package/dist/src/tui/import/shared/gate-step/controls.d.ts +8 -0
- package/dist/src/tui/import/shared/gate-step/gate-step.d.ts +14 -0
- package/dist/src/tui/import/shared/gate-step/logic.d.ts +11 -0
- package/dist/src/tui/import/shared/index.d.ts +3 -0
- package/dist/src/tui/import/shared/running-step/logic.d.ts +12 -0
- package/dist/src/tui/import/shared/running-step/running-step.d.ts +11 -0
- package/dist/src/tui/import/shared/running-step/theme.d.ts +3 -0
- package/dist/src/tui/import/shared/running-step/use-elapsed.d.ts +1 -0
- package/dist/src/tui/import/spawn-v1-import.d.ts +3 -0
- package/dist/src/tui/import/steps/05-token-reuse/logic.d.ts +22 -0
- package/dist/src/tui/import/steps/05-token-reuse/screen.d.ts +10 -0
- package/dist/src/tui/import/steps/index.d.ts +1 -0
- package/legacy/dist/src/index.js +26 -79
- package/legacy/package.json +1 -1
- package/package.json +3 -3
package/dist/app.js
CHANGED
|
@@ -880,7 +880,8 @@ var init_cache_keys = __esm({
|
|
|
880
880
|
});
|
|
881
881
|
|
|
882
882
|
// packages/experience-design-system-cli/app.tsx
|
|
883
|
-
import {
|
|
883
|
+
import { join as join7 } from "node:path";
|
|
884
|
+
import { useEffect as useEffect10, useState as useState14 } from "react";
|
|
884
885
|
|
|
885
886
|
// packages/experience-design-system-cli/src/tui/home/home.tsx
|
|
886
887
|
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
@@ -1803,15 +1804,15 @@ function walkProjectTree(dir, result, includeContent) {
|
|
|
1803
1804
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/collect-files.js
|
|
1804
1805
|
function collectFiles(root, options = {}) {
|
|
1805
1806
|
const resolved = path4.resolve(root);
|
|
1806
|
-
let
|
|
1807
|
+
let stat2;
|
|
1807
1808
|
try {
|
|
1808
|
-
|
|
1809
|
+
stat2 = statSync2(resolved);
|
|
1809
1810
|
} catch (err) {
|
|
1810
1811
|
return { ok: false, failure: classifyStatError(err.code), rootPath: resolved };
|
|
1811
1812
|
}
|
|
1812
|
-
if (
|
|
1813
|
+
if (stat2.isFile())
|
|
1813
1814
|
return { ok: false, failure: "is-file", rootPath: resolved };
|
|
1814
|
-
if (!
|
|
1815
|
+
if (!stat2.isDirectory())
|
|
1815
1816
|
return { ok: false, failure: "not-directory", rootPath: resolved };
|
|
1816
1817
|
const result = {
|
|
1817
1818
|
filePaths: [],
|
|
@@ -2737,18 +2738,163 @@ function CredentialsScreen({
|
|
|
2737
2738
|
] });
|
|
2738
2739
|
}
|
|
2739
2740
|
|
|
2741
|
+
// packages/experience-design-system-cli/src/tui/import/shared/error-step/error-step.tsx
|
|
2742
|
+
import { Box as Box7, Text as Text8 } from "ink";
|
|
2743
|
+
|
|
2744
|
+
// packages/experience-design-system-cli/src/tui/import/shared/error-step/controls.ts
|
|
2745
|
+
import { useInput as useInput7 } from "ink";
|
|
2746
|
+
|
|
2747
|
+
// packages/experience-design-system-cli/src/tui/import/shared/error-step/error-step.tsx
|
|
2748
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2749
|
+
|
|
2750
|
+
// packages/experience-design-system-cli/src/tui/import/shared/gate-step/gate-step.tsx
|
|
2751
|
+
import { Box as Box8, Text as Text9 } from "ink";
|
|
2752
|
+
|
|
2753
|
+
// packages/experience-design-system-cli/src/tui/import/shared/gate-step/controls.ts
|
|
2754
|
+
import { useInput as useInput8 } from "ink";
|
|
2755
|
+
|
|
2756
|
+
// packages/experience-design-system-cli/src/tui/import/shared/gate-step/logic.ts
|
|
2757
|
+
function gateAction(input, key, canSkip) {
|
|
2758
|
+
if (key.return) return "continue";
|
|
2759
|
+
if (input === "a" && canSkip) return "skip";
|
|
2760
|
+
if (key.escape) return "quit";
|
|
2761
|
+
return null;
|
|
2762
|
+
}
|
|
2763
|
+
function gateControls(continueLabel, skipLabel, canSkip) {
|
|
2764
|
+
return [
|
|
2765
|
+
{ keys: "Enter", label: continueLabel },
|
|
2766
|
+
...canSkip ? [{ keys: "a", label: skipLabel }] : [],
|
|
2767
|
+
{ keys: "Esc", label: "Quit" }
|
|
2768
|
+
];
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
|
+
// packages/experience-design-system-cli/src/tui/import/shared/gate-step/controls.ts
|
|
2772
|
+
function useGateControls(handlers) {
|
|
2773
|
+
useInput8((input, key) => {
|
|
2774
|
+
const action = gateAction(input, key, handlers.canSkip);
|
|
2775
|
+
if (action === "continue") handlers.onContinue();
|
|
2776
|
+
else if (action === "skip") handlers.onSkip();
|
|
2777
|
+
else if (action === "quit") handlers.onQuit();
|
|
2778
|
+
});
|
|
2779
|
+
}
|
|
2780
|
+
|
|
2781
|
+
// packages/experience-design-system-cli/src/tui/import/shared/gate-step/gate-step.tsx
|
|
2782
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2783
|
+
function GateStep({
|
|
2784
|
+
message,
|
|
2785
|
+
onContinue,
|
|
2786
|
+
onQuit,
|
|
2787
|
+
summary,
|
|
2788
|
+
context,
|
|
2789
|
+
continueLabel = "Continue",
|
|
2790
|
+
skipLabel = "Approve all and skip",
|
|
2791
|
+
onSkip,
|
|
2792
|
+
intent = "success"
|
|
2793
|
+
}) {
|
|
2794
|
+
useGateControls({ canSkip: onSkip !== void 0, onContinue, onSkip: onSkip ?? (() => {
|
|
2795
|
+
}), onQuit });
|
|
2796
|
+
const color = intent === "error" ? PALETTE.error : PALETTE.success;
|
|
2797
|
+
const icon = intent === "error" ? "\u2717" : "\u2713";
|
|
2798
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
2799
|
+
/* @__PURE__ */ jsxs8(Text9, { color, children: [
|
|
2800
|
+
icon,
|
|
2801
|
+
" ",
|
|
2802
|
+
message
|
|
2803
|
+
] }),
|
|
2804
|
+
summary && /* @__PURE__ */ jsx9(Text9, { color: PALETTE.muted, children: summary }),
|
|
2805
|
+
context && /* @__PURE__ */ jsx9(Box8, { marginTop: 1, children: /* @__PURE__ */ jsx9(Text9, { children: context }) }),
|
|
2806
|
+
/* @__PURE__ */ jsx9(Box8, { marginTop: 1, gap: 3, children: gateControls(continueLabel, skipLabel, onSkip !== void 0).map((control) => /* @__PURE__ */ jsxs8(Text9, { dimColor: true, children: [
|
|
2807
|
+
"[",
|
|
2808
|
+
control.keys,
|
|
2809
|
+
"] ",
|
|
2810
|
+
control.label
|
|
2811
|
+
] }, control.keys)) })
|
|
2812
|
+
] });
|
|
2813
|
+
}
|
|
2814
|
+
|
|
2815
|
+
// packages/experience-design-system-cli/src/tui/import/shared/running-step/running-step.tsx
|
|
2816
|
+
import { Box as Box9, Text as Text10 } from "ink";
|
|
2817
|
+
import { ProgressBar, Spinner, ThemeProvider } from "@inkjs/ui";
|
|
2818
|
+
|
|
2819
|
+
// packages/experience-design-system-cli/src/tui/import/shared/running-step/theme.ts
|
|
2820
|
+
import { defaultTheme, extendTheme } from "@inkjs/ui";
|
|
2821
|
+
var PROGRESS_THEME = extendTheme(defaultTheme, {
|
|
2822
|
+
components: {
|
|
2823
|
+
ProgressBar: {
|
|
2824
|
+
styles: {
|
|
2825
|
+
completed: () => ({ color: "blue" })
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
});
|
|
2830
|
+
|
|
2831
|
+
// packages/experience-design-system-cli/src/tui/import/shared/running-step/use-elapsed.ts
|
|
2832
|
+
import { useEffect as useEffect4, useState as useState7 } from "react";
|
|
2833
|
+
|
|
2834
|
+
// packages/experience-design-system-cli/src/tui/import/shared/running-step/running-step.tsx
|
|
2835
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2836
|
+
var RULE2 = "\u2500".repeat(40);
|
|
2837
|
+
|
|
2838
|
+
// packages/experience-design-system-cli/src/tui/import/steps/05-token-reuse/logic.ts
|
|
2839
|
+
import { access, stat } from "node:fs/promises";
|
|
2840
|
+
import { join as join3 } from "node:path";
|
|
2841
|
+
async function inspectTokens({ rawTokensPath, outDir, cache }) {
|
|
2842
|
+
if (!cache) return { kind: "none" };
|
|
2843
|
+
const tokensPath = join3(outDir, "tokens.json");
|
|
2844
|
+
try {
|
|
2845
|
+
await access(tokensPath);
|
|
2846
|
+
} catch {
|
|
2847
|
+
return { kind: "none" };
|
|
2848
|
+
}
|
|
2849
|
+
const [generated, source] = await Promise.all([stat(tokensPath), stat(rawTokensPath).catch(() => null)]);
|
|
2850
|
+
return { kind: "cached", tokensPath, sourceChanged: source ? source.mtimeMs > generated.mtimeMs : false };
|
|
2851
|
+
}
|
|
2852
|
+
function gateText({ tokensPath, sourceChanged }) {
|
|
2853
|
+
const summary = sourceChanged ? `Source file has been modified since tokens were last generated.
|
|
2854
|
+
|
|
2855
|
+
Tokens Path: ${tokensPath}` : `Source file has not changed since tokens were last generated.
|
|
2856
|
+
|
|
2857
|
+
Tokens Path: ${tokensPath}`;
|
|
2858
|
+
return sourceChanged ? { summary, context: "The source tokens file changed \u2014 regenerating is recommended." } : { summary };
|
|
2859
|
+
}
|
|
2860
|
+
|
|
2861
|
+
// packages/experience-design-system-cli/src/tui/import/steps/05-token-reuse/screen.tsx
|
|
2862
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
2863
|
+
function TokenReuseScreen({
|
|
2864
|
+
tokensPath,
|
|
2865
|
+
sourceChanged,
|
|
2866
|
+
onReuse,
|
|
2867
|
+
onRegenerate,
|
|
2868
|
+
onQuit
|
|
2869
|
+
}) {
|
|
2870
|
+
const { summary, context } = gateText({ tokensPath, sourceChanged });
|
|
2871
|
+
return /* @__PURE__ */ jsx11(
|
|
2872
|
+
GateStep,
|
|
2873
|
+
{
|
|
2874
|
+
message: "Existing tokens.json found",
|
|
2875
|
+
summary,
|
|
2876
|
+
context,
|
|
2877
|
+
continueLabel: "Reuse existing tokens",
|
|
2878
|
+
skipLabel: "Regenerate tokens",
|
|
2879
|
+
onContinue: onReuse,
|
|
2880
|
+
onSkip: onRegenerate,
|
|
2881
|
+
onQuit
|
|
2882
|
+
}
|
|
2883
|
+
);
|
|
2884
|
+
}
|
|
2885
|
+
|
|
2740
2886
|
// packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts
|
|
2741
2887
|
import { spawn } from "node:child_process";
|
|
2742
2888
|
|
|
2743
2889
|
// packages/experience-design-system-cli/src/legacy/legacy-cli-path.ts
|
|
2744
2890
|
import { existsSync as existsSync2 } from "node:fs";
|
|
2745
|
-
import { join as
|
|
2891
|
+
import { join as join4 } from "node:path";
|
|
2746
2892
|
var PACKAGE_NAME2 = "@contentful/experience-design-system-cli";
|
|
2747
2893
|
function findLegacyCliPath() {
|
|
2748
2894
|
const root = findPackageRoot(import.meta.url, PACKAGE_NAME2);
|
|
2749
2895
|
const candidates = [
|
|
2750
|
-
|
|
2751
|
-
|
|
2896
|
+
join4(root, "legacy", "bin", "cli.js"),
|
|
2897
|
+
join4(root, "..", "experience-design-system-cli-legacy", "bin", "cli.js")
|
|
2752
2898
|
];
|
|
2753
2899
|
const found = candidates.find((candidate) => existsSync2(candidate));
|
|
2754
2900
|
if (!found) {
|
|
@@ -2779,13 +2925,20 @@ function buildArgs2(options) {
|
|
|
2779
2925
|
args.push(...importOptionArgs({ agent: options.agent, prompt: options.prompt ?? [], cache: options.cache ?? true }));
|
|
2780
2926
|
return args;
|
|
2781
2927
|
}
|
|
2928
|
+
function buildEnv(options, base = process.env) {
|
|
2929
|
+
return {
|
|
2930
|
+
...base,
|
|
2931
|
+
...options.skipCredentials ? { EDS_IMPORT_SKIP_CREDENTIALS: "1" } : {},
|
|
2932
|
+
...options.tokenStrategy ? { EDS_IMPORT_TOKENS: options.tokenStrategy } : {}
|
|
2933
|
+
};
|
|
2934
|
+
}
|
|
2782
2935
|
async function spawnV1Import(options = {}) {
|
|
2783
2936
|
const cliPath = findLegacyCliPath();
|
|
2784
2937
|
const args = buildArgs2(options);
|
|
2785
2938
|
return new Promise((resolvePromise) => {
|
|
2786
2939
|
const child = spawn("node", [cliPath, ...args], {
|
|
2787
2940
|
stdio: "inherit",
|
|
2788
|
-
env: options
|
|
2941
|
+
env: buildEnv(options)
|
|
2789
2942
|
});
|
|
2790
2943
|
child.on("close", (code) => {
|
|
2791
2944
|
resolvePromise({ exitCode: code ?? 1, result: void 0, stdout: "", stderr: "" });
|
|
@@ -2815,24 +2968,24 @@ function startReadingTerminal() {
|
|
|
2815
2968
|
}
|
|
2816
2969
|
|
|
2817
2970
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
2818
|
-
import { useEffect as
|
|
2819
|
-
import { Box as
|
|
2971
|
+
import { useEffect as useEffect5, useState as useState8 } from "react";
|
|
2972
|
+
import { Box as Box10, Text as Text11, useInput as useInput9 } from "ink";
|
|
2820
2973
|
|
|
2821
2974
|
// packages/experience-design-system-cli/src/tui/debug-store.ts
|
|
2822
2975
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
2823
2976
|
import { existsSync as existsSync3, readdirSync as readdirSync2 } from "node:fs";
|
|
2824
|
-
import { join as
|
|
2977
|
+
import { join as join6 } from "node:path";
|
|
2825
2978
|
|
|
2826
2979
|
// packages/experience-design-system-types/dist/src/config/index.js
|
|
2827
2980
|
import { randomBytes } from "node:crypto";
|
|
2828
2981
|
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
2829
2982
|
import { homedir as homedir2 } from "node:os";
|
|
2830
|
-
import { dirname as dirname2, join as
|
|
2983
|
+
import { dirname as dirname2, join as join5 } from "node:path";
|
|
2831
2984
|
function configRoot2() {
|
|
2832
|
-
return process.env["EDS_HOME"] ||
|
|
2985
|
+
return process.env["EDS_HOME"] || join5(homedir2(), ".contentful", "experience-design-system-cli");
|
|
2833
2986
|
}
|
|
2834
|
-
var configFilePath2 = () =>
|
|
2835
|
-
var debugSessionsDir2 = () =>
|
|
2987
|
+
var configFilePath2 = () => join5(configRoot2(), "config.json");
|
|
2988
|
+
var debugSessionsDir2 = () => join5(configRoot2(), "debug", "sessions");
|
|
2836
2989
|
async function readSettings2() {
|
|
2837
2990
|
try {
|
|
2838
2991
|
return JSON.parse(await readFile(configFilePath2(), "utf8"));
|
|
@@ -2891,7 +3044,7 @@ function generateSessionId3() {
|
|
|
2891
3044
|
}
|
|
2892
3045
|
var SESSION_ID = generateSessionId3();
|
|
2893
3046
|
function sessionDebugDir() {
|
|
2894
|
-
return
|
|
3047
|
+
return join6(debugSessionsDir2(), SESSION_ID);
|
|
2895
3048
|
}
|
|
2896
3049
|
function currentDebugSessionDir() {
|
|
2897
3050
|
return sessionDebugDir();
|
|
@@ -2940,10 +3093,10 @@ async function finishDebugRun({
|
|
|
2940
3093
|
const durationMs = Date.now() - run.startedAt;
|
|
2941
3094
|
const content = renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs });
|
|
2942
3095
|
const flowSegments = run.flow.split("/");
|
|
2943
|
-
const dir =
|
|
3096
|
+
const dir = join6(sessionDebugDir(), ...flowSegments);
|
|
2944
3097
|
await mkdir2(dir, { recursive: true });
|
|
2945
3098
|
const filename = nextAttemptFilename(dir, run.menuOption);
|
|
2946
|
-
await writeFile2(
|
|
3099
|
+
await writeFile2(join6(dir, filename), content, { mode: 384 });
|
|
2947
3100
|
}
|
|
2948
3101
|
function nextAttemptFilename(dir, menuOption) {
|
|
2949
3102
|
const today = datePrefix();
|
|
@@ -2958,13 +3111,13 @@ function nextAttemptFilename(dir, menuOption) {
|
|
|
2958
3111
|
}
|
|
2959
3112
|
function renderMarkdown(run, finish) {
|
|
2960
3113
|
const stepMatch = /^(\d+)-(.+)$/.exec(run.step);
|
|
2961
|
-
const
|
|
3114
|
+
const stepLabel2 = stepMatch ? `${stepMatch[1]} - ${stepMatch[2]}` : run.step;
|
|
2962
3115
|
const flowSlug = run.flow.split("/").join("-");
|
|
2963
3116
|
return `# Debug Log
|
|
2964
3117
|
|
|
2965
3118
|
- Run ID: ${run.runId}
|
|
2966
3119
|
- Flow: ${flowSlug}
|
|
2967
|
-
- Step: ${
|
|
3120
|
+
- Step: ${stepLabel2}
|
|
2968
3121
|
- Menu option: ${run.menuOption}
|
|
2969
3122
|
- Date: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
2970
3123
|
- CLI version: ${readPackageVersion()}
|
|
@@ -3026,19 +3179,19 @@ async function readHelpInfo() {
|
|
|
3026
3179
|
}
|
|
3027
3180
|
|
|
3028
3181
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
3029
|
-
import { Fragment as Fragment2, jsx as
|
|
3182
|
+
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3030
3183
|
function Section({ title, rows }) {
|
|
3031
|
-
return /* @__PURE__ */
|
|
3032
|
-
/* @__PURE__ */
|
|
3033
|
-
rows.map((row) => /* @__PURE__ */
|
|
3034
|
-
/* @__PURE__ */
|
|
3035
|
-
/* @__PURE__ */
|
|
3184
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", children: [
|
|
3185
|
+
/* @__PURE__ */ jsx12(Text11, { bold: true, color: PALETTE.accent, children: title }),
|
|
3186
|
+
rows.map((row) => /* @__PURE__ */ jsxs10(Box10, { gap: 1, children: [
|
|
3187
|
+
/* @__PURE__ */ jsx12(Box10, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx12(Text11, { color: PALETTE.muted, children: row.label }) }),
|
|
3188
|
+
/* @__PURE__ */ jsx12(Text11, { children: row.value })
|
|
3036
3189
|
] }, row.label))
|
|
3037
3190
|
] });
|
|
3038
3191
|
}
|
|
3039
3192
|
function HelpScreen({ onDone }) {
|
|
3040
|
-
const [info, setInfo] =
|
|
3041
|
-
|
|
3193
|
+
const [info, setInfo] = useState8();
|
|
3194
|
+
useEffect5(() => {
|
|
3042
3195
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
3043
3196
|
void readHelpInfo().then(setInfo);
|
|
3044
3197
|
}, []);
|
|
@@ -3046,7 +3199,7 @@ function HelpScreen({ onDone }) {
|
|
|
3046
3199
|
void finishDebugRun({ outputs: {}, status: "success", exitMethod });
|
|
3047
3200
|
onDone();
|
|
3048
3201
|
};
|
|
3049
|
-
|
|
3202
|
+
useInput9((input, key) => {
|
|
3050
3203
|
if (key.return) {
|
|
3051
3204
|
leave("saved");
|
|
3052
3205
|
return;
|
|
@@ -3056,14 +3209,14 @@ function HelpScreen({ onDone }) {
|
|
|
3056
3209
|
return;
|
|
3057
3210
|
}
|
|
3058
3211
|
});
|
|
3059
|
-
return /* @__PURE__ */
|
|
3060
|
-
/* @__PURE__ */
|
|
3061
|
-
info ? /* @__PURE__ */
|
|
3062
|
-
/* @__PURE__ */
|
|
3063
|
-
/* @__PURE__ */
|
|
3064
|
-
/* @__PURE__ */
|
|
3065
|
-
] }) : /* @__PURE__ */
|
|
3066
|
-
/* @__PURE__ */
|
|
3212
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 2, paddingY: 1, gap: 1, children: [
|
|
3213
|
+
/* @__PURE__ */ jsx12(Text11, { bold: true, children: "Help" }),
|
|
3214
|
+
info ? /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
3215
|
+
/* @__PURE__ */ jsx12(Section, { title: "Where things are stored", rows: info.storage }),
|
|
3216
|
+
/* @__PURE__ */ jsx12(Section, { title: "Troubleshooting", rows: info.troubleshooting }),
|
|
3217
|
+
/* @__PURE__ */ jsx12(Text11, { color: PALETTE.muted, children: "Hit a problem? Turn on Debug Mode in Settings, reproduce it, then share the session folder above. The CMA token is redacted from those logs." })
|
|
3218
|
+
] }) : /* @__PURE__ */ jsx12(Text11, { color: PALETTE.accent, children: "Loading..." }),
|
|
3219
|
+
/* @__PURE__ */ jsx12(
|
|
3067
3220
|
ControlHints,
|
|
3068
3221
|
{
|
|
3069
3222
|
hints: [
|
|
@@ -3076,20 +3229,20 @@ function HelpScreen({ onDone }) {
|
|
|
3076
3229
|
}
|
|
3077
3230
|
|
|
3078
3231
|
// packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
|
|
3079
|
-
import { useState as
|
|
3080
|
-
import { Box as
|
|
3081
|
-
import { jsx as
|
|
3232
|
+
import { useState as useState9 } from "react";
|
|
3233
|
+
import { Box as Box11, Text as Text12, useInput as useInput10 } from "ink";
|
|
3234
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3082
3235
|
function SettingsScreen({
|
|
3083
3236
|
onNavigate,
|
|
3084
3237
|
onBack
|
|
3085
3238
|
}) {
|
|
3086
|
-
const [focusIdx, setFocusIdx] =
|
|
3239
|
+
const [focusIdx, setFocusIdx] = useState9(0);
|
|
3087
3240
|
const items = [
|
|
3088
3241
|
{ label: "Configuration", screen: "settings-configuration" },
|
|
3089
3242
|
{ label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
|
|
3090
3243
|
{ label: "Debug Mode", screen: "settings-debug-mode" }
|
|
3091
3244
|
];
|
|
3092
|
-
|
|
3245
|
+
useInput10((input, key) => {
|
|
3093
3246
|
if (key.upArrow) {
|
|
3094
3247
|
setFocusIdx((i) => (i - 1 + items.length) % items.length);
|
|
3095
3248
|
return;
|
|
@@ -3109,15 +3262,15 @@ function SettingsScreen({
|
|
|
3109
3262
|
onBack();
|
|
3110
3263
|
}
|
|
3111
3264
|
});
|
|
3112
|
-
return /* @__PURE__ */
|
|
3113
|
-
/* @__PURE__ */
|
|
3114
|
-
/* @__PURE__ */
|
|
3115
|
-
items.map((item, i) => /* @__PURE__ */
|
|
3265
|
+
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
3266
|
+
/* @__PURE__ */ jsx13(Text12, { bold: true, children: "Settings" }),
|
|
3267
|
+
/* @__PURE__ */ jsx13(Text12, { children: " " }),
|
|
3268
|
+
items.map((item, i) => /* @__PURE__ */ jsxs11(Text12, { color: i === focusIdx ? "cyan" : void 0, children: [
|
|
3116
3269
|
i === focusIdx ? "> " : " ",
|
|
3117
3270
|
item.label
|
|
3118
3271
|
] }, item.label)),
|
|
3119
|
-
/* @__PURE__ */
|
|
3120
|
-
/* @__PURE__ */
|
|
3272
|
+
/* @__PURE__ */ jsx13(Text12, { children: " " }),
|
|
3273
|
+
/* @__PURE__ */ jsx13(
|
|
3121
3274
|
ControlHints,
|
|
3122
3275
|
{
|
|
3123
3276
|
hints: [
|
|
@@ -3131,8 +3284,8 @@ function SettingsScreen({
|
|
|
3131
3284
|
}
|
|
3132
3285
|
|
|
3133
3286
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
3134
|
-
import { useEffect as
|
|
3135
|
-
import { Box as
|
|
3287
|
+
import { useEffect as useEffect6, useState as useState10 } from "react";
|
|
3288
|
+
import { Box as Box12, Text as Text13, useInput as useInput11 } from "ink";
|
|
3136
3289
|
import TextInput4 from "ink-text-input";
|
|
3137
3290
|
|
|
3138
3291
|
// packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
|
|
@@ -3164,7 +3317,7 @@ async function writeCredentials(config) {
|
|
|
3164
3317
|
}
|
|
3165
3318
|
|
|
3166
3319
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
3167
|
-
import { Fragment as Fragment3, jsx as
|
|
3320
|
+
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3168
3321
|
var FIELD_ORDER = [
|
|
3169
3322
|
"spaceId",
|
|
3170
3323
|
"environmentId",
|
|
@@ -3192,14 +3345,14 @@ var FIELD_LABELS = {
|
|
|
3192
3345
|
defaultTokenFile: "Default token file (optional)"
|
|
3193
3346
|
};
|
|
3194
3347
|
function ConfigurationScreen({ onDone }) {
|
|
3195
|
-
const [stage, setStage] =
|
|
3196
|
-
const [config, setConfig] =
|
|
3197
|
-
const [activeField, setActiveField] =
|
|
3198
|
-
const [notice, setNotice] =
|
|
3199
|
-
const [lastSaved, setLastSaved] =
|
|
3200
|
-
const [editing, setEditing] =
|
|
3201
|
-
const [valueBeforeEdit, setValueBeforeEdit] =
|
|
3202
|
-
|
|
3348
|
+
const [stage, setStage] = useState10("loading");
|
|
3349
|
+
const [config, setConfig] = useState10(null);
|
|
3350
|
+
const [activeField, setActiveField] = useState10("spaceId");
|
|
3351
|
+
const [notice, setNotice] = useState10(null);
|
|
3352
|
+
const [lastSaved, setLastSaved] = useState10(null);
|
|
3353
|
+
const [editing, setEditing] = useState10(false);
|
|
3354
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState10("");
|
|
3355
|
+
useEffect6(() => {
|
|
3203
3356
|
readCredentials().then((cfg) => {
|
|
3204
3357
|
setConfig(cfg);
|
|
3205
3358
|
setStage("form");
|
|
@@ -3239,7 +3392,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
3239
3392
|
);
|
|
3240
3393
|
onDone();
|
|
3241
3394
|
}
|
|
3242
|
-
|
|
3395
|
+
useInput11((input, key) => {
|
|
3243
3396
|
if (stage === "loading" || stage === "saving") return;
|
|
3244
3397
|
if (editing) {
|
|
3245
3398
|
if (key.escape) {
|
|
@@ -3276,26 +3429,26 @@ function ConfigurationScreen({ onDone }) {
|
|
|
3276
3429
|
}
|
|
3277
3430
|
});
|
|
3278
3431
|
if (stage === "loading") {
|
|
3279
|
-
return /* @__PURE__ */
|
|
3280
|
-
/* @__PURE__ */
|
|
3281
|
-
/* @__PURE__ */
|
|
3282
|
-
/* @__PURE__ */
|
|
3432
|
+
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
3433
|
+
/* @__PURE__ */ jsx14(Text13, { bold: true, children: "Configuration" }),
|
|
3434
|
+
/* @__PURE__ */ jsx14(Text13, { children: " " }),
|
|
3435
|
+
/* @__PURE__ */ jsx14(Text13, { color: PALETTE.accent, children: "Loading..." })
|
|
3283
3436
|
] });
|
|
3284
3437
|
}
|
|
3285
|
-
return /* @__PURE__ */
|
|
3286
|
-
/* @__PURE__ */
|
|
3287
|
-
/* @__PURE__ */
|
|
3288
|
-
/* @__PURE__ */
|
|
3438
|
+
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
3439
|
+
/* @__PURE__ */ jsx14(Text13, { bold: true, children: "Configuration" }),
|
|
3440
|
+
/* @__PURE__ */ jsx14(Text13, { children: " " }),
|
|
3441
|
+
/* @__PURE__ */ jsx14(Box12, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
|
|
3289
3442
|
const isActive = activeField === field;
|
|
3290
3443
|
const value = fieldValue(field);
|
|
3291
3444
|
const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
|
|
3292
|
-
return /* @__PURE__ */
|
|
3293
|
-
/* @__PURE__ */
|
|
3294
|
-
/* @__PURE__ */
|
|
3445
|
+
return /* @__PURE__ */ jsxs12(Box12, { gap: 1, children: [
|
|
3446
|
+
/* @__PURE__ */ jsx14(Text13, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
3447
|
+
/* @__PURE__ */ jsxs12(Text13, { bold: isActive, children: [
|
|
3295
3448
|
FIELD_LABELS[field],
|
|
3296
3449
|
":"
|
|
3297
3450
|
] }),
|
|
3298
|
-
isActive && editing ? /* @__PURE__ */
|
|
3451
|
+
isActive && editing ? /* @__PURE__ */ jsx14(
|
|
3299
3452
|
TextInput4,
|
|
3300
3453
|
{
|
|
3301
3454
|
value,
|
|
@@ -3303,19 +3456,19 @@ function ConfigurationScreen({ onDone }) {
|
|
|
3303
3456
|
onSubmit: () => setEditing(false),
|
|
3304
3457
|
mask: field === "cmaToken" ? "\u2022" : void 0
|
|
3305
3458
|
}
|
|
3306
|
-
) : /* @__PURE__ */
|
|
3459
|
+
) : /* @__PURE__ */ jsx14(Text13, { children: display || /* @__PURE__ */ jsx14(Text13, { color: PALETTE.muted, children: "(empty)" }) })
|
|
3307
3460
|
] }, field);
|
|
3308
3461
|
}) }),
|
|
3309
|
-
notice && /* @__PURE__ */
|
|
3310
|
-
/* @__PURE__ */
|
|
3311
|
-
/* @__PURE__ */
|
|
3462
|
+
notice && /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
3463
|
+
/* @__PURE__ */ jsx14(Text13, { children: " " }),
|
|
3464
|
+
/* @__PURE__ */ jsxs12(Text13, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
3312
3465
|
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
3313
3466
|
" ",
|
|
3314
3467
|
notice.text
|
|
3315
3468
|
] })
|
|
3316
3469
|
] }),
|
|
3317
|
-
/* @__PURE__ */
|
|
3318
|
-
/* @__PURE__ */
|
|
3470
|
+
/* @__PURE__ */ jsx14(Text13, { children: " " }),
|
|
3471
|
+
/* @__PURE__ */ jsx14(
|
|
3319
3472
|
ControlHints,
|
|
3320
3473
|
{
|
|
3321
3474
|
hints: editing ? [
|
|
@@ -3336,8 +3489,8 @@ function ConfigurationScreen({ onDone }) {
|
|
|
3336
3489
|
}
|
|
3337
3490
|
|
|
3338
3491
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
3339
|
-
import { useEffect as
|
|
3340
|
-
import { Box as
|
|
3492
|
+
import { useEffect as useEffect7, useState as useState11 } from "react";
|
|
3493
|
+
import { Box as Box13, Text as Text14, useInput as useInput12 } from "ink";
|
|
3341
3494
|
|
|
3342
3495
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
|
|
3343
3496
|
async function readAnalyticsSetting() {
|
|
@@ -3355,11 +3508,11 @@ async function writeAnalyticsSetting(setting) {
|
|
|
3355
3508
|
}
|
|
3356
3509
|
|
|
3357
3510
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
3358
|
-
import { Fragment as Fragment4, jsx as
|
|
3511
|
+
import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3359
3512
|
function OptInAnalyticsScreen({ onDone }) {
|
|
3360
|
-
const [loading, setLoading] =
|
|
3361
|
-
const [enabled, setEnabled] =
|
|
3362
|
-
|
|
3513
|
+
const [loading, setLoading] = useState11(true);
|
|
3514
|
+
const [enabled, setEnabled] = useState11(true);
|
|
3515
|
+
useEffect7(() => {
|
|
3363
3516
|
readAnalyticsSetting().then((setting) => {
|
|
3364
3517
|
setEnabled(setting.enabled);
|
|
3365
3518
|
setLoading(false);
|
|
@@ -3371,7 +3524,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
3371
3524
|
});
|
|
3372
3525
|
});
|
|
3373
3526
|
}, []);
|
|
3374
|
-
|
|
3527
|
+
useInput12((input, key) => {
|
|
3375
3528
|
if (loading) return;
|
|
3376
3529
|
if (key.return || input === " ") {
|
|
3377
3530
|
setEnabled((current) => {
|
|
@@ -3386,21 +3539,21 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
3386
3539
|
onDone();
|
|
3387
3540
|
}
|
|
3388
3541
|
});
|
|
3389
|
-
return /* @__PURE__ */
|
|
3390
|
-
/* @__PURE__ */
|
|
3391
|
-
/* @__PURE__ */
|
|
3392
|
-
loading ? /* @__PURE__ */
|
|
3393
|
-
/* @__PURE__ */
|
|
3542
|
+
return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
3543
|
+
/* @__PURE__ */ jsx15(Text14, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
|
|
3544
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
3545
|
+
loading ? /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
3546
|
+
/* @__PURE__ */ jsxs13(Text14, { children: [
|
|
3394
3547
|
"Share anonymous usage data:",
|
|
3395
3548
|
" ",
|
|
3396
|
-
/* @__PURE__ */
|
|
3549
|
+
/* @__PURE__ */ jsx15(Text14, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
3397
3550
|
] }),
|
|
3398
|
-
/* @__PURE__ */
|
|
3399
|
-
/* @__PURE__ */
|
|
3400
|
-
/* @__PURE__ */
|
|
3551
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
3552
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Shares which CLI commands are used and where imports succeed or fail." }),
|
|
3553
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Never includes source code, file paths, credentials, or authored content." })
|
|
3401
3554
|
] }),
|
|
3402
|
-
/* @__PURE__ */
|
|
3403
|
-
/* @__PURE__ */
|
|
3555
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
3556
|
+
/* @__PURE__ */ jsx15(
|
|
3404
3557
|
ControlHints,
|
|
3405
3558
|
{
|
|
3406
3559
|
hints: [
|
|
@@ -3413,13 +3566,13 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
3413
3566
|
}
|
|
3414
3567
|
|
|
3415
3568
|
// packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
|
|
3416
|
-
import { useEffect as
|
|
3417
|
-
import { Box as
|
|
3418
|
-
import { jsx as
|
|
3569
|
+
import { useEffect as useEffect8, useState as useState12 } from "react";
|
|
3570
|
+
import { Box as Box14, Text as Text15, useInput as useInput13 } from "ink";
|
|
3571
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3419
3572
|
var UPGRADE_COMMANDS = ["git pull", "pnpm install", "pnpm build"];
|
|
3420
3573
|
function UpgradeScreen({ onDone }) {
|
|
3421
|
-
const [upgradeCheck, setUpgradeCheck] =
|
|
3422
|
-
|
|
3574
|
+
const [upgradeCheck, setUpgradeCheck] = useState12();
|
|
3575
|
+
useEffect8(() => {
|
|
3423
3576
|
startDebugRun({
|
|
3424
3577
|
flow: "upgrade",
|
|
3425
3578
|
step: "01-upgrade",
|
|
@@ -3428,7 +3581,7 @@ function UpgradeScreen({ onDone }) {
|
|
|
3428
3581
|
});
|
|
3429
3582
|
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
3430
3583
|
}, []);
|
|
3431
|
-
|
|
3584
|
+
useInput13((_input, key) => {
|
|
3432
3585
|
if (key.return) {
|
|
3433
3586
|
void finishDebugRun({
|
|
3434
3587
|
outputs: upgradeCheck ?? {},
|
|
@@ -3439,12 +3592,12 @@ function UpgradeScreen({ onDone }) {
|
|
|
3439
3592
|
return;
|
|
3440
3593
|
}
|
|
3441
3594
|
});
|
|
3442
|
-
return /* @__PURE__ */
|
|
3443
|
-
/* @__PURE__ */
|
|
3444
|
-
/* @__PURE__ */
|
|
3595
|
+
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
3596
|
+
/* @__PURE__ */ jsx16(Text15, { bold: true, children: "Upgrade" }),
|
|
3597
|
+
/* @__PURE__ */ jsx16(Text15, { children: " " }),
|
|
3445
3598
|
renderBody(upgradeCheck),
|
|
3446
|
-
/* @__PURE__ */
|
|
3447
|
-
/* @__PURE__ */
|
|
3599
|
+
/* @__PURE__ */ jsx16(Text15, { children: " " }),
|
|
3600
|
+
/* @__PURE__ */ jsxs14(Text15, { bold: true, color: PALETTE.accent, children: [
|
|
3448
3601
|
FOCUS_MARKER,
|
|
3449
3602
|
" Go Back"
|
|
3450
3603
|
] })
|
|
@@ -3452,45 +3605,45 @@ function UpgradeScreen({ onDone }) {
|
|
|
3452
3605
|
}
|
|
3453
3606
|
function renderBody(upgradeCheck) {
|
|
3454
3607
|
if (!upgradeCheck) {
|
|
3455
|
-
return /* @__PURE__ */
|
|
3608
|
+
return /* @__PURE__ */ jsx16(Text15, { color: PALETTE.muted, children: "Checking for updates\u2026" });
|
|
3456
3609
|
}
|
|
3457
3610
|
if (upgradeCheck.status === "error") {
|
|
3458
|
-
return /* @__PURE__ */
|
|
3611
|
+
return /* @__PURE__ */ jsx16(Text15, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
|
|
3459
3612
|
}
|
|
3460
3613
|
if (upgradeCheck.status === "up-to-date") {
|
|
3461
|
-
return /* @__PURE__ */
|
|
3614
|
+
return /* @__PURE__ */ jsxs14(Text15, { color: PALETTE.success, children: [
|
|
3462
3615
|
"You're already on the latest version (v",
|
|
3463
3616
|
upgradeCheck.current,
|
|
3464
3617
|
")."
|
|
3465
3618
|
] });
|
|
3466
3619
|
}
|
|
3467
|
-
return /* @__PURE__ */
|
|
3468
|
-
/* @__PURE__ */
|
|
3469
|
-
/* @__PURE__ */
|
|
3620
|
+
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", children: [
|
|
3621
|
+
/* @__PURE__ */ jsxs14(Text15, { color: PALETTE.muted, children: [
|
|
3622
|
+
/* @__PURE__ */ jsxs14(Text15, { bold: true, color: PALETTE.success, children: [
|
|
3470
3623
|
"v",
|
|
3471
3624
|
upgradeCheck.latest
|
|
3472
3625
|
] }),
|
|
3473
3626
|
" ",
|
|
3474
3627
|
"is available (you're on ",
|
|
3475
|
-
/* @__PURE__ */
|
|
3628
|
+
/* @__PURE__ */ jsxs14(Text15, { bold: true, children: [
|
|
3476
3629
|
"v",
|
|
3477
3630
|
upgradeCheck.current
|
|
3478
3631
|
] }),
|
|
3479
3632
|
"). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
|
|
3480
3633
|
] }),
|
|
3481
|
-
/* @__PURE__ */
|
|
3482
|
-
/* @__PURE__ */
|
|
3634
|
+
/* @__PURE__ */ jsx16(Text15, { children: " " }),
|
|
3635
|
+
/* @__PURE__ */ jsx16(Box14, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx16(Text15, { bold: true, children: cmd }, cmd)) })
|
|
3483
3636
|
] });
|
|
3484
3637
|
}
|
|
3485
3638
|
|
|
3486
3639
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
3487
|
-
import { useEffect as
|
|
3488
|
-
import { Box as
|
|
3489
|
-
import { jsx as
|
|
3640
|
+
import { useEffect as useEffect9, useState as useState13 } from "react";
|
|
3641
|
+
import { Box as Box15, Text as Text16, useInput as useInput14 } from "ink";
|
|
3642
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3490
3643
|
function DebugModeScreen({ onDone }) {
|
|
3491
|
-
const [loading, setLoading] =
|
|
3492
|
-
const [enabled, setEnabled] =
|
|
3493
|
-
|
|
3644
|
+
const [loading, setLoading] = useState13(true);
|
|
3645
|
+
const [enabled, setEnabled] = useState13(true);
|
|
3646
|
+
useEffect9(() => {
|
|
3494
3647
|
readDebugModeSetting().then((setting) => {
|
|
3495
3648
|
setEnabled(setting.enabled);
|
|
3496
3649
|
setLoading(false);
|
|
@@ -3502,7 +3655,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
3502
3655
|
});
|
|
3503
3656
|
});
|
|
3504
3657
|
}, []);
|
|
3505
|
-
|
|
3658
|
+
useInput14((input, key) => {
|
|
3506
3659
|
if (loading) return;
|
|
3507
3660
|
if (key.return || input === " ") {
|
|
3508
3661
|
setEnabled((current) => {
|
|
@@ -3517,16 +3670,16 @@ function DebugModeScreen({ onDone }) {
|
|
|
3517
3670
|
onDone();
|
|
3518
3671
|
}
|
|
3519
3672
|
});
|
|
3520
|
-
return /* @__PURE__ */
|
|
3521
|
-
/* @__PURE__ */
|
|
3522
|
-
/* @__PURE__ */
|
|
3523
|
-
loading ? /* @__PURE__ */
|
|
3673
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
3674
|
+
/* @__PURE__ */ jsx17(Text16, { bold: true, children: "Settings \u203A Debug Mode" }),
|
|
3675
|
+
/* @__PURE__ */ jsx17(Text16, { children: " " }),
|
|
3676
|
+
loading ? /* @__PURE__ */ jsx17(Text16, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs15(Text16, { children: [
|
|
3524
3677
|
"Debug logging:",
|
|
3525
3678
|
" ",
|
|
3526
|
-
/* @__PURE__ */
|
|
3679
|
+
/* @__PURE__ */ jsx17(Text16, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
3527
3680
|
] }),
|
|
3528
|
-
/* @__PURE__ */
|
|
3529
|
-
/* @__PURE__ */
|
|
3681
|
+
/* @__PURE__ */ jsx17(Text16, { children: " " }),
|
|
3682
|
+
/* @__PURE__ */ jsx17(
|
|
3530
3683
|
ControlHints,
|
|
3531
3684
|
{
|
|
3532
3685
|
hints: [
|
|
@@ -3539,16 +3692,17 @@ function DebugModeScreen({ onDone }) {
|
|
|
3539
3692
|
}
|
|
3540
3693
|
|
|
3541
3694
|
// packages/experience-design-system-cli/app.tsx
|
|
3542
|
-
import { Fragment as Fragment5, jsx as
|
|
3695
|
+
import { Fragment as Fragment5, jsx as jsx18 } from "react/jsx-runtime";
|
|
3543
3696
|
function App({ importOptions, onLaunchImport, importExitCode }) {
|
|
3544
3697
|
const returnedFromImport = importExitCode !== void 0;
|
|
3545
|
-
const [screen, setScreen] =
|
|
3546
|
-
const [showImportResult, setShowImportResult] =
|
|
3547
|
-
const [projectPath, setProjectPath] =
|
|
3548
|
-
const [tokensPath, setTokensPath] =
|
|
3549
|
-
const [scannedFiles, setScannedFiles] =
|
|
3550
|
-
const [
|
|
3551
|
-
|
|
3698
|
+
const [screen, setScreen] = useState14(returnedFromImport ? "import" : "start");
|
|
3699
|
+
const [showImportResult, setShowImportResult] = useState14(returnedFromImport);
|
|
3700
|
+
const [projectPath, setProjectPath] = useState14();
|
|
3701
|
+
const [tokensPath, setTokensPath] = useState14();
|
|
3702
|
+
const [scannedFiles, setScannedFiles] = useState14();
|
|
3703
|
+
const [pendingLaunch, setPendingLaunch] = useState14();
|
|
3704
|
+
const [importDefaults, setImportDefaults] = useState14();
|
|
3705
|
+
useEffect10(() => {
|
|
3552
3706
|
if (screen !== "import") {
|
|
3553
3707
|
setImportDefaults(void 0);
|
|
3554
3708
|
return;
|
|
@@ -3563,7 +3717,27 @@ function App({ importOptions, onLaunchImport, importExitCode }) {
|
|
|
3563
3717
|
}, [screen]);
|
|
3564
3718
|
const finishCredentials = async (result, projectPath2, tokens, filePaths) => {
|
|
3565
3719
|
if (!result.skipped) await writeCredentials({ ...result.credentials });
|
|
3566
|
-
|
|
3720
|
+
const launch = {
|
|
3721
|
+
projectPath: projectPath2,
|
|
3722
|
+
tokens,
|
|
3723
|
+
filePaths,
|
|
3724
|
+
skipCredentials: result.skipped,
|
|
3725
|
+
...importOptions
|
|
3726
|
+
};
|
|
3727
|
+
const state = await inspectTokens({
|
|
3728
|
+
rawTokensPath: tokens,
|
|
3729
|
+
outDir: join7(resolveUserPath(projectPath2), ".contentful"),
|
|
3730
|
+
cache: importOptions.cache
|
|
3731
|
+
});
|
|
3732
|
+
if (state.kind === "cached") {
|
|
3733
|
+
setPendingLaunch({ launch, cached: { tokensPath: state.tokensPath, sourceChanged: state.sourceChanged } });
|
|
3734
|
+
return;
|
|
3735
|
+
}
|
|
3736
|
+
onLaunchImport?.({ ...launch, tokenStrategy: "generate" });
|
|
3737
|
+
};
|
|
3738
|
+
const chooseTokenStrategy = (pending, tokenStrategy) => {
|
|
3739
|
+
setPendingLaunch(void 0);
|
|
3740
|
+
onLaunchImport?.({ ...pending.launch, tokenStrategy });
|
|
3567
3741
|
};
|
|
3568
3742
|
const goToStart = () => setScreen("start");
|
|
3569
3743
|
const goToSettings = () => setScreen("settings");
|
|
@@ -3571,6 +3745,7 @@ function App({ importOptions, onLaunchImport, importExitCode }) {
|
|
|
3571
3745
|
setProjectPath(void 0);
|
|
3572
3746
|
setTokensPath(void 0);
|
|
3573
3747
|
setScannedFiles(void 0);
|
|
3748
|
+
setPendingLaunch(void 0);
|
|
3574
3749
|
};
|
|
3575
3750
|
const finishImportResult = () => {
|
|
3576
3751
|
setShowImportResult(false);
|
|
@@ -3583,13 +3758,13 @@ function App({ importOptions, onLaunchImport, importExitCode }) {
|
|
|
3583
3758
|
};
|
|
3584
3759
|
switch (screen) {
|
|
3585
3760
|
case "import":
|
|
3586
|
-
if (showImportResult) return /* @__PURE__ */
|
|
3587
|
-
if (importDefaults === void 0) return /* @__PURE__ */
|
|
3761
|
+
if (showImportResult) return /* @__PURE__ */ jsx18(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
|
|
3762
|
+
if (importDefaults === void 0) return /* @__PURE__ */ jsx18(Fragment5, {});
|
|
3588
3763
|
if (projectPath === void 0) {
|
|
3589
|
-
return /* @__PURE__ */
|
|
3764
|
+
return /* @__PURE__ */ jsx18(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
|
|
3590
3765
|
}
|
|
3591
3766
|
if (tokensPath === void 0) {
|
|
3592
|
-
return /* @__PURE__ */
|
|
3767
|
+
return /* @__PURE__ */ jsx18(
|
|
3593
3768
|
TokenInputScreen,
|
|
3594
3769
|
{
|
|
3595
3770
|
initialPath: importDefaults.tokenFile,
|
|
@@ -3599,7 +3774,7 @@ function App({ importOptions, onLaunchImport, importExitCode }) {
|
|
|
3599
3774
|
);
|
|
3600
3775
|
}
|
|
3601
3776
|
if (scannedFiles === void 0) {
|
|
3602
|
-
return /* @__PURE__ */
|
|
3777
|
+
return /* @__PURE__ */ jsx18(
|
|
3603
3778
|
PathValidationScreen,
|
|
3604
3779
|
{
|
|
3605
3780
|
projectPath,
|
|
@@ -3609,7 +3784,19 @@ function App({ importOptions, onLaunchImport, importExitCode }) {
|
|
|
3609
3784
|
}
|
|
3610
3785
|
);
|
|
3611
3786
|
}
|
|
3612
|
-
|
|
3787
|
+
if (pendingLaunch?.cached) {
|
|
3788
|
+
return /* @__PURE__ */ jsx18(
|
|
3789
|
+
TokenReuseScreen,
|
|
3790
|
+
{
|
|
3791
|
+
tokensPath: pendingLaunch.cached.tokensPath,
|
|
3792
|
+
sourceChanged: pendingLaunch.cached.sourceChanged,
|
|
3793
|
+
onReuse: () => chooseTokenStrategy(pendingLaunch, "reuse"),
|
|
3794
|
+
onRegenerate: () => chooseTokenStrategy(pendingLaunch, "regenerate"),
|
|
3795
|
+
onQuit: leaveImport
|
|
3796
|
+
}
|
|
3797
|
+
);
|
|
3798
|
+
}
|
|
3799
|
+
return /* @__PURE__ */ jsx18(
|
|
3613
3800
|
CredentialsScreen,
|
|
3614
3801
|
{
|
|
3615
3802
|
initial: importDefaults.credentials,
|
|
@@ -3618,26 +3805,26 @@ function App({ importOptions, onLaunchImport, importExitCode }) {
|
|
|
3618
3805
|
}
|
|
3619
3806
|
);
|
|
3620
3807
|
case "help":
|
|
3621
|
-
return /* @__PURE__ */
|
|
3808
|
+
return /* @__PURE__ */ jsx18(HelpScreen, { onDone: goToStart });
|
|
3622
3809
|
case "upgrade":
|
|
3623
|
-
return /* @__PURE__ */
|
|
3810
|
+
return /* @__PURE__ */ jsx18(UpgradeScreen, { onDone: goToStart });
|
|
3624
3811
|
case "settings":
|
|
3625
|
-
return /* @__PURE__ */
|
|
3812
|
+
return /* @__PURE__ */ jsx18(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
3626
3813
|
case "settings-configuration":
|
|
3627
|
-
return /* @__PURE__ */
|
|
3814
|
+
return /* @__PURE__ */ jsx18(ConfigurationScreen, { onDone: goToSettings });
|
|
3628
3815
|
case "settings-opt-in-analytics":
|
|
3629
|
-
return /* @__PURE__ */
|
|
3816
|
+
return /* @__PURE__ */ jsx18(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
3630
3817
|
case "settings-debug-mode":
|
|
3631
|
-
return /* @__PURE__ */
|
|
3818
|
+
return /* @__PURE__ */ jsx18(DebugModeScreen, { onDone: goToSettings });
|
|
3632
3819
|
case "start":
|
|
3633
|
-
return /* @__PURE__ */
|
|
3820
|
+
return /* @__PURE__ */ jsx18(HomeScreen, { onNavigate: setScreen });
|
|
3634
3821
|
}
|
|
3635
3822
|
}
|
|
3636
3823
|
var CLEAR_SCREEN = "\x1B[2J\x1B[H";
|
|
3637
3824
|
async function renderUntilImportRequestedOrExit(renderApp, importOptions, importExitCode) {
|
|
3638
3825
|
let requestedImport;
|
|
3639
3826
|
const instance = renderApp(
|
|
3640
|
-
/* @__PURE__ */
|
|
3827
|
+
/* @__PURE__ */ jsx18(
|
|
3641
3828
|
App,
|
|
3642
3829
|
{
|
|
3643
3830
|
importOptions,
|