@contentful/experience-design-system-cli 2.37.1-dev-build-e3d4b041.0 → 2.37.1-dev-build-845e7310.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 +58 -16
- package/dist/index.js +65 -16
- package/dist/package.json +1 -1
- package/dist/src/tui/import/steps/00-preflight/logic.d.ts +2 -4
- package/dist/src/tui/import/steps/03-path-validation/logic.d.ts +7 -1
- package/dist/src/tui/import/steps/03-path-validation/screen.d.ts +3 -1
- package/dist/src/tui/import/steps/04-credentials/logic.d.ts +5 -0
- package/dist/src/tui/import/steps/04-credentials/screen.d.ts +3 -1
- package/dist/src/tui/import/steps/10-flow/screens/DoneStep.d.ts +6 -1
- package/dist/src/tui/import/steps/10-flow/screens/PushingStep.d.ts +3 -1
- package/dist/src/tui/import/steps/10-flow/support/produced.d.ts +15 -0
- package/package.json +3 -3
package/dist/app.js
CHANGED
|
@@ -3252,20 +3252,21 @@ function describeFailure(failure, path5) {
|
|
|
3252
3252
|
return { headline: `Cannot access: ${path5}`, hints: [] };
|
|
3253
3253
|
}
|
|
3254
3254
|
}
|
|
3255
|
-
function summarize(counts) {
|
|
3255
|
+
function summarize(counts, { hasTokens = true } = {}) {
|
|
3256
3256
|
const rows = ROW_ORDER.filter((category) => counts[category] > 0).map((category) => {
|
|
3257
|
+
if (category === "json" && !hasTokens) return { label: ".json files (ignored)", count: counts.json, tone: "muted" };
|
|
3257
3258
|
const tone = category === "json" ? "accent" : category === "other" ? "muted" : "default";
|
|
3258
3259
|
return { label: ROW_LABELS[category], count: counts[category], tone };
|
|
3259
3260
|
});
|
|
3260
3261
|
const componentFiles = COMPONENT_CATEGORIES.reduce((sum, category) => sum + counts[category], 0);
|
|
3261
3262
|
if (componentFiles > 0) return { total: counts.total, rows };
|
|
3262
|
-
if (counts.json > 0) {
|
|
3263
|
+
if (hasTokens && counts.json > 0) {
|
|
3263
3264
|
return { total: counts.total, rows, warning: "No component files found \u2014 only token files detected." };
|
|
3264
3265
|
}
|
|
3265
3266
|
return {
|
|
3266
3267
|
total: counts.total,
|
|
3267
3268
|
rows,
|
|
3268
|
-
warning: "No component or token files found. Try a different path."
|
|
3269
|
+
warning: hasTokens ? "No component or token files found. Try a different path." : "No component files found. Try a different path."
|
|
3269
3270
|
};
|
|
3270
3271
|
}
|
|
3271
3272
|
function phaseOf(scan) {
|
|
@@ -17104,8 +17105,12 @@ function Failure({ scan, path: path5 }) {
|
|
|
17104
17105
|
hints.map((hint) => /* @__PURE__ */ jsx12(Text11, { color: PALETTE.muted, children: hint }, hint))
|
|
17105
17106
|
] });
|
|
17106
17107
|
}
|
|
17107
|
-
function Summary({
|
|
17108
|
-
|
|
17108
|
+
function Summary({
|
|
17109
|
+
scan,
|
|
17110
|
+
path: path5,
|
|
17111
|
+
hasTokens
|
|
17112
|
+
}) {
|
|
17113
|
+
const { total, rows, warning } = summarize(scan.counts, { hasTokens });
|
|
17109
17114
|
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", gap: 1, children: [
|
|
17110
17115
|
/* @__PURE__ */ jsxs10(Text11, { children: [
|
|
17111
17116
|
"Scanned ",
|
|
@@ -17130,7 +17135,8 @@ function PathValidationScreen({
|
|
|
17130
17135
|
projectPath,
|
|
17131
17136
|
onConfirm,
|
|
17132
17137
|
onChangePath,
|
|
17133
|
-
onBack
|
|
17138
|
+
onBack,
|
|
17139
|
+
hasTokens = true
|
|
17134
17140
|
}) {
|
|
17135
17141
|
const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
|
|
17136
17142
|
const [scan, setScan] = useState7();
|
|
@@ -17152,7 +17158,7 @@ function PathValidationScreen({
|
|
|
17152
17158
|
"..."
|
|
17153
17159
|
] }),
|
|
17154
17160
|
scan?.ok === false && /* @__PURE__ */ jsx12(Failure, { scan, path: resolvedPath }),
|
|
17155
|
-
scan?.ok === true && /* @__PURE__ */ jsx12(Summary, { scan, path: resolvedPath }),
|
|
17161
|
+
scan?.ok === true && /* @__PURE__ */ jsx12(Summary, { scan, path: resolvedPath, hasTokens }),
|
|
17156
17162
|
/* @__PURE__ */ jsx12(Box10, { marginTop: 1, gap: 3, children: controlsFor(phase).map((control) => /* @__PURE__ */ jsxs10(Text11, { color: PALETTE.muted, children: [
|
|
17157
17163
|
"[",
|
|
17158
17164
|
control.keys,
|
|
@@ -17172,6 +17178,10 @@ import { useInput as useInput10 } from "ink";
|
|
|
17172
17178
|
|
|
17173
17179
|
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts
|
|
17174
17180
|
var FIELDS = ["spaceId", "environmentId", "cmaToken", "host"];
|
|
17181
|
+
function credentialsPurpose(tokensOnly) {
|
|
17182
|
+
const use = tokensOnly ? "We use it to push your design tokens" : "We use it to check what components already exist and to push your import";
|
|
17183
|
+
return `${use}. If you skip, files are saved locally and nothing is pushed.`;
|
|
17184
|
+
}
|
|
17175
17185
|
function keyAction2(input, key) {
|
|
17176
17186
|
if (key.escape) return "back";
|
|
17177
17187
|
if (key.tab) return "next-field";
|
|
@@ -17259,7 +17269,8 @@ function CredentialsScreen({
|
|
|
17259
17269
|
onDone,
|
|
17260
17270
|
onBack,
|
|
17261
17271
|
initial = {},
|
|
17262
|
-
validate: validate3 = validateCredentials
|
|
17272
|
+
validate: validate3 = validateCredentials,
|
|
17273
|
+
tokensOnly = false
|
|
17263
17274
|
}) {
|
|
17264
17275
|
const initialValues = useRef2(
|
|
17265
17276
|
normalize({
|
|
@@ -17305,7 +17316,7 @@ function CredentialsScreen({
|
|
|
17305
17316
|
/* @__PURE__ */ jsx13(Text12, { bold: true, children: "Contentful credentials" }),
|
|
17306
17317
|
/* @__PURE__ */ jsx13(Text12, { children: prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into." }),
|
|
17307
17318
|
!prefilled && /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
17308
|
-
/* @__PURE__ */ jsx13(Text12, { color: PALETTE.muted, children:
|
|
17319
|
+
/* @__PURE__ */ jsx13(Text12, { color: PALETTE.muted, children: credentialsPurpose(tokensOnly) }),
|
|
17309
17320
|
/* @__PURE__ */ jsx13(Text12, { color: PALETTE.muted, children: "Tip: save these under Settings \u2192 Configuration so they pre-fill here." })
|
|
17310
17321
|
] })
|
|
17311
17322
|
] }),
|
|
@@ -26535,6 +26546,8 @@ function DoneStep({
|
|
|
26535
26546
|
spaceId,
|
|
26536
26547
|
environmentId,
|
|
26537
26548
|
host,
|
|
26549
|
+
produced,
|
|
26550
|
+
credentialsSkipped = false,
|
|
26538
26551
|
failures = [],
|
|
26539
26552
|
onExit
|
|
26540
26553
|
}) {
|
|
@@ -26549,7 +26562,7 @@ function DoneStep({
|
|
|
26549
26562
|
const urlArgs = { host: host ?? "api.contentful.com", spaceId, environmentId };
|
|
26550
26563
|
return /* @__PURE__ */ jsxs39(Box38, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
26551
26564
|
success ? /* @__PURE__ */ jsx48(Text41, { bold: true, color: PALETTE.success, children: "Done!" }) : /* @__PURE__ */ jsx48(Text41, { bold: true, color: PALETTE.warning, children: "\u26A0 Finished with errors" }),
|
|
26552
|
-
totalPushed === 0 && totalFailed === 0 && !summary ? /* @__PURE__ */ jsx48(Text41, { color: PALETTE.muted, children: "Nothing was pushed \u2014 everything was already up to date." }) : /* @__PURE__ */ jsxs39(Box38, { flexDirection: "column", children: [
|
|
26565
|
+
totalPushed === 0 && totalFailed === 0 && !summary ? /* @__PURE__ */ jsx48(Text41, { color: PALETTE.muted, children: credentialsSkipped ? "Nothing was pushed \u2014 you skipped the Contentful credentials, so the files were only saved locally." : "Nothing was pushed \u2014 everything was already up to date." }) : /* @__PURE__ */ jsxs39(Box38, { flexDirection: "column", children: [
|
|
26553
26566
|
/* @__PURE__ */ jsx48(EntityRows, { entity: componentTypes, label: "Component Type" }),
|
|
26554
26567
|
/* @__PURE__ */ jsx48(EntityRows, { entity: designTokens, label: "Design Token" }),
|
|
26555
26568
|
summary && /* @__PURE__ */ jsx48(Box38, { marginTop: 1, children: /* @__PURE__ */ jsxs39(Text41, { color: PALETTE.muted, children: [
|
|
@@ -26578,8 +26591,8 @@ function DoneStep({
|
|
|
26578
26591
|
/* @__PURE__ */ jsx48(SpaceEnvironment, { spaceId, environmentId }),
|
|
26579
26592
|
success && totalPushed > 0 && /* @__PURE__ */ jsxs39(Box38, { flexDirection: "column", gap: 1, children: [
|
|
26580
26593
|
/* @__PURE__ */ jsx48(Text41, { color: PALETTE.success, children: "Your design system is now in Contentful Experiences." }),
|
|
26581
|
-
/* @__PURE__ */ jsx48(LinkRow, { title: "View your components here:", url: buildPostPushUrl2(urlArgs) }),
|
|
26582
|
-
/* @__PURE__ */ jsx48(
|
|
26594
|
+
produced.components && /* @__PURE__ */ jsx48(LinkRow, { title: "View your components here:", url: buildPostPushUrl2(urlArgs) }),
|
|
26595
|
+
produced.tokens && /* @__PURE__ */ jsx48(
|
|
26583
26596
|
LinkRow,
|
|
26584
26597
|
{
|
|
26585
26598
|
title: "View your design tokens here:",
|
|
@@ -26726,6 +26739,18 @@ function StepHeader({ stepNumber, totalSteps, title }) {
|
|
|
26726
26739
|
] });
|
|
26727
26740
|
}
|
|
26728
26741
|
|
|
26742
|
+
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/produced.ts
|
|
26743
|
+
function producedOf(state2) {
|
|
26744
|
+
return { components: state2.extractSessionId !== null, tokens: !!state2.tokensPath || state2.tokenSessionId !== null };
|
|
26745
|
+
}
|
|
26746
|
+
function fileSummaryLabel({ components }) {
|
|
26747
|
+
return components ? "components.json" : "components.json (design tokens only)";
|
|
26748
|
+
}
|
|
26749
|
+
function writtenThings({ components, tokens }) {
|
|
26750
|
+
if (components && tokens) return "component types and design tokens";
|
|
26751
|
+
return tokens ? "design tokens" : "component types";
|
|
26752
|
+
}
|
|
26753
|
+
|
|
26729
26754
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
|
|
26730
26755
|
import { useEffect as useEffect19, useState as useState27 } from "react";
|
|
26731
26756
|
import { Spinner as Spinner2 } from "@inkjs/ui";
|
|
@@ -26748,14 +26773,18 @@ function useTimedSpinner() {
|
|
|
26748
26773
|
|
|
26749
26774
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/PushingStep.tsx
|
|
26750
26775
|
import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
26751
|
-
function PushingStep({ stepNumber, totalSteps, progress }) {
|
|
26776
|
+
function PushingStep({ stepNumber, totalSteps, progress, produced }) {
|
|
26752
26777
|
const { elapsed } = useTimedSpinner();
|
|
26753
26778
|
const operationId = progress && progress.kind === "queued" ? progress.operationId : null;
|
|
26754
26779
|
const showGlobal = progress && progress.kind === "progress";
|
|
26755
26780
|
const showCurrent = progress && progress.kind === "progress" && progress.current ? progress.current : null;
|
|
26756
26781
|
return /* @__PURE__ */ jsxs42(Box41, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
26757
26782
|
/* @__PURE__ */ jsx52(StepHeader, { stepNumber, totalSteps, title: "Push to Contentful" }),
|
|
26758
|
-
/* @__PURE__ */
|
|
26783
|
+
/* @__PURE__ */ jsxs42(Text44, { children: [
|
|
26784
|
+
"Writing ",
|
|
26785
|
+
writtenThings(produced),
|
|
26786
|
+
" to your Contentful space..."
|
|
26787
|
+
] }),
|
|
26759
26788
|
operationId && /* @__PURE__ */ jsxs42(Box41, { gap: 1, children: [
|
|
26760
26789
|
/* @__PURE__ */ jsx52(Text44, { color: PALETTE.muted, children: "Operation:" }),
|
|
26761
26790
|
/* @__PURE__ */ jsx52(Text44, { children: operationId })
|
|
@@ -27269,6 +27298,7 @@ function FlowScreen({
|
|
|
27269
27298
|
onExit
|
|
27270
27299
|
}) {
|
|
27271
27300
|
const totalSteps = totalStepsFor(state2);
|
|
27301
|
+
const produced = producedOf(state2);
|
|
27272
27302
|
const quit = () => onExit(0);
|
|
27273
27303
|
const content = (() => {
|
|
27274
27304
|
switch (state2.step) {
|
|
@@ -27315,7 +27345,15 @@ function FlowScreen({
|
|
|
27315
27345
|
}
|
|
27316
27346
|
);
|
|
27317
27347
|
case "pushing":
|
|
27318
|
-
return /* @__PURE__ */ jsx54(
|
|
27348
|
+
return /* @__PURE__ */ jsx54(
|
|
27349
|
+
PushingStep,
|
|
27350
|
+
{
|
|
27351
|
+
stepNumber: totalSteps,
|
|
27352
|
+
totalSteps,
|
|
27353
|
+
progress: state2.pushProgress,
|
|
27354
|
+
produced
|
|
27355
|
+
}
|
|
27356
|
+
);
|
|
27319
27357
|
case "path-prompt":
|
|
27320
27358
|
return /* @__PURE__ */ jsx54(
|
|
27321
27359
|
PathPrompt,
|
|
@@ -27341,7 +27379,7 @@ function FlowScreen({
|
|
|
27341
27379
|
GateStep,
|
|
27342
27380
|
{
|
|
27343
27381
|
message: "Files saved",
|
|
27344
|
-
summary: state2.componentsPath ?
|
|
27382
|
+
summary: state2.componentsPath ? `${fileSummaryLabel(produced)} \u2192 ${state2.componentsPath}` : void 0,
|
|
27345
27383
|
context: teaser ? `Your files are saved to disk. ${teaser}` : "Your files are saved to disk. Run `experiences import` again when you're ready to push to Contentful.",
|
|
27346
27384
|
continueLabel: "Exit",
|
|
27347
27385
|
onContinue: quit,
|
|
@@ -27361,6 +27399,8 @@ function FlowScreen({
|
|
|
27361
27399
|
spaceId: state2.spaceId,
|
|
27362
27400
|
environmentId: state2.environmentId,
|
|
27363
27401
|
host: state2.host,
|
|
27402
|
+
produced,
|
|
27403
|
+
credentialsSkipped: state2.credentialsSkipped,
|
|
27364
27404
|
onExit: () => onExit(totalFailed > 0 ? 1 : 0)
|
|
27365
27405
|
}
|
|
27366
27406
|
);
|
|
@@ -29809,6 +29849,7 @@ function App({ importOptions, inkClear }) {
|
|
|
29809
29849
|
PathValidationScreen,
|
|
29810
29850
|
{
|
|
29811
29851
|
projectPath: answers.projectPath ?? "",
|
|
29852
|
+
hasTokens: target !== "components",
|
|
29812
29853
|
onConfirm: ({ filePaths }) => answer({ scannedFiles: filePaths }),
|
|
29813
29854
|
onChangePath: () => resetImport(true),
|
|
29814
29855
|
onBack: () => goBackFrom("path-validation")
|
|
@@ -29888,6 +29929,7 @@ function App({ importOptions, inkClear }) {
|
|
|
29888
29929
|
CredentialsScreen,
|
|
29889
29930
|
{
|
|
29890
29931
|
initial: importDefaults.credentials,
|
|
29932
|
+
tokensOnly: target === "tokens",
|
|
29891
29933
|
onBack: () => goBackFrom("credentials"),
|
|
29892
29934
|
onDone: (result) => void finishCredentials(result, answers)
|
|
29893
29935
|
}
|
package/dist/index.js
CHANGED
|
@@ -19281,20 +19281,21 @@ function describeFailure(failure, path5) {
|
|
|
19281
19281
|
return { headline: `Cannot access: ${path5}`, hints: [] };
|
|
19282
19282
|
}
|
|
19283
19283
|
}
|
|
19284
|
-
function summarize(counts) {
|
|
19284
|
+
function summarize(counts, { hasTokens = true } = {}) {
|
|
19285
19285
|
const rows = ROW_ORDER.filter((category) => counts[category] > 0).map((category) => {
|
|
19286
|
+
if (category === "json" && !hasTokens) return { label: ".json files (ignored)", count: counts.json, tone: "muted" };
|
|
19286
19287
|
const tone = category === "json" ? "accent" : category === "other" ? "muted" : "default";
|
|
19287
19288
|
return { label: ROW_LABELS[category], count: counts[category], tone };
|
|
19288
19289
|
});
|
|
19289
19290
|
const componentFiles = COMPONENT_CATEGORIES.reduce((sum, category) => sum + counts[category], 0);
|
|
19290
19291
|
if (componentFiles > 0) return { total: counts.total, rows };
|
|
19291
|
-
if (counts.json > 0) {
|
|
19292
|
+
if (hasTokens && counts.json > 0) {
|
|
19292
19293
|
return { total: counts.total, rows, warning: "No component files found \u2014 only token files detected." };
|
|
19293
19294
|
}
|
|
19294
19295
|
return {
|
|
19295
19296
|
total: counts.total,
|
|
19296
19297
|
rows,
|
|
19297
|
-
warning: "No component or token files found. Try a different path."
|
|
19298
|
+
warning: hasTokens ? "No component or token files found. Try a different path." : "No component files found. Try a different path."
|
|
19298
19299
|
};
|
|
19299
19300
|
}
|
|
19300
19301
|
function phaseOf(scan) {
|
|
@@ -19408,8 +19409,12 @@ function Failure({ scan, path: path5 }) {
|
|
|
19408
19409
|
hints.map((hint) => /* @__PURE__ */ jsx12(Text11, { color: PALETTE.muted, children: hint }, hint))
|
|
19409
19410
|
] });
|
|
19410
19411
|
}
|
|
19411
|
-
function Summary({
|
|
19412
|
-
|
|
19412
|
+
function Summary({
|
|
19413
|
+
scan,
|
|
19414
|
+
path: path5,
|
|
19415
|
+
hasTokens
|
|
19416
|
+
}) {
|
|
19417
|
+
const { total, rows, warning } = summarize(scan.counts, { hasTokens });
|
|
19413
19418
|
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", gap: 1, children: [
|
|
19414
19419
|
/* @__PURE__ */ jsxs10(Text11, { children: [
|
|
19415
19420
|
"Scanned ",
|
|
@@ -19434,7 +19439,8 @@ function PathValidationScreen({
|
|
|
19434
19439
|
projectPath,
|
|
19435
19440
|
onConfirm,
|
|
19436
19441
|
onChangePath,
|
|
19437
|
-
onBack
|
|
19442
|
+
onBack,
|
|
19443
|
+
hasTokens = true
|
|
19438
19444
|
}) {
|
|
19439
19445
|
const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
|
|
19440
19446
|
const [scan, setScan] = useState7();
|
|
@@ -19456,7 +19462,7 @@ function PathValidationScreen({
|
|
|
19456
19462
|
"..."
|
|
19457
19463
|
] }),
|
|
19458
19464
|
scan?.ok === false && /* @__PURE__ */ jsx12(Failure, { scan, path: resolvedPath }),
|
|
19459
|
-
scan?.ok === true && /* @__PURE__ */ jsx12(Summary, { scan, path: resolvedPath }),
|
|
19465
|
+
scan?.ok === true && /* @__PURE__ */ jsx12(Summary, { scan, path: resolvedPath, hasTokens }),
|
|
19460
19466
|
/* @__PURE__ */ jsx12(Box10, { marginTop: 1, gap: 3, children: controlsFor(phase).map((control) => /* @__PURE__ */ jsxs10(Text11, { color: PALETTE.muted, children: [
|
|
19461
19467
|
"[",
|
|
19462
19468
|
control.keys,
|
|
@@ -19477,6 +19483,10 @@ var init_screen4 = __esm({
|
|
|
19477
19483
|
});
|
|
19478
19484
|
|
|
19479
19485
|
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts
|
|
19486
|
+
function credentialsPurpose(tokensOnly) {
|
|
19487
|
+
const use = tokensOnly ? "We use it to push your design tokens" : "We use it to check what components already exist and to push your import";
|
|
19488
|
+
return `${use}. If you skip, files are saved locally and nothing is pushed.`;
|
|
19489
|
+
}
|
|
19480
19490
|
function keyAction2(input, key) {
|
|
19481
19491
|
if (key.escape) return "back";
|
|
19482
19492
|
if (key.tab) return "next-field";
|
|
@@ -19590,7 +19600,8 @@ function CredentialsScreen({
|
|
|
19590
19600
|
onDone,
|
|
19591
19601
|
onBack,
|
|
19592
19602
|
initial = {},
|
|
19593
|
-
validate: validate3 = validateCredentials
|
|
19603
|
+
validate: validate3 = validateCredentials,
|
|
19604
|
+
tokensOnly = false
|
|
19594
19605
|
}) {
|
|
19595
19606
|
const initialValues = useRef2(
|
|
19596
19607
|
normalize({
|
|
@@ -19636,7 +19647,7 @@ function CredentialsScreen({
|
|
|
19636
19647
|
/* @__PURE__ */ jsx13(Text12, { bold: true, children: "Contentful credentials" }),
|
|
19637
19648
|
/* @__PURE__ */ jsx13(Text12, { children: prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into." }),
|
|
19638
19649
|
!prefilled && /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
19639
|
-
/* @__PURE__ */ jsx13(Text12, { color: PALETTE.muted, children:
|
|
19650
|
+
/* @__PURE__ */ jsx13(Text12, { color: PALETTE.muted, children: credentialsPurpose(tokensOnly) }),
|
|
19640
19651
|
/* @__PURE__ */ jsx13(Text12, { color: PALETTE.muted, children: "Tip: save these under Settings \u2192 Configuration so they pre-fill here." })
|
|
19641
19652
|
] })
|
|
19642
19653
|
] }),
|
|
@@ -29687,6 +29698,8 @@ function DoneStep({
|
|
|
29687
29698
|
spaceId,
|
|
29688
29699
|
environmentId,
|
|
29689
29700
|
host,
|
|
29701
|
+
produced,
|
|
29702
|
+
credentialsSkipped = false,
|
|
29690
29703
|
failures = [],
|
|
29691
29704
|
onExit
|
|
29692
29705
|
}) {
|
|
@@ -29701,7 +29714,7 @@ function DoneStep({
|
|
|
29701
29714
|
const urlArgs = { host: host ?? "api.contentful.com", spaceId, environmentId };
|
|
29702
29715
|
return /* @__PURE__ */ jsxs39(Box38, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
29703
29716
|
success ? /* @__PURE__ */ jsx48(Text41, { bold: true, color: PALETTE.success, children: "Done!" }) : /* @__PURE__ */ jsx48(Text41, { bold: true, color: PALETTE.warning, children: "\u26A0 Finished with errors" }),
|
|
29704
|
-
totalPushed === 0 && totalFailed === 0 && !summary ? /* @__PURE__ */ jsx48(Text41, { color: PALETTE.muted, children: "Nothing was pushed \u2014 everything was already up to date." }) : /* @__PURE__ */ jsxs39(Box38, { flexDirection: "column", children: [
|
|
29717
|
+
totalPushed === 0 && totalFailed === 0 && !summary ? /* @__PURE__ */ jsx48(Text41, { color: PALETTE.muted, children: credentialsSkipped ? "Nothing was pushed \u2014 you skipped the Contentful credentials, so the files were only saved locally." : "Nothing was pushed \u2014 everything was already up to date." }) : /* @__PURE__ */ jsxs39(Box38, { flexDirection: "column", children: [
|
|
29705
29718
|
/* @__PURE__ */ jsx48(EntityRows, { entity: componentTypes, label: "Component Type" }),
|
|
29706
29719
|
/* @__PURE__ */ jsx48(EntityRows, { entity: designTokens, label: "Design Token" }),
|
|
29707
29720
|
summary && /* @__PURE__ */ jsx48(Box38, { marginTop: 1, children: /* @__PURE__ */ jsxs39(Text41, { color: PALETTE.muted, children: [
|
|
@@ -29730,8 +29743,8 @@ function DoneStep({
|
|
|
29730
29743
|
/* @__PURE__ */ jsx48(SpaceEnvironment, { spaceId, environmentId }),
|
|
29731
29744
|
success && totalPushed > 0 && /* @__PURE__ */ jsxs39(Box38, { flexDirection: "column", gap: 1, children: [
|
|
29732
29745
|
/* @__PURE__ */ jsx48(Text41, { color: PALETTE.success, children: "Your design system is now in Contentful Experiences." }),
|
|
29733
|
-
/* @__PURE__ */ jsx48(LinkRow, { title: "View your components here:", url: buildPostPushUrl2(urlArgs) }),
|
|
29734
|
-
/* @__PURE__ */ jsx48(
|
|
29746
|
+
produced.components && /* @__PURE__ */ jsx48(LinkRow, { title: "View your components here:", url: buildPostPushUrl2(urlArgs) }),
|
|
29747
|
+
produced.tokens && /* @__PURE__ */ jsx48(
|
|
29735
29748
|
LinkRow,
|
|
29736
29749
|
{
|
|
29737
29750
|
title: "View your design tokens here:",
|
|
@@ -29908,6 +29921,23 @@ var init_StepHeader = __esm({
|
|
|
29908
29921
|
}
|
|
29909
29922
|
});
|
|
29910
29923
|
|
|
29924
|
+
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/produced.ts
|
|
29925
|
+
function producedOf(state2) {
|
|
29926
|
+
return { components: state2.extractSessionId !== null, tokens: !!state2.tokensPath || state2.tokenSessionId !== null };
|
|
29927
|
+
}
|
|
29928
|
+
function fileSummaryLabel({ components }) {
|
|
29929
|
+
return components ? "components.json" : "components.json (design tokens only)";
|
|
29930
|
+
}
|
|
29931
|
+
function writtenThings({ components, tokens }) {
|
|
29932
|
+
if (components && tokens) return "component types and design tokens";
|
|
29933
|
+
return tokens ? "design tokens" : "component types";
|
|
29934
|
+
}
|
|
29935
|
+
var init_produced = __esm({
|
|
29936
|
+
"packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/produced.ts"() {
|
|
29937
|
+
"use strict";
|
|
29938
|
+
}
|
|
29939
|
+
});
|
|
29940
|
+
|
|
29911
29941
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
|
|
29912
29942
|
import { useEffect as useEffect19, useState as useState27 } from "react";
|
|
29913
29943
|
import { Spinner as Spinner2 } from "@inkjs/ui";
|
|
@@ -29937,14 +29967,18 @@ var init_use_timed_spinner = __esm({
|
|
|
29937
29967
|
import { Box as Box41, Text as Text44 } from "ink";
|
|
29938
29968
|
import { ProgressBar as ProgressBar2, ThemeProvider as ThemeProvider2 } from "@inkjs/ui";
|
|
29939
29969
|
import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
29940
|
-
function PushingStep({ stepNumber, totalSteps, progress }) {
|
|
29970
|
+
function PushingStep({ stepNumber, totalSteps, progress, produced }) {
|
|
29941
29971
|
const { elapsed } = useTimedSpinner();
|
|
29942
29972
|
const operationId = progress && progress.kind === "queued" ? progress.operationId : null;
|
|
29943
29973
|
const showGlobal = progress && progress.kind === "progress";
|
|
29944
29974
|
const showCurrent = progress && progress.kind === "progress" && progress.current ? progress.current : null;
|
|
29945
29975
|
return /* @__PURE__ */ jsxs42(Box41, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
29946
29976
|
/* @__PURE__ */ jsx52(StepHeader, { stepNumber, totalSteps, title: "Push to Contentful" }),
|
|
29947
|
-
/* @__PURE__ */
|
|
29977
|
+
/* @__PURE__ */ jsxs42(Text44, { children: [
|
|
29978
|
+
"Writing ",
|
|
29979
|
+
writtenThings(produced),
|
|
29980
|
+
" to your Contentful space..."
|
|
29981
|
+
] }),
|
|
29948
29982
|
operationId && /* @__PURE__ */ jsxs42(Box41, { gap: 1, children: [
|
|
29949
29983
|
/* @__PURE__ */ jsx52(Text44, { color: PALETTE.muted, children: "Operation:" }),
|
|
29950
29984
|
/* @__PURE__ */ jsx52(Text44, { children: operationId })
|
|
@@ -29972,6 +30006,7 @@ var init_PushingStep = __esm({
|
|
|
29972
30006
|
"packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/PushingStep.tsx"() {
|
|
29973
30007
|
"use strict";
|
|
29974
30008
|
init_StepHeader();
|
|
30009
|
+
init_produced();
|
|
29975
30010
|
init_use_timed_spinner();
|
|
29976
30011
|
init_theme2();
|
|
29977
30012
|
init_theme();
|
|
@@ -30495,6 +30530,7 @@ function FlowScreen({
|
|
|
30495
30530
|
onExit
|
|
30496
30531
|
}) {
|
|
30497
30532
|
const totalSteps = totalStepsFor(state2);
|
|
30533
|
+
const produced = producedOf(state2);
|
|
30498
30534
|
const quit = () => onExit(0);
|
|
30499
30535
|
const content = (() => {
|
|
30500
30536
|
switch (state2.step) {
|
|
@@ -30541,7 +30577,15 @@ function FlowScreen({
|
|
|
30541
30577
|
}
|
|
30542
30578
|
);
|
|
30543
30579
|
case "pushing":
|
|
30544
|
-
return /* @__PURE__ */ jsx54(
|
|
30580
|
+
return /* @__PURE__ */ jsx54(
|
|
30581
|
+
PushingStep,
|
|
30582
|
+
{
|
|
30583
|
+
stepNumber: totalSteps,
|
|
30584
|
+
totalSteps,
|
|
30585
|
+
progress: state2.pushProgress,
|
|
30586
|
+
produced
|
|
30587
|
+
}
|
|
30588
|
+
);
|
|
30545
30589
|
case "path-prompt":
|
|
30546
30590
|
return /* @__PURE__ */ jsx54(
|
|
30547
30591
|
PathPrompt,
|
|
@@ -30567,7 +30611,7 @@ function FlowScreen({
|
|
|
30567
30611
|
GateStep,
|
|
30568
30612
|
{
|
|
30569
30613
|
message: "Files saved",
|
|
30570
|
-
summary: state2.componentsPath ?
|
|
30614
|
+
summary: state2.componentsPath ? `${fileSummaryLabel(produced)} \u2192 ${state2.componentsPath}` : void 0,
|
|
30571
30615
|
context: teaser ? `Your files are saved to disk. ${teaser}` : "Your files are saved to disk. Run `experiences import` again when you're ready to push to Contentful.",
|
|
30572
30616
|
continueLabel: "Exit",
|
|
30573
30617
|
onContinue: quit,
|
|
@@ -30587,6 +30631,8 @@ function FlowScreen({
|
|
|
30587
30631
|
spaceId: state2.spaceId,
|
|
30588
30632
|
environmentId: state2.environmentId,
|
|
30589
30633
|
host: state2.host,
|
|
30634
|
+
produced,
|
|
30635
|
+
credentialsSkipped: state2.credentialsSkipped,
|
|
30590
30636
|
onExit: () => onExit(totalFailed > 0 ? 1 : 0)
|
|
30591
30637
|
}
|
|
30592
30638
|
);
|
|
@@ -30632,6 +30678,7 @@ var init_screen10 = __esm({
|
|
|
30632
30678
|
init_PathPrompt();
|
|
30633
30679
|
init_PushingStep();
|
|
30634
30680
|
init_WizardPreviewStep();
|
|
30681
|
+
init_produced();
|
|
30635
30682
|
init_run_teaser();
|
|
30636
30683
|
}
|
|
30637
30684
|
});
|
|
@@ -33441,6 +33488,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33441
33488
|
PathValidationScreen,
|
|
33442
33489
|
{
|
|
33443
33490
|
projectPath: answers.projectPath ?? "",
|
|
33491
|
+
hasTokens: target !== "components",
|
|
33444
33492
|
onConfirm: ({ filePaths }) => answer({ scannedFiles: filePaths }),
|
|
33445
33493
|
onChangePath: () => resetImport(true),
|
|
33446
33494
|
onBack: () => goBackFrom("path-validation")
|
|
@@ -33520,6 +33568,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33520
33568
|
CredentialsScreen,
|
|
33521
33569
|
{
|
|
33522
33570
|
initial: importDefaults.credentials,
|
|
33571
|
+
tokensOnly: target === "tokens",
|
|
33523
33572
|
onBack: () => goBackFrom("credentials"),
|
|
33524
33573
|
onDone: (result) => void finishCredentials(result, answers)
|
|
33525
33574
|
}
|
package/dist/package.json
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
+
import type { OverviewStep } from '../../shared/index.js';
|
|
1
2
|
export type ImportTarget = 'both' | 'tokens' | 'components';
|
|
2
3
|
export declare const IMPORT_TARGET_OPTIONS: ReadonlyArray<{
|
|
3
4
|
target: ImportTarget;
|
|
4
5
|
label: string;
|
|
5
6
|
}>;
|
|
6
|
-
export declare const TOKENS_ONLY_OVERVIEW:
|
|
7
|
-
description: string;
|
|
8
|
-
ai: boolean;
|
|
9
|
-
}>;
|
|
7
|
+
export declare const TOKENS_ONLY_OVERVIEW: readonly OverviewStep[];
|
|
10
8
|
export declare const TOKENS_ONLY_STEP_COUNT: number;
|
|
11
9
|
export type ImportStepId = 'project' | 'token-file' | 'path-validation' | 'credentials' | 'component-extraction' | 'token-generation' | 'scope-gate' | 'generation' | 'review' | 'save-push';
|
|
12
10
|
export declare function stepsFor(target: ImportTarget): readonly ImportStepId[];
|
|
@@ -33,7 +33,13 @@ interface Key {
|
|
|
33
33
|
return: boolean;
|
|
34
34
|
}
|
|
35
35
|
export declare function describeFailure(failure: ScanFailureCode, path: string): FailureMessage;
|
|
36
|
-
|
|
36
|
+
/**
|
|
37
|
+
* The scan result as rows and a warning. When the import does not generate tokens (components only), `.json` files are
|
|
38
|
+
* not design tokens here, so the row says they are ignored and the warnings do not mention tokens.
|
|
39
|
+
*/
|
|
40
|
+
export declare function summarize(counts: FileCounts, { hasTokens }?: {
|
|
41
|
+
hasTokens?: boolean;
|
|
42
|
+
}): Summary;
|
|
37
43
|
export declare function phaseOf(scan: ScanResult | undefined): PathPhase;
|
|
38
44
|
export declare function keyAction(phase: PathPhase, input: string, key: Key): KeyAction | undefined;
|
|
39
45
|
export {};
|
|
@@ -7,6 +7,8 @@ interface PathValidationScreenProps {
|
|
|
7
7
|
}) => void;
|
|
8
8
|
onChangePath: () => void;
|
|
9
9
|
onBack: () => void;
|
|
10
|
+
/** False when the import does not generate tokens, so `.json` files are not described as design tokens. */
|
|
11
|
+
hasTokens?: boolean;
|
|
10
12
|
}
|
|
11
|
-
export declare function PathValidationScreen({ projectPath, onConfirm, onChangePath, onBack, }: PathValidationScreenProps): React.ReactElement;
|
|
13
|
+
export declare function PathValidationScreen({ projectPath, onConfirm, onChangePath, onBack, hasTokens, }: PathValidationScreenProps): React.ReactElement;
|
|
12
14
|
export {};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export declare const FIELDS: readonly ["spaceId", "environmentId", "cmaToken", "host"];
|
|
2
2
|
export type CredentialField = (typeof FIELDS)[number];
|
|
3
3
|
export type CredentialValues = Record<CredentialField, string>;
|
|
4
|
+
/**
|
|
5
|
+
* Why the space is asked for. Components are looked up in it before they are generated, so that is part of the reason
|
|
6
|
+
* unless the import only generates tokens, which has nothing to look up.
|
|
7
|
+
*/
|
|
8
|
+
export declare function credentialsPurpose(tokensOnly: boolean): string;
|
|
4
9
|
interface Key {
|
|
5
10
|
escape: boolean;
|
|
6
11
|
tab: boolean;
|
|
@@ -12,6 +12,8 @@ interface CredentialsScreenProps {
|
|
|
12
12
|
onBack: () => void;
|
|
13
13
|
initial?: Partial<CredentialValues>;
|
|
14
14
|
validate?: (values: CredentialValues) => Promise<ValidationResult>;
|
|
15
|
+
/** The import only generates tokens, so there are no components to look up in the space. */
|
|
16
|
+
tokensOnly?: boolean;
|
|
15
17
|
}
|
|
16
|
-
export declare function CredentialsScreen({ onDone, onBack, initial, validate, }: CredentialsScreenProps): React.ReactElement;
|
|
18
|
+
export declare function CredentialsScreen({ onDone, onBack, initial, validate, tokensOnly, }: CredentialsScreenProps): React.ReactElement;
|
|
17
19
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { Produced } from '../support/produced.js';
|
|
2
3
|
type EntityResult = {
|
|
3
4
|
created: number;
|
|
4
5
|
updated: number;
|
|
@@ -16,6 +17,10 @@ type DoneStepProps = {
|
|
|
16
17
|
spaceId: string;
|
|
17
18
|
environmentId: string;
|
|
18
19
|
host?: string;
|
|
20
|
+
/** What the import produced, so only the links to those things are offered. */
|
|
21
|
+
produced: Produced;
|
|
22
|
+
/** The user skipped the credentials, so nothing could be pushed: the files were only saved. */
|
|
23
|
+
credentialsSkipped?: boolean;
|
|
19
24
|
runTeaser?: string;
|
|
20
25
|
failures?: Array<{
|
|
21
26
|
entityType: string;
|
|
@@ -24,5 +29,5 @@ type DoneStepProps = {
|
|
|
24
29
|
}>;
|
|
25
30
|
onExit: () => void;
|
|
26
31
|
};
|
|
27
|
-
export declare function DoneStep({ componentTypes, designTokens, summary, spaceId, environmentId, host, failures, onExit, }: DoneStepProps): React.ReactElement;
|
|
32
|
+
export declare function DoneStep({ componentTypes, designTokens, summary, spaceId, environmentId, host, produced, credentialsSkipped, failures, onExit, }: DoneStepProps): React.ReactElement;
|
|
28
33
|
export {};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { PushProgress } from '../support/push-progress.js';
|
|
3
|
+
import { type Produced } from '../support/produced.js';
|
|
3
4
|
type PushingStepProps = {
|
|
4
5
|
stepNumber: number;
|
|
5
6
|
totalSteps: number;
|
|
6
7
|
progress: PushProgress;
|
|
8
|
+
produced: Produced;
|
|
7
9
|
};
|
|
8
|
-
export declare function PushingStep({ stepNumber, totalSteps, progress }: PushingStepProps): React.ReactElement;
|
|
10
|
+
export declare function PushingStep({ stepNumber, totalSteps, progress, produced }: PushingStepProps): React.ReactElement;
|
|
9
11
|
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FlowState } from '../flow/types.js';
|
|
2
|
+
/** What an import produced, so the screens after the work can describe what happened and not a fixed pair. */
|
|
3
|
+
export interface Produced {
|
|
4
|
+
components: boolean;
|
|
5
|
+
tokens: boolean;
|
|
6
|
+
}
|
|
7
|
+
/** Components exist when extraction ran; tokens exist when the token stage left a catalog or a session behind. */
|
|
8
|
+
export declare function producedOf(state: Pick<FlowState, 'extractSessionId' | 'tokensPath' | 'tokenSessionId'>): Produced;
|
|
9
|
+
/**
|
|
10
|
+
* How the saved file is described: the file is always named `components.json`, but when only tokens were generated it
|
|
11
|
+
* holds just the tokens, and calling it a components file would mislead.
|
|
12
|
+
*/
|
|
13
|
+
export declare function fileSummaryLabel({ components }: Produced): string;
|
|
14
|
+
/** "component types and design tokens", "design tokens", or "component types": the things this run writes. */
|
|
15
|
+
export declare function writtenThings({ components, tokens }: Produced): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.37.1-dev-build-
|
|
3
|
+
"version": "2.37.1-dev-build-845e7310.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"ts-morph": "^27.0.2",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
47
47
|
"zod": "^4.6.5",
|
|
48
|
-
"@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-
|
|
49
|
-
"@contentful/experience-design-system-types": "2.37.1-dev-build-
|
|
48
|
+
"@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-845e7310.0",
|
|
49
|
+
"@contentful/experience-design-system-types": "2.37.1-dev-build-845e7310.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@tsconfig/node24": "^24.0.4",
|