@contentful/experience-design-system-cli 2.36.2-dev-build-d9a75f6e.0 → 2.37.1-dev-build-b94be1ed.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 +33 -18
- package/dist/index.js +33 -18
- package/dist/package.json +1 -1
- package/dist/src/tui/import/steps/01-welcome/controls.d.ts +2 -2
- package/dist/src/tui/import/steps/01-welcome/logic.d.ts +3 -1
- package/dist/src/tui/import/steps/02-token-input/controls.d.ts +6 -3
- package/dist/src/tui/import/steps/02-token-input/logic.d.ts +4 -1
- package/dist/src/tui/import/steps/02-token-input/screen.d.ts +2 -1
- package/dist/src/tui/import/steps/02-token-input/validate-path.d.ts +1 -1
- package/legacy/package.json +1 -1
- package/package.json +2 -2
package/dist/app.js
CHANGED
|
@@ -255,8 +255,9 @@ import TextInput from "ink-text-input";
|
|
|
255
255
|
import { useInput as useInput3 } from "ink";
|
|
256
256
|
|
|
257
257
|
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/logic.ts
|
|
258
|
-
function shouldQuit(key) {
|
|
259
|
-
|
|
258
|
+
function shouldQuit(value, input, key) {
|
|
259
|
+
if (key.escape) return true;
|
|
260
|
+
return value === "" && input === "q" && !key.ctrl && !key.meta;
|
|
260
261
|
}
|
|
261
262
|
function toProjectPath(value) {
|
|
262
263
|
const projectPath = value.trim();
|
|
@@ -266,11 +267,11 @@ function toProjectPath(value) {
|
|
|
266
267
|
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/controls.ts
|
|
267
268
|
var WELCOME_CONTROLS = [
|
|
268
269
|
{ keys: "Enter", label: "Continue" },
|
|
269
|
-
{ keys: "Esc", label: "Back to menu" }
|
|
270
|
+
{ keys: "Esc/q", label: "Back to menu" }
|
|
270
271
|
];
|
|
271
|
-
function useWelcomeControls(onQuit) {
|
|
272
|
-
useInput3((
|
|
273
|
-
if (shouldQuit(key)) onQuit();
|
|
272
|
+
function useWelcomeControls(projectPath, onQuit) {
|
|
273
|
+
useInput3((input, key) => {
|
|
274
|
+
if (shouldQuit(projectPath, input, key)) onQuit();
|
|
274
275
|
});
|
|
275
276
|
}
|
|
276
277
|
|
|
@@ -286,7 +287,7 @@ var OVERVIEW = [
|
|
|
286
287
|
];
|
|
287
288
|
function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
|
|
288
289
|
const [projectPath, setProjectPath] = useState3(initialPath);
|
|
289
|
-
useWelcomeControls(onQuit);
|
|
290
|
+
useWelcomeControls(projectPath, onQuit);
|
|
290
291
|
const submit = (value) => {
|
|
291
292
|
const path = toProjectPath(value);
|
|
292
293
|
if (path) onContinue(path);
|
|
@@ -328,8 +329,14 @@ import TextInput2 from "ink-text-input";
|
|
|
328
329
|
import { useInput as useInput4 } from "ink";
|
|
329
330
|
|
|
330
331
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/logic.ts
|
|
331
|
-
function
|
|
332
|
-
return key.
|
|
332
|
+
function isPlainKeyOnEmptyField(value, input, key, expected) {
|
|
333
|
+
return value === "" && input === expected && !key.ctrl && !key.meta;
|
|
334
|
+
}
|
|
335
|
+
function shouldGoBack(value, input, key) {
|
|
336
|
+
return key.escape || isPlainKeyOnEmptyField(value, input, key, "q");
|
|
337
|
+
}
|
|
338
|
+
function shouldSkip(value, input, key) {
|
|
339
|
+
return isPlainKeyOnEmptyField(value, input, key, "s");
|
|
333
340
|
}
|
|
334
341
|
function toTokenPath(value) {
|
|
335
342
|
const tokenPath = value.trim();
|
|
@@ -338,12 +345,14 @@ function toTokenPath(value) {
|
|
|
338
345
|
|
|
339
346
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/controls.ts
|
|
340
347
|
var TOKEN_INPUT_CONTROLS = [
|
|
341
|
-
{ keys: "Enter", label: "Continue" },
|
|
342
|
-
{ keys: "
|
|
348
|
+
{ keys: "Enter", label: "Continue (skips if empty)" },
|
|
349
|
+
{ keys: "s", label: "Skip" },
|
|
350
|
+
{ keys: "Esc/q", label: "Back" }
|
|
343
351
|
];
|
|
344
|
-
function useTokenInputControls(onBack) {
|
|
345
|
-
useInput4((
|
|
346
|
-
if (shouldGoBack(key)) onBack();
|
|
352
|
+
function useTokenInputControls(tokenPath, onSkip, onBack) {
|
|
353
|
+
useInput4((input, key) => {
|
|
354
|
+
if (shouldGoBack(tokenPath, input, key)) onBack();
|
|
355
|
+
else if (shouldSkip(tokenPath, input, key)) onSkip();
|
|
347
356
|
});
|
|
348
357
|
}
|
|
349
358
|
|
|
@@ -381,10 +390,15 @@ function validateTokenPath(rawPath) {
|
|
|
381
390
|
|
|
382
391
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
|
|
383
392
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
384
|
-
function TokenInputScreen({
|
|
393
|
+
function TokenInputScreen({
|
|
394
|
+
onConfirm,
|
|
395
|
+
onSkip,
|
|
396
|
+
onBack,
|
|
397
|
+
initialPath = ""
|
|
398
|
+
}) {
|
|
385
399
|
const [tokenPath, setTokenPath] = useState4(initialPath);
|
|
386
400
|
const [failure, setFailure] = useState4(null);
|
|
387
|
-
useTokenInputControls(onBack);
|
|
401
|
+
useTokenInputControls(tokenPath, onSkip, onBack);
|
|
388
402
|
const change = (value) => {
|
|
389
403
|
setTokenPath(value);
|
|
390
404
|
setFailure(null);
|
|
@@ -392,7 +406,7 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
|
|
|
392
406
|
const submit = (value) => {
|
|
393
407
|
const rawPath = toTokenPath(value);
|
|
394
408
|
if (!rawPath) {
|
|
395
|
-
|
|
409
|
+
onSkip();
|
|
396
410
|
return;
|
|
397
411
|
}
|
|
398
412
|
const check = validateTokenPath(rawPath);
|
|
@@ -413,7 +427,7 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
|
|
|
413
427
|
"\u2717 ",
|
|
414
428
|
failure.error
|
|
415
429
|
] }),
|
|
416
|
-
|
|
430
|
+
/* @__PURE__ */ jsxs4(Text5, { dimColor: true, children: [
|
|
417
431
|
" Resolved to: ",
|
|
418
432
|
failure.resolvedPath
|
|
419
433
|
] })
|
|
@@ -1258,6 +1272,7 @@ function App({ onLaunchImport, importExitCode }) {
|
|
|
1258
1272
|
{
|
|
1259
1273
|
initialPath: importDefaults.tokenFile,
|
|
1260
1274
|
onConfirm: (tokens) => onLaunchImport?.({ project: projectPath, tokens }),
|
|
1275
|
+
onSkip: () => onLaunchImport?.({ project: projectPath }),
|
|
1261
1276
|
onBack: () => setProjectPath(void 0)
|
|
1262
1277
|
}
|
|
1263
1278
|
);
|
package/dist/index.js
CHANGED
|
@@ -321,8 +321,9 @@ var init_PageContainer = __esm({
|
|
|
321
321
|
});
|
|
322
322
|
|
|
323
323
|
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/logic.ts
|
|
324
|
-
function shouldQuit(key) {
|
|
325
|
-
|
|
324
|
+
function shouldQuit(value, input, key) {
|
|
325
|
+
if (key.escape) return true;
|
|
326
|
+
return value === "" && input === "q" && !key.ctrl && !key.meta;
|
|
326
327
|
}
|
|
327
328
|
function toProjectPath(value) {
|
|
328
329
|
const projectPath = value.trim();
|
|
@@ -336,9 +337,9 @@ var init_logic = __esm({
|
|
|
336
337
|
|
|
337
338
|
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/controls.ts
|
|
338
339
|
import { useInput as useInput3 } from "ink";
|
|
339
|
-
function useWelcomeControls(onQuit) {
|
|
340
|
-
useInput3((
|
|
341
|
-
if (shouldQuit(key)) onQuit();
|
|
340
|
+
function useWelcomeControls(projectPath, onQuit) {
|
|
341
|
+
useInput3((input, key) => {
|
|
342
|
+
if (shouldQuit(projectPath, input, key)) onQuit();
|
|
342
343
|
});
|
|
343
344
|
}
|
|
344
345
|
var WELCOME_CONTROLS;
|
|
@@ -348,7 +349,7 @@ var init_controls = __esm({
|
|
|
348
349
|
init_logic();
|
|
349
350
|
WELCOME_CONTROLS = [
|
|
350
351
|
{ keys: "Enter", label: "Continue" },
|
|
351
|
-
{ keys: "Esc", label: "Back to menu" }
|
|
352
|
+
{ keys: "Esc/q", label: "Back to menu" }
|
|
352
353
|
];
|
|
353
354
|
}
|
|
354
355
|
});
|
|
@@ -360,7 +361,7 @@ import TextInput from "ink-text-input";
|
|
|
360
361
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
361
362
|
function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
|
|
362
363
|
const [projectPath, setProjectPath] = useState3(initialPath);
|
|
363
|
-
useWelcomeControls(onQuit);
|
|
364
|
+
useWelcomeControls(projectPath, onQuit);
|
|
364
365
|
const submit = (value) => {
|
|
365
366
|
const path = toProjectPath(value);
|
|
366
367
|
if (path) onContinue(path);
|
|
@@ -411,8 +412,14 @@ var init_screen = __esm({
|
|
|
411
412
|
});
|
|
412
413
|
|
|
413
414
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/logic.ts
|
|
414
|
-
function
|
|
415
|
-
return key.
|
|
415
|
+
function isPlainKeyOnEmptyField(value, input, key, expected) {
|
|
416
|
+
return value === "" && input === expected && !key.ctrl && !key.meta;
|
|
417
|
+
}
|
|
418
|
+
function shouldGoBack(value, input, key) {
|
|
419
|
+
return key.escape || isPlainKeyOnEmptyField(value, input, key, "q");
|
|
420
|
+
}
|
|
421
|
+
function shouldSkip(value, input, key) {
|
|
422
|
+
return isPlainKeyOnEmptyField(value, input, key, "s");
|
|
416
423
|
}
|
|
417
424
|
function toTokenPath(value) {
|
|
418
425
|
const tokenPath = value.trim();
|
|
@@ -426,9 +433,10 @@ var init_logic2 = __esm({
|
|
|
426
433
|
|
|
427
434
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/controls.ts
|
|
428
435
|
import { useInput as useInput4 } from "ink";
|
|
429
|
-
function useTokenInputControls(onBack) {
|
|
430
|
-
useInput4((
|
|
431
|
-
if (shouldGoBack(key)) onBack();
|
|
436
|
+
function useTokenInputControls(tokenPath, onSkip, onBack) {
|
|
437
|
+
useInput4((input, key) => {
|
|
438
|
+
if (shouldGoBack(tokenPath, input, key)) onBack();
|
|
439
|
+
else if (shouldSkip(tokenPath, input, key)) onSkip();
|
|
432
440
|
});
|
|
433
441
|
}
|
|
434
442
|
var TOKEN_INPUT_CONTROLS;
|
|
@@ -437,8 +445,9 @@ var init_controls2 = __esm({
|
|
|
437
445
|
"use strict";
|
|
438
446
|
init_logic2();
|
|
439
447
|
TOKEN_INPUT_CONTROLS = [
|
|
440
|
-
{ keys: "Enter", label: "Continue" },
|
|
441
|
-
{ keys: "
|
|
448
|
+
{ keys: "Enter", label: "Continue (skips if empty)" },
|
|
449
|
+
{ keys: "s", label: "Skip" },
|
|
450
|
+
{ keys: "Esc/q", label: "Back" }
|
|
442
451
|
];
|
|
443
452
|
}
|
|
444
453
|
});
|
|
@@ -485,10 +494,15 @@ import { useState as useState4 } from "react";
|
|
|
485
494
|
import { Box as Box4, Text as Text5 } from "ink";
|
|
486
495
|
import TextInput2 from "ink-text-input";
|
|
487
496
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
488
|
-
function TokenInputScreen({
|
|
497
|
+
function TokenInputScreen({
|
|
498
|
+
onConfirm,
|
|
499
|
+
onSkip,
|
|
500
|
+
onBack,
|
|
501
|
+
initialPath = ""
|
|
502
|
+
}) {
|
|
489
503
|
const [tokenPath, setTokenPath] = useState4(initialPath);
|
|
490
504
|
const [failure, setFailure] = useState4(null);
|
|
491
|
-
useTokenInputControls(onBack);
|
|
505
|
+
useTokenInputControls(tokenPath, onSkip, onBack);
|
|
492
506
|
const change = (value) => {
|
|
493
507
|
setTokenPath(value);
|
|
494
508
|
setFailure(null);
|
|
@@ -496,7 +510,7 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
|
|
|
496
510
|
const submit = (value) => {
|
|
497
511
|
const rawPath = toTokenPath(value);
|
|
498
512
|
if (!rawPath) {
|
|
499
|
-
|
|
513
|
+
onSkip();
|
|
500
514
|
return;
|
|
501
515
|
}
|
|
502
516
|
const check = validateTokenPath(rawPath);
|
|
@@ -517,7 +531,7 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
|
|
|
517
531
|
"\u2717 ",
|
|
518
532
|
failure.error
|
|
519
533
|
] }),
|
|
520
|
-
|
|
534
|
+
/* @__PURE__ */ jsxs4(Text5, { dimColor: true, children: [
|
|
521
535
|
" Resolved to: ",
|
|
522
536
|
failure.resolvedPath
|
|
523
537
|
] })
|
|
@@ -1471,6 +1485,7 @@ function App({ onLaunchImport, importExitCode }) {
|
|
|
1471
1485
|
{
|
|
1472
1486
|
initialPath: importDefaults.tokenFile,
|
|
1473
1487
|
onConfirm: (tokens) => onLaunchImport?.({ project: projectPath, tokens }),
|
|
1488
|
+
onSkip: () => onLaunchImport?.({ project: projectPath }),
|
|
1474
1489
|
onBack: () => setProjectPath(void 0)
|
|
1475
1490
|
}
|
|
1476
1491
|
);
|
package/dist/package.json
CHANGED
|
@@ -2,7 +2,7 @@ export declare const WELCOME_CONTROLS: readonly [{
|
|
|
2
2
|
readonly keys: "Enter";
|
|
3
3
|
readonly label: "Continue";
|
|
4
4
|
}, {
|
|
5
|
-
readonly keys: "Esc";
|
|
5
|
+
readonly keys: "Esc/q";
|
|
6
6
|
readonly label: "Back to menu";
|
|
7
7
|
}];
|
|
8
|
-
export declare function useWelcomeControls(onQuit: () => void): void;
|
|
8
|
+
export declare function useWelcomeControls(projectPath: string, onQuit: () => void): void;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
interface QuitKey {
|
|
2
2
|
escape: boolean;
|
|
3
|
+
ctrl: boolean;
|
|
4
|
+
meta: boolean;
|
|
3
5
|
}
|
|
4
|
-
export declare function shouldQuit(key: QuitKey): boolean;
|
|
6
|
+
export declare function shouldQuit(value: string, input: string, key: QuitKey): boolean;
|
|
5
7
|
export declare function toProjectPath(value: string): string | null;
|
|
6
8
|
export {};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export declare const TOKEN_INPUT_CONTROLS: readonly [{
|
|
2
2
|
readonly keys: "Enter";
|
|
3
|
-
readonly label: "Continue";
|
|
3
|
+
readonly label: "Continue (skips if empty)";
|
|
4
4
|
}, {
|
|
5
|
-
readonly keys: "
|
|
5
|
+
readonly keys: "s";
|
|
6
|
+
readonly label: "Skip";
|
|
7
|
+
}, {
|
|
8
|
+
readonly keys: "Esc/q";
|
|
6
9
|
readonly label: "Back";
|
|
7
10
|
}];
|
|
8
|
-
export declare function useTokenInputControls(onBack: () => void): void;
|
|
11
|
+
export declare function useTokenInputControls(tokenPath: string, onSkip: () => void, onBack: () => void): void;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
interface Key {
|
|
2
2
|
escape: boolean;
|
|
3
|
+
ctrl: boolean;
|
|
4
|
+
meta: boolean;
|
|
3
5
|
}
|
|
4
|
-
export declare function shouldGoBack(key: Key): boolean;
|
|
6
|
+
export declare function shouldGoBack(value: string, input: string, key: Key): boolean;
|
|
7
|
+
export declare function shouldSkip(value: string, input: string, key: Key): boolean;
|
|
5
8
|
export declare function toTokenPath(value: string): string | null;
|
|
6
9
|
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
interface TokenInputScreenProps {
|
|
3
3
|
onConfirm: (tokensPath: string) => void;
|
|
4
|
+
onSkip: () => void;
|
|
4
5
|
onBack: () => void;
|
|
5
6
|
initialPath?: string;
|
|
6
7
|
}
|
|
7
|
-
export declare function TokenInputScreen({ onConfirm, onBack, initialPath }: TokenInputScreenProps): React.ReactElement;
|
|
8
|
+
export declare function TokenInputScreen({ onConfirm, onSkip, onBack, initialPath, }: TokenInputScreenProps): React.ReactElement;
|
|
8
9
|
export {};
|
package/legacy/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.37.1-dev-build-b94be1ed.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"svelte": "^5.56.4",
|
|
43
43
|
"ts-morph": "^27.0.2",
|
|
44
44
|
"typescript": "^5.9.3",
|
|
45
|
-
"@contentful/experience-design-system-types": "2.
|
|
45
|
+
"@contentful/experience-design-system-types": "2.37.1-dev-build-b94be1ed.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@tsconfig/node24": "^24.0.4",
|