@contentful/experience-design-system-cli 2.42.1-dev-build-25400cd0.0 → 2.42.1-dev-build-4a0aab3f.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 +22 -8
- package/dist/index.js +22 -8
- package/dist/package.json +1 -1
- package/dist/src/tui/import/steps/03-path-validation/logic.d.ts +12 -2
- package/package.json +3 -3
package/dist/app.js
CHANGED
|
@@ -3683,9 +3683,14 @@ function scanReport(scan, path5, { hasTokens = true } = {}) {
|
|
|
3683
3683
|
...scan.warnings.length > 0 ? { scan_warnings: scan.warnings } : {}
|
|
3684
3684
|
};
|
|
3685
3685
|
}
|
|
3686
|
-
function
|
|
3686
|
+
function hasImportableFiles(counts, { hasTokens = true } = {}) {
|
|
3687
|
+
const componentFiles = COMPONENT_CATEGORIES.reduce((sum, category) => sum + counts[category], 0);
|
|
3688
|
+
return componentFiles > 0 || hasTokens && counts.json > 0;
|
|
3689
|
+
}
|
|
3690
|
+
function phaseOf(scan, { hasTokens = true } = {}) {
|
|
3687
3691
|
if (scan === void 0) return "scanning";
|
|
3688
|
-
|
|
3692
|
+
if (!scan.ok) return "failed";
|
|
3693
|
+
return hasImportableFiles(scan.counts, { hasTokens }) ? "ready" : "empty";
|
|
3689
3694
|
}
|
|
3690
3695
|
function keyAction(phase, input, key) {
|
|
3691
3696
|
if (key.escape) return "back";
|
|
@@ -3693,7 +3698,7 @@ function keyAction(phase, input, key) {
|
|
|
3693
3698
|
if (key.return) return "confirm";
|
|
3694
3699
|
if (input === "e") return "change-path";
|
|
3695
3700
|
}
|
|
3696
|
-
if (phase === "failed" && (key.return || input === "e")) return "change-path";
|
|
3701
|
+
if ((phase === "failed" || phase === "empty") && (key.return || input === "e")) return "change-path";
|
|
3697
3702
|
return void 0;
|
|
3698
3703
|
}
|
|
3699
3704
|
|
|
@@ -3705,6 +3710,10 @@ var CONTROLS = {
|
|
|
3705
3710
|
{ keys: "e", label: "Change path" },
|
|
3706
3711
|
{ keys: "Esc", label: "Back" }
|
|
3707
3712
|
],
|
|
3713
|
+
empty: [
|
|
3714
|
+
{ keys: "Enter/e", label: "Try a different path" },
|
|
3715
|
+
{ keys: "Esc", label: "Back" }
|
|
3716
|
+
],
|
|
3708
3717
|
failed: [
|
|
3709
3718
|
{ keys: "Enter/e", label: "Try a different path" },
|
|
3710
3719
|
{ keys: "Esc", label: "Back" }
|
|
@@ -18246,7 +18255,8 @@ function Failure({ scan, path: path5 }) {
|
|
|
18246
18255
|
function Summary({
|
|
18247
18256
|
scan,
|
|
18248
18257
|
path: path5,
|
|
18249
|
-
hasTokens
|
|
18258
|
+
hasTokens,
|
|
18259
|
+
empty
|
|
18250
18260
|
}) {
|
|
18251
18261
|
const { total, rows, warning } = summarize(scan.counts, { hasTokens });
|
|
18252
18262
|
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", gap: 1, children: [
|
|
@@ -18255,7 +18265,11 @@ function Summary({
|
|
|
18255
18265
|
/* @__PURE__ */ jsx13(Text12, { bold: true, children: path5 })
|
|
18256
18266
|
] }),
|
|
18257
18267
|
/* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
|
|
18258
|
-
/* @__PURE__ */ jsxs12(Text12, { color: PALETTE.
|
|
18268
|
+
empty ? /* @__PURE__ */ jsxs12(Text12, { color: PALETTE.muted, children: [
|
|
18269
|
+
"Found ",
|
|
18270
|
+
total,
|
|
18271
|
+
" files:"
|
|
18272
|
+
] }) : /* @__PURE__ */ jsxs12(Text12, { color: PALETTE.success, children: [
|
|
18259
18273
|
"\u2713 Found ",
|
|
18260
18274
|
total,
|
|
18261
18275
|
" files:"
|
|
@@ -18266,7 +18280,7 @@ function Summary({
|
|
|
18266
18280
|
"\u26A0 ",
|
|
18267
18281
|
warning
|
|
18268
18282
|
] }),
|
|
18269
|
-
/* @__PURE__ */ jsx13(Text12, { children: "Does this look right?" })
|
|
18283
|
+
!empty && /* @__PURE__ */ jsx13(Text12, { children: "Does this look right?" })
|
|
18270
18284
|
] });
|
|
18271
18285
|
}
|
|
18272
18286
|
function PathValidationScreen({
|
|
@@ -18290,7 +18304,7 @@ function PathValidationScreen({
|
|
|
18290
18304
|
useEffect8(() => {
|
|
18291
18305
|
setScan(scanFiles(resolvedPath));
|
|
18292
18306
|
}, [resolvedPath]);
|
|
18293
|
-
const phase = phaseOf(scan);
|
|
18307
|
+
const phase = phaseOf(scan, { hasTokens });
|
|
18294
18308
|
const finish = (outcome, exitMethod) => {
|
|
18295
18309
|
void finishDebugRun({
|
|
18296
18310
|
outputs: { outcome, ...scanReport(scan, resolvedPath, { hasTokens }) },
|
|
@@ -18322,7 +18336,7 @@ function PathValidationScreen({
|
|
|
18322
18336
|
"..."
|
|
18323
18337
|
] }),
|
|
18324
18338
|
scan?.ok === false && /* @__PURE__ */ jsx13(Failure, { scan, path: resolvedPath }),
|
|
18325
|
-
scan?.ok === true && /* @__PURE__ */ jsx13(Summary, { scan, path: resolvedPath, hasTokens }),
|
|
18339
|
+
scan?.ok === true && /* @__PURE__ */ jsx13(Summary, { scan, path: resolvedPath, hasTokens, empty: phase === "empty" }),
|
|
18326
18340
|
/* @__PURE__ */ jsx13(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx13(ControlHints, { hints: controlsFor(phase) }) })
|
|
18327
18341
|
] })
|
|
18328
18342
|
] });
|
package/dist/index.js
CHANGED
|
@@ -20876,9 +20876,14 @@ function scanReport(scan, path5, { hasTokens = true } = {}) {
|
|
|
20876
20876
|
...scan.warnings.length > 0 ? { scan_warnings: scan.warnings } : {}
|
|
20877
20877
|
};
|
|
20878
20878
|
}
|
|
20879
|
-
function
|
|
20879
|
+
function hasImportableFiles(counts, { hasTokens = true } = {}) {
|
|
20880
|
+
const componentFiles = COMPONENT_CATEGORIES.reduce((sum, category) => sum + counts[category], 0);
|
|
20881
|
+
return componentFiles > 0 || hasTokens && counts.json > 0;
|
|
20882
|
+
}
|
|
20883
|
+
function phaseOf(scan, { hasTokens = true } = {}) {
|
|
20880
20884
|
if (scan === void 0) return "scanning";
|
|
20881
|
-
|
|
20885
|
+
if (!scan.ok) return "failed";
|
|
20886
|
+
return hasImportableFiles(scan.counts, { hasTokens }) ? "ready" : "empty";
|
|
20882
20887
|
}
|
|
20883
20888
|
function keyAction(phase, input, key) {
|
|
20884
20889
|
if (key.escape) return "back";
|
|
@@ -20886,7 +20891,7 @@ function keyAction(phase, input, key) {
|
|
|
20886
20891
|
if (key.return) return "confirm";
|
|
20887
20892
|
if (input === "e") return "change-path";
|
|
20888
20893
|
}
|
|
20889
|
-
if (phase === "failed" && (key.return || input === "e")) return "change-path";
|
|
20894
|
+
if ((phase === "failed" || phase === "empty") && (key.return || input === "e")) return "change-path";
|
|
20890
20895
|
return void 0;
|
|
20891
20896
|
}
|
|
20892
20897
|
var COMPONENT_CATEGORIES, ROW_LABELS, ROW_ORDER;
|
|
@@ -20933,6 +20938,10 @@ var init_controls6 = __esm({
|
|
|
20933
20938
|
{ keys: "e", label: "Change path" },
|
|
20934
20939
|
{ keys: "Esc", label: "Back" }
|
|
20935
20940
|
],
|
|
20941
|
+
empty: [
|
|
20942
|
+
{ keys: "Enter/e", label: "Try a different path" },
|
|
20943
|
+
{ keys: "Esc", label: "Back" }
|
|
20944
|
+
],
|
|
20936
20945
|
failed: [
|
|
20937
20946
|
{ keys: "Enter/e", label: "Try a different path" },
|
|
20938
20947
|
{ keys: "Esc", label: "Back" }
|
|
@@ -20990,7 +20999,8 @@ function Failure({ scan, path: path5 }) {
|
|
|
20990
20999
|
function Summary({
|
|
20991
21000
|
scan,
|
|
20992
21001
|
path: path5,
|
|
20993
|
-
hasTokens
|
|
21002
|
+
hasTokens,
|
|
21003
|
+
empty
|
|
20994
21004
|
}) {
|
|
20995
21005
|
const { total, rows, warning } = summarize(scan.counts, { hasTokens });
|
|
20996
21006
|
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", gap: 1, children: [
|
|
@@ -20999,7 +21009,11 @@ function Summary({
|
|
|
20999
21009
|
/* @__PURE__ */ jsx13(Text12, { bold: true, children: path5 })
|
|
21000
21010
|
] }),
|
|
21001
21011
|
/* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
|
|
21002
|
-
/* @__PURE__ */ jsxs12(Text12, { color: PALETTE.
|
|
21012
|
+
empty ? /* @__PURE__ */ jsxs12(Text12, { color: PALETTE.muted, children: [
|
|
21013
|
+
"Found ",
|
|
21014
|
+
total,
|
|
21015
|
+
" files:"
|
|
21016
|
+
] }) : /* @__PURE__ */ jsxs12(Text12, { color: PALETTE.success, children: [
|
|
21003
21017
|
"\u2713 Found ",
|
|
21004
21018
|
total,
|
|
21005
21019
|
" files:"
|
|
@@ -21010,7 +21024,7 @@ function Summary({
|
|
|
21010
21024
|
"\u26A0 ",
|
|
21011
21025
|
warning
|
|
21012
21026
|
] }),
|
|
21013
|
-
/* @__PURE__ */ jsx13(Text12, { children: "Does this look right?" })
|
|
21027
|
+
!empty && /* @__PURE__ */ jsx13(Text12, { children: "Does this look right?" })
|
|
21014
21028
|
] });
|
|
21015
21029
|
}
|
|
21016
21030
|
function PathValidationScreen({
|
|
@@ -21034,7 +21048,7 @@ function PathValidationScreen({
|
|
|
21034
21048
|
useEffect8(() => {
|
|
21035
21049
|
setScan(scanFiles(resolvedPath));
|
|
21036
21050
|
}, [resolvedPath]);
|
|
21037
|
-
const phase = phaseOf(scan);
|
|
21051
|
+
const phase = phaseOf(scan, { hasTokens });
|
|
21038
21052
|
const finish = (outcome, exitMethod) => {
|
|
21039
21053
|
void finishDebugRun({
|
|
21040
21054
|
outputs: { outcome, ...scanReport(scan, resolvedPath, { hasTokens }) },
|
|
@@ -21066,7 +21080,7 @@ function PathValidationScreen({
|
|
|
21066
21080
|
"..."
|
|
21067
21081
|
] }),
|
|
21068
21082
|
scan?.ok === false && /* @__PURE__ */ jsx13(Failure, { scan, path: resolvedPath }),
|
|
21069
|
-
scan?.ok === true && /* @__PURE__ */ jsx13(Summary, { scan, path: resolvedPath, hasTokens }),
|
|
21083
|
+
scan?.ok === true && /* @__PURE__ */ jsx13(Summary, { scan, path: resolvedPath, hasTokens, empty: phase === "empty" }),
|
|
21070
21084
|
/* @__PURE__ */ jsx13(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx13(ControlHints, { hints: controlsFor(phase) }) })
|
|
21071
21085
|
] })
|
|
21072
21086
|
] });
|
package/dist/package.json
CHANGED
|
@@ -12,7 +12,8 @@ export type ScanResult = {
|
|
|
12
12
|
ok: false;
|
|
13
13
|
failure: ScanFailureCode;
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
/** `empty` is a scan that worked but found nothing the import can use, so there is nothing to continue with. */
|
|
16
|
+
export type PathPhase = 'scanning' | 'ready' | 'empty' | 'failed';
|
|
16
17
|
export type KeyAction = 'confirm' | 'change-path' | 'back';
|
|
17
18
|
export interface SummaryRow {
|
|
18
19
|
label: string;
|
|
@@ -48,6 +49,15 @@ export declare function summarize(counts: FileCounts, { hasTokens }?: {
|
|
|
48
49
|
export declare function scanReport(scan: ScanResult | undefined, path: string, { hasTokens }?: {
|
|
49
50
|
hasTokens?: boolean;
|
|
50
51
|
}): Record<string, unknown>;
|
|
51
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Whether the scan found anything to import: component files, or (when the import also generates tokens) `.json`
|
|
54
|
+
* files. Without either there is nothing for the later steps to work on.
|
|
55
|
+
*/
|
|
56
|
+
export declare function hasImportableFiles(counts: FileCounts, { hasTokens }?: {
|
|
57
|
+
hasTokens?: boolean;
|
|
58
|
+
}): boolean;
|
|
59
|
+
export declare function phaseOf(scan: ScanResult | undefined, { hasTokens }?: {
|
|
60
|
+
hasTokens?: boolean;
|
|
61
|
+
}): PathPhase;
|
|
52
62
|
export declare function keyAction(phase: PathPhase, input: string, key: Key): KeyAction | undefined;
|
|
53
63
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.42.1-dev-build-
|
|
3
|
+
"version": "2.42.1-dev-build-4a0aab3f.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"ts-morph": "^27.0.2",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
47
47
|
"zod": "^4.6.5",
|
|
48
|
-
"@contentful/experience-design-system-types": "2.42.1-dev-build-
|
|
48
|
+
"@contentful/experience-design-system-types": "2.42.1-dev-build-4a0aab3f.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@tsconfig/node24": "^24.0.4",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"ink-testing-library": "^4.0.0",
|
|
60
60
|
"typescript-eslint": "^8.67.0",
|
|
61
61
|
"vitest": "^4.0.16",
|
|
62
|
-
"@contentful/experience-design-system-backend-pipeline": "2.42.1-dev-build-
|
|
62
|
+
"@contentful/experience-design-system-backend-pipeline": "2.42.1-dev-build-4a0aab3f.0"
|
|
63
63
|
},
|
|
64
64
|
"repository": {
|
|
65
65
|
"type": "git",
|