@contentful/experience-design-system-cli 2.17.2-dev-build-ea1aade.0 → 2.17.2-dev-build-ebba024.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/package.json +1 -1
- package/dist/src/apply/command.js +0 -3
- package/dist/src/apply/tui/ServerApplyView.d.ts +2 -4
- package/dist/src/apply/tui/ServerApplyView.js +4 -5
- package/dist/src/apply/tui/ServerPreviewView.d.ts +1 -2
- package/dist/src/apply/tui/ServerPreviewView.js +2 -2
- package/dist/src/import/tui/WizardApp.js +3 -3
- package/dist/src/import/tui/steps/WizardPreviewStep.d.ts +2 -3
- package/dist/src/import/tui/steps/WizardPreviewStep.js +3 -9
- package/package.json +3 -3
package/dist/package.json
CHANGED
|
@@ -457,7 +457,6 @@ export function registerApplyCommand(program) {
|
|
|
457
457
|
preview,
|
|
458
458
|
spaceId,
|
|
459
459
|
environmentId,
|
|
460
|
-
allowDeletions: false,
|
|
461
460
|
}));
|
|
462
461
|
await waitUntilExit();
|
|
463
462
|
}
|
|
@@ -519,7 +518,6 @@ export function registerApplyCommand(program) {
|
|
|
519
518
|
preview,
|
|
520
519
|
spaceId,
|
|
521
520
|
environmentId,
|
|
522
|
-
allowDeletions: opts.allowDeletions === true,
|
|
523
521
|
}));
|
|
524
522
|
await waitUntilExit();
|
|
525
523
|
}
|
|
@@ -634,7 +632,6 @@ export function registerApplyCommand(program) {
|
|
|
634
632
|
spaceId,
|
|
635
633
|
environmentId,
|
|
636
634
|
breakingWithImpact,
|
|
637
|
-
allowDeletions: opts.allowDeletions === true,
|
|
638
635
|
onConfirm: (acknowledge) => {
|
|
639
636
|
void runApply(acknowledge);
|
|
640
637
|
},
|
|
@@ -5,18 +5,16 @@ interface ServerPreviewConfirmProps {
|
|
|
5
5
|
spaceId: string;
|
|
6
6
|
environmentId: string;
|
|
7
7
|
breakingWithImpact: boolean;
|
|
8
|
-
allowDeletions: boolean;
|
|
9
8
|
onConfirm: (acknowledge: boolean) => void;
|
|
10
9
|
onCancel: () => void;
|
|
11
10
|
}
|
|
12
|
-
export declare function ServerPreviewConfirm({ preview, spaceId, environmentId, breakingWithImpact,
|
|
11
|
+
export declare function ServerPreviewConfirm({ preview, spaceId, environmentId, breakingWithImpact, onConfirm, onCancel, }: ServerPreviewConfirmProps): React.ReactElement;
|
|
13
12
|
interface ServerPreviewAppProps {
|
|
14
13
|
preview: ServerPreviewResponse;
|
|
15
14
|
spaceId: string;
|
|
16
15
|
environmentId: string;
|
|
17
|
-
allowDeletions: boolean;
|
|
18
16
|
}
|
|
19
|
-
export declare function ServerPreviewApp({ preview, spaceId, environmentId
|
|
17
|
+
export declare function ServerPreviewApp({ preview, spaceId, environmentId }: ServerPreviewAppProps): React.ReactElement;
|
|
20
18
|
interface ServerApplyProgressProps {
|
|
21
19
|
spaceId: string;
|
|
22
20
|
environmentId: string;
|
|
@@ -3,22 +3,21 @@ import { Box, Text, useInput } from 'ink';
|
|
|
3
3
|
import { ServerPreviewView } from './ServerPreviewView.js';
|
|
4
4
|
import { buildPostPushUrl } from '../../lib/contentful-urls.js';
|
|
5
5
|
import { formatEdsiError } from '../../lib/error-parser.js';
|
|
6
|
-
export function ServerPreviewConfirm({ preview, spaceId, environmentId, breakingWithImpact,
|
|
6
|
+
export function ServerPreviewConfirm({ preview, spaceId, environmentId, breakingWithImpact, onConfirm, onCancel, }) {
|
|
7
7
|
useInput((input, key) => {
|
|
8
8
|
if (key.return)
|
|
9
9
|
onConfirm(breakingWithImpact);
|
|
10
10
|
if (key.escape || input === 'q')
|
|
11
11
|
onCancel();
|
|
12
12
|
});
|
|
13
|
-
|
|
14
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(ServerPreviewView, { preview: preview, spaceId: spaceId, environmentId: environmentId, allowDeletions: allowDeletions }), _jsxs(Box, { paddingX: 2, flexDirection: "column", children: [breakingWithImpact && (_jsxs(Text, { color: "red", bold: true, children: [' ', "\u26A0 Breaking changes will affect downstream entities. Press Enter to acknowledge and apply."] })), allowDeletions && removedCount > 0 && (_jsxs(Text, { color: "red", bold: true, children: [' ', "\u26A0 ", removedCount, " missing ", removedCount === 1 ? 'entity' : 'entities', " will be permanently deleted. Press Enter to confirm."] })), _jsxs(Text, { children: [' ', "Press ", _jsx(Text, { bold: true, children: "Enter" }), " to apply, ", _jsx(Text, { bold: true, children: "Esc" }), " to cancel"] })] })] }));
|
|
13
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(ServerPreviewView, { preview: preview, spaceId: spaceId, environmentId: environmentId }), _jsxs(Box, { paddingX: 2, flexDirection: "column", children: [breakingWithImpact && (_jsxs(Text, { color: "red", bold: true, children: [' ', "\u26A0 Breaking changes will affect downstream entities. Press Enter to acknowledge and apply."] })), _jsxs(Text, { children: [' ', "Press ", _jsx(Text, { bold: true, children: "Enter" }), " to apply, ", _jsx(Text, { bold: true, children: "Esc" }), " to cancel"] })] })] }));
|
|
15
14
|
}
|
|
16
|
-
export function ServerPreviewApp({ preview, spaceId, environmentId
|
|
15
|
+
export function ServerPreviewApp({ preview, spaceId, environmentId }) {
|
|
17
16
|
useInput((input, key) => {
|
|
18
17
|
if (key.escape || input === 'q')
|
|
19
18
|
process.exit(0);
|
|
20
19
|
});
|
|
21
|
-
return
|
|
20
|
+
return _jsx(ServerPreviewView, { preview: preview, spaceId: spaceId, environmentId: environmentId });
|
|
22
21
|
}
|
|
23
22
|
export function ServerApplyProgress({ spaceId, environmentId, status, operationId, error, }) {
|
|
24
23
|
useInput((_input, key) => {
|
|
@@ -4,7 +4,6 @@ interface ServerPreviewViewProps {
|
|
|
4
4
|
preview: ServerPreviewResponse;
|
|
5
5
|
spaceId: string;
|
|
6
6
|
environmentId: string;
|
|
7
|
-
allowDeletions: boolean;
|
|
8
7
|
}
|
|
9
|
-
export declare function ServerPreviewView({ preview, spaceId, environmentId
|
|
8
|
+
export declare function ServerPreviewView({ preview, spaceId, environmentId }: ServerPreviewViewProps): React.ReactElement;
|
|
10
9
|
export {};
|
|
@@ -13,11 +13,11 @@ function DraftWarning({ hasDraft }) {
|
|
|
13
13
|
return null;
|
|
14
14
|
return _jsx(Text, { color: "yellow", children: " \u26A1 has pending draft changes" });
|
|
15
15
|
}
|
|
16
|
-
export function ServerPreviewView({ preview, spaceId, environmentId
|
|
16
|
+
export function ServerPreviewView({ preview, spaceId, environmentId }) {
|
|
17
17
|
const { components, tokens } = preview;
|
|
18
18
|
const totalComponents = components.new.length + components.changed.length + components.unchanged.length + components.removed.length;
|
|
19
19
|
const totalTokens = tokens.new.length + tokens.changed.length + tokens.unchanged.length + tokens.removed.length;
|
|
20
|
-
return (_jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [_jsxs(Text, { bold: true, children: ["Preview \u2014 ", environmentId, " @ ", spaceId] }), _jsx(Text, { children: " " }), totalComponents > 0 && (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { bold: true, children: [" Component Types (", totalComponents, " total)"] }), _jsxs(Text, { color: "green", children: [" \u2746 ", components.new.length, " to create"] }), _jsxs(Text, { color: "yellow", children: [" ~ ", components.changed.length, " to update"] }), _jsxs(Text, { color:
|
|
20
|
+
return (_jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [_jsxs(Text, { bold: true, children: ["Preview \u2014 ", environmentId, " @ ", spaceId] }), _jsx(Text, { children: " " }), totalComponents > 0 && (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { bold: true, children: [" Component Types (", totalComponents, " total)"] }), _jsxs(Text, { color: "green", children: [" \u2746 ", components.new.length, " to create"] }), _jsxs(Text, { color: "yellow", children: [" ~ ", components.changed.length, " to update"] }), _jsxs(Text, { color: "red", children: [" \u2717 ", components.removed.length, " to remove"] }), _jsxs(Text, { dimColor: true, children: [" \u00B7 ", components.unchanged.length, " unchanged"] }), components.changed.map((item, i) => (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { flexDirection: "row", children: [_jsxs(Text, { color: "yellow", children: [" ~ ", item.current.name] }), _jsx(DraftWarning, { hasDraft: item.hasPendingDraftChanges })] }), _jsx(BreakingBadge, { item: item })] }, i))), _jsx(Text, { children: " " })] })), totalTokens > 0 && (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { bold: true, children: [" Design Tokens (", totalTokens, " total)"] }), _jsxs(Text, { color: "green", children: [" \u2746 ", tokens.new.length, " to create"] }), _jsxs(Text, { color: "yellow", children: [" ~ ", tokens.changed.length, " to update"] }), _jsxs(Text, { color: "red", children: [" \u2717 ", tokens.removed.length, " to remove"] }), _jsxs(Text, { dimColor: true, children: [" \u00B7 ", tokens.unchanged.length, " unchanged"] }), tokens.changed
|
|
21
21
|
.filter((t) => t.hasPendingDraftChanges)
|
|
22
22
|
.map((item, i) => (_jsxs(Box, { flexDirection: "row", children: [_jsxs(Text, { color: "yellow", children: [" ~ ", item.current.name] }), _jsx(DraftWarning, { hasDraft: true })] }, i))), _jsx(Text, { children: " " })] })), _jsx(Text, { dimColor: true, children: " Press Q to exit." })] }));
|
|
23
23
|
}
|
|
@@ -942,7 +942,7 @@ export function WizardApp({ initialSpaceId = '', initialEnvironmentId = 'master'
|
|
|
942
942
|
});
|
|
943
943
|
}
|
|
944
944
|
};
|
|
945
|
-
const runPush = async (manifest, spaceId, environmentId, cmaToken, host, acknowledgeBreakingChanges,
|
|
945
|
+
const runPush = async (manifest, spaceId, environmentId, cmaToken, host, acknowledgeBreakingChanges, preview) => {
|
|
946
946
|
if (shouldRefusePush(state)) {
|
|
947
947
|
update(buildSkippedPushTransition());
|
|
948
948
|
return;
|
|
@@ -1601,8 +1601,8 @@ export function WizardApp({ initialSpaceId = '', initialEnvironmentId = 'master'
|
|
|
1601
1601
|
// present-but-empty (only $schema), so editing would dead-end on the
|
|
1602
1602
|
// "No generated definitions found" screen.
|
|
1603
1603
|
const editableComponentCount = Object.keys(state.manifest?.componentsManifest ?? {}).filter((k) => k !== '$schema').length;
|
|
1604
|
-
return (_jsx(WizardPreviewStep, { preview: state.serverPreview, spaceId: state.spaceId, environmentId: state.environmentId, stepNumber: totalSteps, totalSteps: totalSteps,
|
|
1605
|
-
void runPush(state.manifest, state.spaceId, state.environmentId, state.cmaToken, state.host, acknowledge,
|
|
1604
|
+
return (_jsx(WizardPreviewStep, { preview: state.serverPreview, spaceId: state.spaceId, environmentId: state.environmentId, stepNumber: totalSteps, totalSteps: totalSteps, onConfirm: (acknowledge) => {
|
|
1605
|
+
void runPush(state.manifest, state.spaceId, state.environmentId, state.cmaToken, state.host, acknowledge, state.serverPreview);
|
|
1606
1606
|
}, ...(editableComponentCount > 0 ? { onEdit: () => void runEditFromPreview() } : {}), onSaveFiles: () => {
|
|
1607
1607
|
void startSaveFlow();
|
|
1608
1608
|
}, onQuit: () => process.exit(0) }));
|
|
@@ -12,11 +12,10 @@ type WizardPreviewStepProps = {
|
|
|
12
12
|
environmentId: string;
|
|
13
13
|
stepNumber: number;
|
|
14
14
|
totalSteps: number;
|
|
15
|
-
|
|
16
|
-
onConfirm: (acknowledge: boolean, allowDeletions: boolean) => void;
|
|
15
|
+
onConfirm: (acknowledge: boolean) => void;
|
|
17
16
|
onEdit?: () => void;
|
|
18
17
|
onSaveFiles?: () => void;
|
|
19
18
|
onQuit: () => void;
|
|
20
19
|
};
|
|
21
|
-
export declare function WizardPreviewStep({ preview, spaceId, environmentId, stepNumber, totalSteps,
|
|
20
|
+
export declare function WizardPreviewStep({ preview, spaceId, environmentId, stepNumber, totalSteps, onConfirm, onEdit, onSaveFiles, onQuit, }: WizardPreviewStepProps): React.ReactElement;
|
|
22
21
|
export {};
|
|
@@ -89,11 +89,10 @@ export function buildPreviewDiffLines(preview) {
|
|
|
89
89
|
}
|
|
90
90
|
return lines;
|
|
91
91
|
}
|
|
92
|
-
export function WizardPreviewStep({ preview, spaceId, environmentId, stepNumber, totalSteps,
|
|
92
|
+
export function WizardPreviewStep({ preview, spaceId, environmentId, stepNumber, totalSteps, onConfirm, onEdit, onSaveFiles, onQuit, }) {
|
|
93
93
|
const breakingWithImpact = hasBreakingChangesWithImpact(preview);
|
|
94
94
|
const [diffExpanded, setDiffExpanded] = useState(false);
|
|
95
95
|
const [scrollOffset, setScrollOffset] = useState(0);
|
|
96
|
-
const [allowDeletions, setAllowDeletions] = useState(initialAllowDeletions);
|
|
97
96
|
const { stdout } = useStdout();
|
|
98
97
|
const terminalRows = stdout?.rows ?? 40;
|
|
99
98
|
const viewportHeight = Math.max(terminalRows - 14, 10);
|
|
@@ -106,14 +105,9 @@ export function WizardPreviewStep({ preview, spaceId, environmentId, stepNumber,
|
|
|
106
105
|
}));
|
|
107
106
|
}, [diffExpanded, preview]);
|
|
108
107
|
const maxScroll = Math.max(0, allDiffLines.length - viewportHeight);
|
|
109
|
-
const removedCount = preview.components.removed.length + preview.tokens.removed.length;
|
|
110
108
|
useImmediateInput((input, key) => {
|
|
111
109
|
if (key.return) {
|
|
112
|
-
onConfirm(breakingWithImpact
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
if ((input === 'x' || input === 'X') && removedCount > 0) {
|
|
116
|
-
setAllowDeletions((prev) => !prev);
|
|
110
|
+
onConfirm(breakingWithImpact);
|
|
117
111
|
return;
|
|
118
112
|
}
|
|
119
113
|
if (input === 'd' || input === 'D') {
|
|
@@ -162,5 +156,5 @@ export function WizardPreviewStep({ preview, spaceId, environmentId, stepNumber,
|
|
|
162
156
|
})] })), components.changed.length > 0 && (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: PALETTE.warning, children: " \uFF5E" }), _jsxs(Text, { children: [components.changed.length, " will be updated"] })] }), components.changed.map((item, i) => {
|
|
163
157
|
const isBreaking = item.changeClassification?.classification === 'breaking';
|
|
164
158
|
return (_jsxs(Text, { color: isBreaking ? PALETTE.error : PALETTE.warning, children: [' ', isBreaking ? '⚠' : '~', " ", item.current.name] }, `chg-${i}`));
|
|
165
|
-
})] })), components.removed.length > 0 && (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { gap: 1, children: [_jsx(Text, { color:
|
|
159
|
+
})] })), components.removed.length > 0 && (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: PALETTE.error, children: " \u2717" }), _jsxs(Text, { children: [components.removed.length, " will be removed"] })] }), components.removed.map((item, i) => (_jsxs(Text, { color: PALETTE.error, children: [' ', "\u2717 ", item.name] }, `rm-${i}`)))] })), components.unchanged.length > 0 && (_jsxs(Box, { gap: 1, children: [_jsx(Text, { dimColor: true, children: " \u00B7" }), _jsxs(Text, { dimColor: true, children: [components.unchanged.length, " unchanged"] })] }))] })), hasTokens && (_jsxs(Box, { flexDirection: "column", gap: 0, children: [_jsx(Box, { gap: 1, marginTop: 1, children: _jsx(Text, { bold: true, dimColor: true, children: "Design Tokens" }) }), tokens.new.length > 0 && (_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: PALETTE.success, children: " \uFF0B" }), _jsxs(Text, { children: [tokens.new.length, " will be created"] })] })), tokens.changed.length > 0 && (_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: PALETTE.warning, children: " \uFF5E" }), _jsxs(Text, { children: [tokens.changed.length, " will be updated"] })] })), tokens.removed.length > 0 && (_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: PALETTE.error, children: " \u2717" }), _jsxs(Text, { children: [tokens.removed.length, " will be removed"] })] })), tokens.unchanged.length > 0 && (_jsxs(Box, { gap: 1, children: [_jsx(Text, { dimColor: true, children: " \u00B7" }), _jsxs(Text, { dimColor: true, children: [tokens.unchanged.length, " unchanged"] })] }))] })), diffExpanded && allDiffLines.length > 0 && (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Text, { dimColor: true, children: '─'.repeat(40) }), _jsxs(Text, { dimColor: true, children: [' ', "Diff (", allDiffLines.length, " lines) \u2014 line ", scrollOffset + 1, "\u2013", Math.min(scrollOffset + viewportHeight, allDiffLines.length), " of ", allDiffLines.length] }), _jsx(Box, { flexDirection: "column", children: allDiffLines.slice(scrollOffset, scrollOffset + viewportHeight).map((line) => (_jsx(Box, { children: line.element }, line.key))) }), maxScroll > 0 && _jsx(Text, { dimColor: true, children: " \u2195 j/k to scroll, f/b to page" })] }))] })) : (_jsx(Text, { dimColor: true, children: "Nothing to push \u2014 everything is already up to date." })), _jsxs(Box, { gap: 1, marginTop: 1, children: [_jsx(Text, { dimColor: true, children: "Space:" }), _jsx(Text, { children: spaceId }), _jsx(Text, { dimColor: true, children: "/" }), _jsx(Text, { dimColor: true, children: "Environment:" }), _jsx(Text, { children: environmentId })] }), breakingWithImpact && (_jsx(Box, { marginTop: 1, children: _jsx(Text, { color: PALETTE.error, bold: true, children: "\u26A0 Breaking changes will affect downstream entities. Press Enter to acknowledge and apply." }) })), _jsxs(Box, { gap: 3, marginTop: 1, children: [_jsx(Text, { dimColor: true, children: "[Enter] Push to Contentful" }), _jsxs(Text, { dimColor: true, children: ["[d] ", diffExpanded ? 'Hide' : 'Show', " diff"] }), diffExpanded && _jsx(Text, { dimColor: true, children: "[j/k] Scroll [f/b] Page" }), onEdit && _jsx(Text, { dimColor: true, children: "[e] Edit definitions" }), onSaveFiles && _jsx(Text, { dimColor: true, children: "[s] Save files instead" }), _jsx(Text, { dimColor: true, children: "[q] Cancel" })] })] }));
|
|
166
160
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.17.2-dev-build-
|
|
3
|
+
"version": "2.17.2-dev-build-ebba024.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"react": "^18.3.1",
|
|
35
35
|
"react-devtools-core": "^4.19.1",
|
|
36
36
|
"react-dom": "^18.3.1",
|
|
37
|
-
"@contentful/experience-design-system-extraction": "2.17.2-dev-build-
|
|
38
|
-
"@contentful/experience-design-system-types": "2.17.2-dev-build-
|
|
37
|
+
"@contentful/experience-design-system-extraction": "2.17.2-dev-build-ebba024.0",
|
|
38
|
+
"@contentful/experience-design-system-types": "2.17.2-dev-build-ebba024.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@tsconfig/node24": "^24.0.3",
|