@contentful/experience-design-system-cli 2.35.1-dev-build-45d6c918.0 → 2.35.1-dev-build-3ab9e99e.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(() => {
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";
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-45d6c918.0",
3
+ "version": "2.35.1-dev-build-3ab9e99e.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;
@@ -0,0 +1,17 @@
1
+ import { type CDFDocument } from '@contentful/experience-design-system-types';
2
+ export interface DroppedTokenDefault {
3
+ component: string;
4
+ property: string;
5
+ token: string;
6
+ }
7
+ /**
8
+ * Contentful turns a token property's `$default` into a link to a design token and rejects the
9
+ * whole component when that token does not exist ("unknown DesignToken ID"). This removes the
10
+ * default from any token property whose token is neither defined in the CDF itself nor already in
11
+ * the target environment, so the component can still be created. The input is not modified.
12
+ */
13
+ export declare function dropDanglingTokenDefaults(cdf: CDFDocument, existingTokenIds: ReadonlySet<string>): {
14
+ cdf: CDFDocument;
15
+ dropped: DroppedTokenDefault[];
16
+ };
17
+ export declare function describeDroppedTokenDefaults(dropped: DroppedTokenDefault[]): string[];
@@ -0,0 +1,11 @@
1
+ export interface FetchExistingTokenIdsParams {
2
+ spaceId: string;
3
+ environmentId: string;
4
+ cmaToken: string;
5
+ host?: string;
6
+ }
7
+ /**
8
+ * The ids of every design token in the target environment (for example `color.primary`).
9
+ * Only tokens are read, so a component list that the server cannot serialize does not matter.
10
+ */
11
+ export declare function fetchExistingTokenIds(params: FetchExistingTokenIdsParams): Promise<Set<string>>;
@@ -13,9 +13,10 @@ type WizardPreviewStepProps = {
13
13
  environmentId: string;
14
14
  stepNumber: number;
15
15
  totalSteps: number;
16
+ droppedTokenDefaults?: string[];
16
17
  onConfirm: (acknowledge: boolean) => void;
17
18
  onEdit?: () => void;
18
19
  onQuit: () => void;
19
20
  };
20
- export declare function WizardPreviewStep({ preview, spaceId, environmentId, stepNumber, totalSteps, onConfirm, onEdit, onQuit, }: WizardPreviewStepProps): React.ReactElement;
21
+ export declare function WizardPreviewStep({ preview, spaceId, environmentId, stepNumber, totalSteps, droppedTokenDefaults, onConfirm, onEdit, onQuit, }: WizardPreviewStepProps): React.ReactElement;
21
22
  export {};