Skip to content

Commit 523f776

Browse files
Merge branch 'development' into feat/dx-2394
2 parents b0817ad + 6cc676e commit 523f776

File tree

26 files changed

+1206
-1114
lines changed

26 files changed

+1206
-1114
lines changed

.github/workflows/release.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,16 @@ jobs:
1515
- uses: actions/setup-node@v4
1616
with:
1717
node-version: '22.x'
18-
cache: 'pnpm'
18+
19+
- name: Enable Corepack
20+
run: corepack enable
21+
22+
- name: Install pnpm
23+
run: corepack prepare pnpm@7 --activate
24+
25+
- name: Install root dependencies
26+
run: pnpm install
27+
1928
- name: Reading Configuration
2029
id: release_config
2130
uses: rgarcia-phi/json-to-variables@v1.1.0

.github/workflows/unit-test.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ jobs:
2727
- name: Run tests for Contentstack Config
2828
working-directory: ./packages/contentstack-config
2929
run: npm run test
30+
31+
- name: Run tests for Contentstack Migrate RTE
32+
working-directory: ./packages/contentstack-migrate-rte
33+
run: npm run test
34+
35+
- name: Run tests for Contentstack Migration
36+
working-directory: ./packages/contentstack-migration
37+
run: npm run test
3038
# - name: Fetch latest references
3139
# run: |
3240
# git fetch --prune

package-lock.json

Lines changed: 339 additions & 308 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/contentstack-audit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentstack/cli-audit",
3-
"version": "1.12.0",
3+
"version": "1.12.1",
44
"description": "Contentstack audit plugin",
55
"author": "Contentstack CLI",
66
"homepage": "https://github.com/contentstack/cli",

packages/contentstack-audit/src/config/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const config = {
1313
'field-rules',
1414
],
1515
'fix-fields': ['reference', 'global_field', 'json:rte', 'json:extension', 'blocks', 'group', 'content_types'],
16+
'schema-fields-data-type': ['blocks','group','global_field'],
1617
moduleConfig: {
1718
'content-types': {
1819
name: 'content type',

packages/contentstack-audit/src/modules/content-types.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ export default class ContentType {
185185
field.schema = this.runFixOnSchema(tree, field.schema as ContentTypeSchemaType[]);
186186
}
187187
for (let child of field.schema ?? []) {
188-
189188
if (!fixTypes.includes(child.data_type) && child.data_type !== 'json') continue;
190189

191190
switch (child.data_type) {
@@ -487,8 +486,13 @@ export default class ContentType {
487486
})
488487
.filter((val: any) => {
489488
if (this.config.skipFieldTypes.includes(val?.data_type)) return true;
490-
if (val?.schema && isEmpty(val?.schema)) return false;
491-
if (val?.reference_to && isEmpty(val?.reference_to)) return false;
489+
if (
490+
val?.schema &&
491+
isEmpty(val?.schema) &&
492+
(!val?.data_type || this.config['schema-fields-data-type'].includes(val.data_type))
493+
)
494+
return false;
495+
if (val?.reference_to && isEmpty(val?.reference_to) && val.data_type === 'reference') return false;
492496

493497
return !!val;
494498
}) as ContentTypeSchemaType[];

packages/contentstack-branches/src/branch/merge-handler.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import os from 'os';
22
import path from 'path';
33
import forEach from 'lodash/forEach';
44
import { cliux } from '@contentstack/cli-utilities';
5+
import chalk from 'chalk';
56
import { MergeInputOptions, MergeSummary } from '../interfaces';
67
import {
78
selectMergeStrategy,
@@ -107,6 +108,10 @@ export default class MergeHandler {
107108
deleted: [],
108109
};
109110
const selectedItems = await selectCustomPreferences(module, this.branchCompareData[module]);
111+
if (!selectedItems.length) {
112+
cliux.print(chalk.red('No items were selected'));
113+
process.exit(1);
114+
}
110115
forEach(selectedItems, (item) => {
111116
this.mergeSettings.mergeContent[module][item.status].push(item.value);
112117
this.mergeSettings.itemMergeStrategies.push(item.value);
@@ -132,8 +137,11 @@ export default class MergeHandler {
132137
} else if (this.strategy === 'overwrite_with_compare') {
133138
this.mergeSettings.strategy = 'overwrite_with_compare';
134139
}
135-
136-
await this.displayMergeSummary();
140+
if (this.checkEmptySelection()) {
141+
cliux.print(chalk.red('No items selected'));
142+
} else {
143+
await this.displayMergeSummary();
144+
}
137145

138146
if (!this.executeOption) {
139147
const executionResponse = await selectMergeExecution();
@@ -152,6 +160,17 @@ export default class MergeHandler {
152160
}
153161
}
154162

163+
checkEmptySelection() {
164+
for (let module in this.branchCompareData) {
165+
if (this.mergeSettings.mergeContent[module]?.modified?.length
166+
|| this.mergeSettings.mergeContent[module]?.added?.length
167+
|| this.mergeSettings.mergeContent[module]?.deleted?.length) {
168+
return false;
169+
}
170+
}
171+
return true;
172+
}
173+
155174
displayMergeSummary() {
156175
if (this.mergeSettings.strategy !== 'ignore') {
157176
for (let module in this.branchCompareData) {

packages/contentstack-branches/src/interfaces/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface BranchDiffRes {
1313
title: string;
1414
type: string;
1515
status: string;
16+
merge_strategy?: string;
1617
}
1718

1819
export interface BranchDiffSummary {

packages/contentstack-branches/src/utils/branch-diff-utility.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,21 @@ function printCompactTextView(branchTextRes: BranchCompactTextRes): void {
196196
if (branchTextRes.modified?.length || branchTextRes.added?.length || branchTextRes.deleted?.length) {
197197
cliux.print(' ');
198198
forEach(branchTextRes.added, (diff: BranchDiffRes) => {
199-
cliux.print(chalk.green(`+ '${diff.title}' ${startCase(camelCase(diff.type))}`));
199+
if (diff.merge_strategy !== 'ignore') {
200+
cliux.print(chalk.green(`+ '${diff.title}' ${startCase(camelCase(diff.type))}`));
201+
}
200202
});
201203

202204
forEach(branchTextRes.modified, (diff: BranchDiffRes) => {
203-
cliux.print(chalk.blue(`± '${diff.title}' ${startCase(camelCase(diff.type))}`));
205+
if (diff.merge_strategy !== 'ignore') {
206+
cliux.print(chalk.blue(`± '${diff.title}' ${startCase(camelCase(diff.type))}`));
207+
}
204208
});
205209

206210
forEach(branchTextRes.deleted, (diff: BranchDiffRes) => {
207-
cliux.print(chalk.red(`- '${diff.title}' ${startCase(camelCase(diff.type))}`));
211+
if (diff.merge_strategy !== 'ignore') {
212+
cliux.print(chalk.red(`- '${diff.title}' ${startCase(camelCase(diff.type))}`));
213+
}
208214
});
209215
}
210216
}

packages/contentstack-clone/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dependencies": {
88
"@colors/colors": "^1.6.0",
99
"@contentstack/cli-cm-export": "~1.16.0",
10-
"@contentstack/cli-cm-import": "~1.21.1",
10+
"@contentstack/cli-cm-import": "~1.21.3",
1111
"@contentstack/cli-command": "~1.5.0",
1212
"@contentstack/cli-utilities": "~1.11.0",
1313
"chalk": "^4.1.2",

0 commit comments

Comments
 (0)