@contentful/experience-design-system-cli 2.35.1-dev-build-041b6e0a.0 → 2.35.1-dev-build-c4a4d1cd.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 CHANGED
@@ -251,52 +251,6 @@ ${candidates.join("\n")}`);
251
251
  return found;
252
252
  }
253
253
 
254
- // packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts
255
- function buildArgs(options) {
256
- const args = ["import"];
257
- if (options.project) {
258
- args.push("--project", options.project);
259
- }
260
- return args;
261
- }
262
- async function spawnV1Import(options = {}) {
263
- const cliPath = findLegacyCliPath();
264
- const args = buildArgs(options);
265
- return new Promise((resolvePromise) => {
266
- const child = spawn("node", [cliPath, ...args], {
267
- stdio: "inherit"
268
- });
269
- child.on("close", (code) => {
270
- resolvePromise({ exitCode: code ?? 1, result: void 0, stdout: "", stderr: "" });
271
- });
272
- child.on("error", (err) => {
273
- resolvePromise({ exitCode: 1, result: void 0, stdout: "", stderr: err.message });
274
- });
275
- });
276
- }
277
-
278
- // packages/experience-design-system-cli/src/tui/import/terminal-input.ts
279
- function getTerminalHandle() {
280
- return process.stdin._handle;
281
- }
282
- async function stopReadingTerminal() {
283
- await new Promise((resolve) => setImmediate(resolve));
284
- const handle = getTerminalHandle();
285
- if (!handle?.readStop) return;
286
- handle.reading = false;
287
- handle.readStop();
288
- }
289
- function startReadingTerminal() {
290
- const handle = getTerminalHandle();
291
- if (!handle?.readStart) return;
292
- handle.reading = true;
293
- handle.readStart();
294
- }
295
-
296
- // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
297
- import { useEffect as useEffect3 } from "react";
298
- import { Box as Box3, Text as Text3, useInput as useInput3 } from "ink";
299
-
300
254
  // packages/experience-design-system-cli/src/tui/debug-store.ts
301
255
  import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
302
256
  import { existsSync as existsSync3, readdirSync } from "node:fs";
@@ -361,6 +315,9 @@ var SESSION_ID = generateSessionId();
361
315
  function sessionDebugDir() {
362
316
  return join5(sessionsRootDir(), SESSION_ID);
363
317
  }
318
+ async function debugSessionDirIfEnabled() {
319
+ return await isDebugModeEnabled() ? sessionDebugDir() : void 0;
320
+ }
364
321
  void isDebugModeEnabled().then((enabled) => {
365
322
  if (!enabled) return void 0;
366
323
  return mkdir2(sessionDebugDir(), { recursive: true });
@@ -468,7 +425,53 @@ process.once("SIGINT", () => {
468
425
  });
469
426
  });
470
427
 
428
+ // packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts
429
+ function buildArgs(options) {
430
+ const args = ["import"];
431
+ if (options.project) {
432
+ args.push("--project", options.project);
433
+ }
434
+ return args;
435
+ }
436
+ async function spawnV1Import(options = {}) {
437
+ const cliPath = findLegacyCliPath();
438
+ const args = buildArgs(options);
439
+ const debugSessionDir = await debugSessionDirIfEnabled();
440
+ return new Promise((resolvePromise) => {
441
+ const child = spawn("node", [cliPath, ...args], {
442
+ stdio: "inherit",
443
+ env: debugSessionDir ? { ...process.env, EDS_DEBUG_SESSION_DIR: debugSessionDir } : process.env
444
+ });
445
+ child.on("close", (code) => {
446
+ resolvePromise({ exitCode: code ?? 1, result: void 0, stdout: "", stderr: "" });
447
+ });
448
+ child.on("error", (err) => {
449
+ resolvePromise({ exitCode: 1, result: void 0, stdout: "", stderr: err.message });
450
+ });
451
+ });
452
+ }
453
+
454
+ // packages/experience-design-system-cli/src/tui/import/terminal-input.ts
455
+ function getTerminalHandle() {
456
+ return process.stdin._handle;
457
+ }
458
+ async function stopReadingTerminal() {
459
+ await new Promise((resolve) => setImmediate(resolve));
460
+ const handle = getTerminalHandle();
461
+ if (!handle?.readStop) return;
462
+ handle.reading = false;
463
+ handle.readStop();
464
+ }
465
+ function startReadingTerminal() {
466
+ const handle = getTerminalHandle();
467
+ if (!handle?.readStart) return;
468
+ handle.reading = true;
469
+ handle.readStart();
470
+ }
471
+
471
472
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
473
+ import { useEffect as useEffect3 } from "react";
474
+ import { Box as Box3, Text as Text3, useInput as useInput3 } from "ink";
472
475
  import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
473
476
  function HelpScreen({ onDone }) {
474
477
  useEffect3(() => {
@@ -498,7 +501,7 @@ function HelpScreen({ onDone }) {
498
501
  }
499
502
 
500
503
  // packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
501
- import { useEffect as useEffect4, useState as useState3 } from "react";
504
+ import { useState as useState3 } from "react";
502
505
  import { Box as Box4, Text as Text4, useInput as useInput4 } from "ink";
503
506
  import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
504
507
  function SettingsScreen({
@@ -511,14 +514,6 @@ function SettingsScreen({
511
514
  { label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
512
515
  { label: "Debug Mode", screen: "settings-debug-mode" }
513
516
  ];
514
- useEffect4(() => {
515
- startDebugRun({
516
- flow: "settings",
517
- step: "01-settings",
518
- menuOption: "Settings",
519
- inputs: { options: items.map((item) => item.label) }
520
- });
521
- }, []);
522
517
  useInput4((input, key) => {
523
518
  if (key.upArrow) {
524
519
  setFocusIdx((i) => (i - 1 + items.length) % items.length);
@@ -531,17 +526,11 @@ function SettingsScreen({
531
526
  if (key.return) {
532
527
  const screen = items[focusIdx].screen;
533
528
  if (screen) {
534
- void finishDebugRun({
535
- outputs: { selected: items[focusIdx].label },
536
- status: "success",
537
- exitMethod: "saved"
538
- });
539
529
  onNavigate(screen);
540
530
  }
541
531
  return;
542
532
  }
543
533
  if (key.escape || input === "q") {
544
- void finishDebugRun({ outputs: {}, status: "success", exitMethod: "discarded" });
545
534
  onBack();
546
535
  }
547
536
  });
@@ -558,7 +547,7 @@ function SettingsScreen({
558
547
  }
559
548
 
560
549
  // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
561
- import { useEffect as useEffect5, useState as useState4 } from "react";
550
+ import { useEffect as useEffect4, useState as useState4 } from "react";
562
551
  import { Box as Box5, Text as Text5, useInput as useInput5 } from "ink";
563
552
 
564
553
  // packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
@@ -624,7 +613,7 @@ function ConfigurationScreen({ onDone }) {
624
613
  const [config, setConfig] = useState4(null);
625
614
  const [activeField, setActiveField] = useState4("spaceId");
626
615
  const [message, setMessage] = useState4(null);
627
- useEffect5(() => {
616
+ useEffect4(() => {
628
617
  readCredentials().then((cfg) => {
629
618
  setConfig(cfg);
630
619
  setStage("form");
@@ -748,7 +737,7 @@ function ConfigurationScreen({ onDone }) {
748
737
  }
749
738
 
750
739
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
751
- import { useEffect as useEffect6, useState as useState5 } from "react";
740
+ import { useEffect as useEffect5, useState as useState5 } from "react";
752
741
  import { Box as Box6, Text as Text6, useInput as useInput6 } from "ink";
753
742
 
754
743
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
@@ -771,7 +760,7 @@ import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-run
771
760
  function OptInAnalyticsScreen({ onDone }) {
772
761
  const [loading, setLoading] = useState5(true);
773
762
  const [enabled, setEnabled] = useState5(true);
774
- useEffect6(() => {
763
+ useEffect5(() => {
775
764
  readAnalyticsSetting().then((setting) => {
776
765
  setEnabled(setting.enabled);
777
766
  setLoading(false);
@@ -817,13 +806,13 @@ function OptInAnalyticsScreen({ onDone }) {
817
806
  }
818
807
 
819
808
  // packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
820
- import { useEffect as useEffect7, useState as useState6 } from "react";
809
+ import { useEffect as useEffect6, useState as useState6 } from "react";
821
810
  import { Box as Box7, Text as Text7, useInput as useInput7 } from "ink";
822
811
  import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
823
812
  var UPGRADE_COMMANDS = ["git pull", "pnpm install", "pnpm build"];
824
813
  function UpgradeScreen({ onDone }) {
825
814
  const [upgradeCheck, setUpgradeCheck] = useState6();
826
- useEffect7(() => {
815
+ useEffect6(() => {
827
816
  startDebugRun({
828
817
  flow: "upgrade",
829
818
  step: "01-upgrade",
@@ -888,13 +877,13 @@ function renderBody(upgradeCheck) {
888
877
  }
889
878
 
890
879
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
891
- import { useEffect as useEffect8, useState as useState7 } from "react";
880
+ import { useEffect as useEffect7, useState as useState7 } from "react";
892
881
  import { Box as Box8, Text as Text8, useInput as useInput8 } from "ink";
893
882
  import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
894
883
  function DebugModeScreen({ onDone }) {
895
884
  const [loading, setLoading] = useState7(true);
896
885
  const [enabled, setEnabled] = useState7(true);
897
- useEffect8(() => {
886
+ useEffect7(() => {
898
887
  readDebugModeSetting().then((setting) => {
899
888
  setEnabled(setting.enabled);
900
889
  setLoading(false);
package/dist/index.js CHANGED
@@ -297,60 +297,6 @@ var init_PageContainer = __esm({
297
297
  }
298
298
  });
299
299
 
300
- // packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts
301
- import { spawn as spawn2 } from "node:child_process";
302
- function buildArgs(options) {
303
- const args = ["import"];
304
- if (options.project) {
305
- args.push("--project", options.project);
306
- }
307
- return args;
308
- }
309
- async function spawnV1Import(options = {}) {
310
- const cliPath = findLegacyCliPath();
311
- const args = buildArgs(options);
312
- return new Promise((resolvePromise) => {
313
- const child = spawn2("node", [cliPath, ...args], {
314
- stdio: "inherit"
315
- });
316
- child.on("close", (code) => {
317
- resolvePromise({ exitCode: code ?? 1, result: void 0, stdout: "", stderr: "" });
318
- });
319
- child.on("error", (err) => {
320
- resolvePromise({ exitCode: 1, result: void 0, stdout: "", stderr: err.message });
321
- });
322
- });
323
- }
324
- var init_spawn_v1_import = __esm({
325
- "packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts"() {
326
- "use strict";
327
- init_legacy_cli_path();
328
- }
329
- });
330
-
331
- // packages/experience-design-system-cli/src/tui/import/terminal-input.ts
332
- function getTerminalHandle() {
333
- return process.stdin._handle;
334
- }
335
- async function stopReadingTerminal() {
336
- await new Promise((resolve) => setImmediate(resolve));
337
- const handle = getTerminalHandle();
338
- if (!handle?.readStop) return;
339
- handle.reading = false;
340
- handle.readStop();
341
- }
342
- function startReadingTerminal() {
343
- const handle = getTerminalHandle();
344
- if (!handle?.readStart) return;
345
- handle.reading = true;
346
- handle.readStart();
347
- }
348
- var init_terminal_input = __esm({
349
- "packages/experience-design-system-cli/src/tui/import/terminal-input.ts"() {
350
- "use strict";
351
- }
352
- });
353
-
354
300
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts
355
301
  import { mkdir, readFile, writeFile } from "node:fs/promises";
356
302
  import { dirname as dirname2, join as join4 } from "node:path";
@@ -417,6 +363,9 @@ function generateSessionId() {
417
363
  function sessionDebugDir() {
418
364
  return join5(sessionsRootDir(), SESSION_ID);
419
365
  }
366
+ async function debugSessionDirIfEnabled() {
367
+ return await isDebugModeEnabled() ? sessionDebugDir() : void 0;
368
+ }
420
369
  async function isDebugModeEnabled() {
421
370
  try {
422
371
  return (await readDebugModeSetting()).enabled;
@@ -535,6 +484,63 @@ var init_debug_store = __esm({
535
484
  }
536
485
  });
537
486
 
487
+ // packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts
488
+ import { spawn as spawn2 } from "node:child_process";
489
+ function buildArgs(options) {
490
+ const args = ["import"];
491
+ if (options.project) {
492
+ args.push("--project", options.project);
493
+ }
494
+ return args;
495
+ }
496
+ async function spawnV1Import(options = {}) {
497
+ const cliPath = findLegacyCliPath();
498
+ const args = buildArgs(options);
499
+ const debugSessionDir = await debugSessionDirIfEnabled();
500
+ return new Promise((resolvePromise) => {
501
+ const child = spawn2("node", [cliPath, ...args], {
502
+ stdio: "inherit",
503
+ env: debugSessionDir ? { ...process.env, EDS_DEBUG_SESSION_DIR: debugSessionDir } : process.env
504
+ });
505
+ child.on("close", (code) => {
506
+ resolvePromise({ exitCode: code ?? 1, result: void 0, stdout: "", stderr: "" });
507
+ });
508
+ child.on("error", (err) => {
509
+ resolvePromise({ exitCode: 1, result: void 0, stdout: "", stderr: err.message });
510
+ });
511
+ });
512
+ }
513
+ var init_spawn_v1_import = __esm({
514
+ "packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts"() {
515
+ "use strict";
516
+ init_legacy_cli_path();
517
+ init_debug_store();
518
+ }
519
+ });
520
+
521
+ // packages/experience-design-system-cli/src/tui/import/terminal-input.ts
522
+ function getTerminalHandle() {
523
+ return process.stdin._handle;
524
+ }
525
+ async function stopReadingTerminal() {
526
+ await new Promise((resolve) => setImmediate(resolve));
527
+ const handle = getTerminalHandle();
528
+ if (!handle?.readStop) return;
529
+ handle.reading = false;
530
+ handle.readStop();
531
+ }
532
+ function startReadingTerminal() {
533
+ const handle = getTerminalHandle();
534
+ if (!handle?.readStart) return;
535
+ handle.reading = true;
536
+ handle.readStart();
537
+ }
538
+ var init_terminal_input = __esm({
539
+ "packages/experience-design-system-cli/src/tui/import/terminal-input.ts"() {
540
+ "use strict";
541
+ }
542
+ });
543
+
538
544
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
539
545
  import { useEffect as useEffect3 } from "react";
540
546
  import { Box as Box3, Text as Text3, useInput as useInput3 } from "ink";
@@ -573,7 +579,7 @@ var init_PageContainer2 = __esm({
573
579
  });
574
580
 
575
581
  // packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
576
- import { useEffect as useEffect4, useState as useState3 } from "react";
582
+ import { useState as useState3 } from "react";
577
583
  import { Box as Box4, Text as Text4, useInput as useInput4 } from "ink";
578
584
  import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
579
585
  function SettingsScreen({
@@ -586,14 +592,6 @@ function SettingsScreen({
586
592
  { label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
587
593
  { label: "Debug Mode", screen: "settings-debug-mode" }
588
594
  ];
589
- useEffect4(() => {
590
- startDebugRun({
591
- flow: "settings",
592
- step: "01-settings",
593
- menuOption: "Settings",
594
- inputs: { options: items.map((item) => item.label) }
595
- });
596
- }, []);
597
595
  useInput4((input, key) => {
598
596
  if (key.upArrow) {
599
597
  setFocusIdx((i) => (i - 1 + items.length) % items.length);
@@ -606,17 +604,11 @@ function SettingsScreen({
606
604
  if (key.return) {
607
605
  const screen = items[focusIdx].screen;
608
606
  if (screen) {
609
- void finishDebugRun({
610
- outputs: { selected: items[focusIdx].label },
611
- status: "success",
612
- exitMethod: "saved"
613
- });
614
607
  onNavigate(screen);
615
608
  }
616
609
  return;
617
610
  }
618
611
  if (key.escape || input === "q") {
619
- void finishDebugRun({ outputs: {}, status: "success", exitMethod: "discarded" });
620
612
  onBack();
621
613
  }
622
614
  });
@@ -634,7 +626,6 @@ function SettingsScreen({
634
626
  var init_PageContainer3 = __esm({
635
627
  "packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx"() {
636
628
  "use strict";
637
- init_debug_store();
638
629
  }
639
630
  });
640
631
 
@@ -692,7 +683,7 @@ var init_config_store = __esm({
692
683
  });
693
684
 
694
685
  // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
695
- import { useEffect as useEffect5, useState as useState4 } from "react";
686
+ import { useEffect as useEffect4, useState as useState4 } from "react";
696
687
  import { Box as Box5, Text as Text5, useInput as useInput5 } from "ink";
697
688
  import { Fragment, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
698
689
  function debugFields(config) {
@@ -708,7 +699,7 @@ function ConfigurationScreen({ onDone }) {
708
699
  const [config, setConfig] = useState4(null);
709
700
  const [activeField, setActiveField] = useState4("spaceId");
710
701
  const [message, setMessage] = useState4(null);
711
- useEffect5(() => {
702
+ useEffect4(() => {
712
703
  readCredentials().then((cfg) => {
713
704
  setConfig(cfg);
714
705
  setStage("form");
@@ -869,13 +860,13 @@ var init_analytics_store = __esm({
869
860
  });
870
861
 
871
862
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
872
- import { useEffect as useEffect6, useState as useState5 } from "react";
863
+ import { useEffect as useEffect5, useState as useState5 } from "react";
873
864
  import { Box as Box6, Text as Text6, useInput as useInput6 } from "ink";
874
865
  import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
875
866
  function OptInAnalyticsScreen({ onDone }) {
876
867
  const [loading, setLoading] = useState5(true);
877
868
  const [enabled, setEnabled] = useState5(true);
878
- useEffect6(() => {
869
+ useEffect5(() => {
879
870
  readAnalyticsSetting().then((setting) => {
880
871
  setEnabled(setting.enabled);
881
872
  setLoading(false);
@@ -929,12 +920,12 @@ var init_screen = __esm({
929
920
  });
930
921
 
931
922
  // packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
932
- import { useEffect as useEffect7, useState as useState6 } from "react";
923
+ import { useEffect as useEffect6, useState as useState6 } from "react";
933
924
  import { Box as Box7, Text as Text7, useInput as useInput7 } from "ink";
934
925
  import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
935
926
  function UpgradeScreen({ onDone }) {
936
927
  const [upgradeCheck, setUpgradeCheck] = useState6();
937
- useEffect7(() => {
928
+ useEffect6(() => {
938
929
  startDebugRun({
939
930
  flow: "upgrade",
940
931
  step: "01-upgrade",
@@ -1009,13 +1000,13 @@ var init_PageContainer4 = __esm({
1009
1000
  });
1010
1001
 
1011
1002
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
1012
- import { useEffect as useEffect8, useState as useState7 } from "react";
1003
+ import { useEffect as useEffect7, useState as useState7 } from "react";
1013
1004
  import { Box as Box8, Text as Text8, useInput as useInput8 } from "ink";
1014
1005
  import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
1015
1006
  function DebugModeScreen({ onDone }) {
1016
1007
  const [loading, setLoading] = useState7(true);
1017
1008
  const [enabled, setEnabled] = useState7(true);
1018
- useEffect8(() => {
1009
+ useEffect7(() => {
1019
1010
  readDebugModeSetting().then((setting) => {
1020
1011
  setEnabled(setting.enabled);
1021
1012
  setLoading(false);
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.35.1-dev-build-041b6e0a.0",
3
+ "version": "2.35.1-dev-build-c4a4d1cd.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,5 +1,6 @@
1
1
  type Status = 'success' | 'error';
2
2
  type ExitMethod = 'saved' | 'discarded' | 'crashed';
3
+ export declare function debugSessionDirIfEnabled(): Promise<string | undefined>;
3
4
  export declare function startDebugRun({ flow, step, menuOption, inputs, }: {
4
5
  flow: string;
5
6
  step: string;