Skip to content

DX | 09-06-2025 | Release #1946

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 60 commits into from
Jun 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
a71bce5
Feature nested global fields (#1771)
sunil-lakshman Feb 18, 2025
fb39bb6
Merge pull request #1773 from contentstack/development
sunil-lakshman Feb 18, 2025
a95078b
Merge branch 'development' into feat/nested-global-fields
sunil-lakshman Mar 19, 2025
f983b3e
Merge branch 'development' into feat/nested-global-fields
sunil-lakshman Mar 20, 2025
f8f0c01
Fix false flagging of global fields
cs-raj Mar 21, 2025
71a7fd0
Merge pull request #1826 from contentstack/fix/DX-2354
cs-raj Mar 27, 2025
7681037
Merge branch 'development' into feat/nested-global-fields
sunil-lakshman Apr 11, 2025
b2afac6
Fixed merge conflits
sunil-lakshman Apr 11, 2025
7320c58
Merge branch 'development' into feat/nested-global-fields
sunil-lakshman Apr 14, 2025
4eaa258
Merge branch 'development' into feat/nested-global-fields
sunil-lakshman May 15, 2025
5aa1c5c
Fixed PR comments
sunil-lakshman May 15, 2025
585fe65
[DX-2996], added logs to debug the variant export issue
May 19, 2025
608b3d1
removed consoles from entries file
May 21, 2025
c5b3c21
removed some consoles to debug the issue
May 21, 2025
780dc70
added logger to debug the error
May 22, 2025
d22619c
Merge branch 'development' into feat/nested-global-fields
cs-raj May 26, 2025
5473f4c
Lock file update
cs-raj May 26, 2025
b87021b
Handling nested global field in modular blocks
cs-raj May 26, 2025
9bc4fa0
talisman rc update
cs-raj May 26, 2025
f829c08
Fix and Version bump
cs-raj May 27, 2025
3ec207a
Fixed Audit check for global fields
cs-raj May 27, 2025
4472cc2
Fix test case
cs-raj May 27, 2025
fa32a33
Merge pull request #1937 from contentstack/fix/DX-3073
cs-raj May 28, 2025
7f61cb4
Merge branch 'development' into feat/nested-global-fields
sunil-lakshman May 28, 2025
cc630cf
Fixed uid issue
sunil-lakshman May 28, 2025
e49ac60
Merge branch 'development' into fix/DX-2996
May 28, 2025
5c9cc69
added console.error for debugging
May 28, 2025
4d319e7
Fixed global field update error
sunil-lakshman May 28, 2025
e784194
Removed console log
sunil-lakshman May 28, 2025
aaab042
Fixed Nested Global Field
cs-raj May 28, 2025
f950ef3
PR fixes
cs-raj May 28, 2025
e4101ae
Merge pull request #1940 from contentstack/fix/nested
cs-raj May 28, 2025
e892e6a
Merge branch 'development' into fix/DX-2996
naman-contentstack May 29, 2025
3ce10fc
Fixed merge conflits
sunil-lakshman May 30, 2025
d714aaf
Merge pull request #1928 from contentstack/fix/DX-2996
naman-contentstack May 30, 2025
e09d991
Fixed NGF update issue in import setup
sunil-lakshman May 30, 2025
8916bdb
Merge branch 'development' into feat/nested-global-fields
sunil-lakshman May 30, 2025
22890c1
fix: Max retry count reached error
aman19K May 30, 2025
ec9f859
Merge pull request #1943 from contentstack/fix/DX-2996-max-retry-error
aman19K May 30, 2025
133d695
Fixed merge conflits
sunil-lakshman May 30, 2025
17fb2cf
Merge pull request #1772 from contentstack/feat/nested-global-fields
sunil-lakshman May 30, 2025
edd15d9
feat: added error handler and logger support in cli
aman19K Jun 2, 2025
96a5282
fix: code & secret scan workflow issue
aman19K Jun 2, 2025
b09ec68
fix & updated test cases
aman19K Jun 2, 2025
67f3924
Merge pull request #1944 from contentstack/feat/DX-3076-cli-logger
aman19K Jun 3, 2025
df2497d
fix: message error code issue
aman19K Jun 3, 2025
a5b1226
Merge pull request #1945 from contentstack/fix/cli-message-issue
aman19K Jun 3, 2025
51352c1
Fix Developement
cs-raj Jun 4, 2025
6446419
Merge pull request #1947 from contentstack/fix/development
cs-raj Jun 4, 2025
0f2b9e3
Optional Check
cs-raj Jun 6, 2025
da632ff
Fix Comment
cs-raj Jun 6, 2025
40e9120
Fixed the empty title issue
cs-raj Jun 6, 2025
ced2b85
Merge pull request #1949 from contentstack/fix/audit
cs-raj Jun 6, 2025
2a088ca
Merge remote-tracking branch 'origin/staging' into fix/update-staging
harshithad0703 Jun 6, 2025
10670e9
add error log
harshithad0703 Jun 6, 2025
0631c86
Merge branch 'development' into fix/update-staging
harshithad0703 Jun 6, 2025
b2412fa
add error log
harshithad0703 Jun 6, 2025
9c752b1
Merge pull request #1951 from contentstack/fix/update-staging
harshithad0703 Jun 6, 2025
c12f256
update talismanrc
harshithad0703 Jun 6, 2025
36233e1
Merge pull request #1952 from contentstack/fix/talismanrc-3
harshithad0703 Jun 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,21 @@ fileignoreconfig:
- filename: packages/contentstack/package.json
checksum: 9b0fdd100effcdbb5ee3809f7f102bfd11c88dd76e49db5103434f3aa29473dd
- filename: pnpm-lock.yaml
checksum: 579849ef155d487ed7d1a8d30dab6ea906da2d571c725b3b033543a9a609f75c
- filename: packages/contentstack-audit/src/audit-base-command.ts
checksum: bd99d269c0b6694577f4751fa96b3d85856e41bbef624b4ec1196630d6c1d168
- filename: package-lock.json
checksum: c085555b2afd1b5c22e20b3b5217aa009af5b1801e8de120179b50201a948c0a
- filename: packages/contentstack-migrate-rte/test/commands/json-migration.test.js
checksum: 1f5ee5b39119667bd4830f9dbbbf757fb922f4ec3b7f6fad06bbfbf214fe7f73
version: '1.0'
- filename: packages/contentstack-bootstrap/src/bootstrap/utils.ts
checksum: 0b0af505ce1a74eb8df519f106291e319eb3ea74003ca63e03527f59a8821d39
- filename: packages/contentstack-bootstrap/test/bootstrap.test.js
checksum: 5f0355a5048183d61b605cbc160e6727a9de32832d9159e903fee49f9ab751d5
- filename: package-lock.json
checksum: 35c1a3c35a923ddf97a42edc85708a1bee9352710ebe135b6be6a32c95bde908
- filename: packages/contentstack-utilities/test/unit/logger.test.ts
checksum: c773181ea55c49d91363adacf0424b84c927e3cffd6bef1444ec2559ddf1b3b0
- filename: packages/contentstack-utilities/src/logger/cliErrorHandler.ts
checksum: 023cf08f215cd0778599fb8478c94419373d4687f04421c4eb99d87de86a4a3e
- filename: packages/contentstack-utilities/src/logger/logger.ts
checksum: 09f3b73dd995bafc253265c676f06308513e6b1842d9bc01d39e6b6945a54c7d
version: "1.0"
2,619 changes: 1,403 additions & 1,216 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/contentstack-audit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $ npm install -g @contentstack/cli-audit
$ csdx COMMAND
running command...
$ csdx (--version|-v)
@contentstack/cli-audit/1.12.1 darwin-arm64 node-v22.14.0
@contentstack/cli-audit/1.12.2 darwin-arm64 node-v22.14.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
14 changes: 7 additions & 7 deletions packages/contentstack-audit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentstack/cli-audit",
"version": "1.12.1",
"version": "1.13.0",
"description": "Contentstack audit plugin",
"author": "Contentstack CLI",
"homepage": "https://github.com/contentstack/cli",
Expand All @@ -19,8 +19,8 @@
],
"dependencies": {
"@contentstack/cli-command": "~1.5.0",
"@oclif/plugin-help": "^6.2.27",
"@contentstack/cli-utilities": "~1.11.1",
"@oclif/plugin-help": "^6.2.28",
"@contentstack/cli-utilities": "~1.12.0",
"@oclif/plugin-plugins": "^5.4.36",
"chalk": "^4.1.2",
"fast-csv": "^4.3.6",
Expand All @@ -30,19 +30,19 @@
"winston": "^3.17.0"
},
"devDependencies": {
"@oclif/test": "^4.1.12",
"@oclif/test": "^4.1.13",
"@types/chai": "^4.3.20",
"@types/fs-extra": "^11.0.4",
"@types/mocha": "^10.0.10",
"@types/node": "^20.17.30",
"@types/node": "^20.17.50",
"@types/uuid": "^9.0.8",
"chai": "^4.5.0",
"eslint": "^8.57.1",
"eslint-config-oclif": "^6.0.42",
"eslint-config-oclif": "^6.0.62",
"eslint-config-oclif-typescript": "^3.1.14",
"mocha": "^10.8.2",
"nyc": "^15.1.0",
"oclif": "^4.17.43",
"oclif": "^4.17.46",
"shx": "^0.4.0",
"sinon": "^19.0.5",
"ts-node": "^10.9.2",
Expand Down
6 changes: 5 additions & 1 deletion packages/contentstack-audit/src/audit-base-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma

break;
case 'field-rules':
// NOTE: We are using the fixed content-type for validation of field rules
const data = this.getCtAndGfSchema();
constructorParam.ctSchema = data.ctSchema;
constructorParam.gfSchema = data.gfSchema;
missingFieldRules = await new FieldRule(cloneDeep(constructorParam)).run();
await this.prepareReport(module, missingFieldRules);
this.getAffectedData('field-rules', dataModuleWise['content-types'], missingFieldRules);
Expand Down Expand Up @@ -456,7 +460,7 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
key === 'missingCTSelectFieldValues' ||
key === 'missingFieldUid' ||
key === 'action' ||
key === 'Non-Fixable' ||
key === 'Non-Fixable' ||
key === 'Not-Fixed'
) {
return chalk.red(typeof cellValue === 'object' ? JSON.stringify(cellValue) : cellValue);
Expand Down
77 changes: 58 additions & 19 deletions packages/contentstack-audit/src/modules/content-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export default class ContentType {
*/
async writeFixContent() {
let canWrite = true;

if (!this.inMemoryFix && this.fix) {
if (!this.config.flags['copy-dir'] && !this.config.flags['external-config']?.skipConfirm) {
canWrite = this.config.flags.yes ?? (await cliux.confirm(commonMsg.FIX_CONFIRMATION));
Expand Down Expand Up @@ -301,18 +301,35 @@ export default class ContentType {
*/
async validateGlobalField(tree: Record<string, unknown>[], field: GlobalFieldDataType): Promise<void> {
// NOTE Any GlobalField related logic can be added here
if (!field.schema && !this.fix) {
this.missingRefs[this.currentUid].push({
tree,
ct_uid: this.currentUid,
name: this.currentTitle,
data_type: field.data_type,
display_name: field.display_name,
missingRefs: 'Empty schema found',
treeStr: tree.map(({ name }) => name).join(' ➜ '),
});
if (this.moduleName === 'global-fields') {
let { reference_to } = field;
const refExist = find(this.schema, { uid: reference_to });
if (!refExist) {
this.missingRefs[this.currentUid].push({
tree,
ct: this.currentUid,
name: this.currentTitle,
data_type: field.data_type,
display_name: field.display_name,
missingRefs: 'Referred Global Field Does not Exist',
treeStr: tree.map(({ name }) => name).join(' ➜ '),
});
return void 0;
}
} else if (this.moduleName === 'content-types') {
if (!field.schema && !this.fix) {
this.missingRefs[this.currentUid].push({
tree,
ct_uid: this.currentUid,
name: this.currentTitle,
data_type: field.data_type,
display_name: field.display_name,
missingRefs: 'Empty schema found',
treeStr: tree.map(({ name }) => name).join(' ➜ '),
});

return void 0;
return void 0;
}
}

await this.lookForReference(tree, field);
Expand Down Expand Up @@ -443,7 +460,7 @@ export default class ContentType {
runFixOnSchema(tree: Record<string, unknown>[], schema: ContentTypeSchemaType[]) {
// NOTE Global field Fix
return schema
.map((field) => {
?.map((field) => {
const { data_type } = field;
const fixTypes = this.config.flags['fix-only'] ?? this.config['fix-fields'];

Expand Down Expand Up @@ -524,12 +541,11 @@ export default class ContentType {
missingRefs: [reference_to],
treeStr: tree.map(({ name }) => name).join(' ➜ '),
});
} else if (!field.schema) {
} else if (!field.schema && this.moduleName === 'content-types') {
const gfSchema = find(this.gfSchema, { uid: field.reference_to })?.schema;

if (gfSchema) {
field.schema = gfSchema as GlobalFieldSchemaTypes[];

} else {
this.missingRefs[this.currentUid].push({
tree,
data_type,
Expand All @@ -541,8 +557,27 @@ export default class ContentType {
treeStr: tree.map(({ name }) => name).join(' ➜ '),
});
}
} else if (!field.schema && this.moduleName === 'global-fields') {
const gfSchema = find(this.gfSchema, { uid: field.reference_to })?.schema;
if (gfSchema) {
field.schema = gfSchema as GlobalFieldSchemaTypes[];
} else {
this.missingRefs[this.currentUid].push({
tree,
data_type,
display_name,
fixStatus: 'Fixed',
ct_uid: this.currentUid,
name: this.currentTitle,
missingRefs: 'Referred Global Field Does not exist',
treeStr: tree.map(({ name }) => name).join(' ➜ '),
});
}
}

if(field.schema && !isEmpty(field.schema)){
field.schema = this.runFixOnSchema(tree, field.schema as ContentTypeSchemaType[]);
}
return refExist ? field : null;
}

Expand All @@ -559,7 +594,7 @@ export default class ContentType {
*/
fixModularBlocksReferences(tree: Record<string, unknown>[], blocks: ModularBlockType[]) {
return blocks
.map((block) => {
?.map((block) => {
const { reference_to, schema, title: display_name } = block;
tree = [...tree, { uid: block.uid, name: block.title }];
const refErrorObj = {
Expand All @@ -572,7 +607,7 @@ export default class ContentType {
treeStr: tree.map(({ name }) => name).join(' ➜ '),
};

if (!schema) {
if (!schema && this.moduleName === 'content-types') {
this.missingRefs[this.currentUid].push(refErrorObj);

return false;
Expand All @@ -581,7 +616,11 @@ export default class ContentType {
// NOTE Global field section
if (reference_to) {
const refExist = find(this.gfSchema, { uid: reference_to });
if (!refExist) {
this.missingRefs[this.currentUid].push(refErrorObj);

return false;
}
if (!refExist) {
this.missingRefs[this.currentUid].push(refErrorObj);

Expand All @@ -591,7 +630,7 @@ export default class ContentType {

block.schema = this.runFixOnSchema(tree, block.schema as ContentTypeSchemaType[]);

if (isEmpty(block.schema)) {
if (isEmpty(block.schema) && this.moduleName === 'content-types') {
this.missingRefs[this.currentUid].push({
...refErrorObj,
missingRefs: 'Empty schema found',
Expand Down
28 changes: 17 additions & 11 deletions packages/contentstack-audit/src/modules/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ export default class Entries {
const { uid, title } = entry;
this.currentUid = uid;
this.currentTitle = title;
this.currentTitle = this.removeEmojiAndImages(this.currentTitle)
if (this.currentTitle) {
this.currentTitle = this.removeEmojiAndImages(this.currentTitle);
}

if (!this.missingRefs[this.currentUid]) {
this.missingRefs[this.currentUid] = [];
Expand All @@ -133,7 +135,11 @@ export default class Entries {
this.removeMissingKeysOnEntry(ctSchema.schema as ContentTypeSchemaType[], this.entries[entryUid]);
}

this.lookForReference([{ locale: code, uid, name: this.removeEmojiAndImages(title) }], ctSchema, this.entries[entryUid]);
this.lookForReference(
[{ locale: code, uid, name: this.removeEmojiAndImages(this.currentTitle) }],
ctSchema,
this.entries[entryUid],
);

if (this.missingRefs[this.currentUid]?.length) {
this.missingRefs[this.currentUid].forEach((entry: any) => {
Expand Down Expand Up @@ -242,7 +248,7 @@ export default class Entries {
missingMandatoryFields: this.missingMandatoryFields,
missingTitleFields: this.missingTitleFields,
missingEnvLocale: this.missingEnvLocale,
missingMultipleFields: this.missingMultipleField
missingMultipleFields: this.missingMultipleField,
};
}

Expand Down Expand Up @@ -354,11 +360,11 @@ export default class Entries {
for (const child of field?.schema ?? []) {
const { uid, multiple, data_type } = child;

if(multiple && entry[uid] && !Array.isArray(entry[uid])) {
if (!this.missingMultipleField[this.currentUid]) {
this.missingMultipleField[this.currentUid] = [];
}
if (multiple && entry[uid] && !Array.isArray(entry[uid])) {
if (!this.missingMultipleField[this.currentUid]) {
this.missingMultipleField[this.currentUid] = [];
}

this.missingMultipleField[this.currentUid].push({
uid: this.currentUid,
name: this.currentTitle,
Expand All @@ -371,7 +377,7 @@ export default class Entries {
.filter((val) => val)
.join(' ➜ '),
});
}
}
this.missingMandatoryFields[this.currentUid].push(
...this.validateMandatoryFields(
[...tree, { uid: field.uid, name: child.display_name, field: uid }],
Expand Down Expand Up @@ -758,7 +764,7 @@ export default class Entries {
.map(({ name }) => name)
.filter(Boolean)
.join(' ➜ '),
'fixStatus': 'Fixed',
fixStatus: 'Fixed',
});

entry[uid] = [entry[uid]];
Expand Down Expand Up @@ -842,7 +848,7 @@ export default class Entries {
* Else empty array
*/
removeEmojiAndImages(str: string) {
return str.replace(
return str?.replace(
/[\p{Emoji}\p{Emoji_Presentation}\p{Emoji_Modifier}\p{Emoji_Modifier_Base}\p{Emoji_Component}]+/gu,
'',
);
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-audit/src/modules/field_rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default class FieldRule {
}

this.schema = this.moduleName === 'content-types' ? this.ctSchema : this.gfSchema;

await this.prerequisiteData();
await this.prepareEntryMetaData();
for (const schema of this.schema ?? []) {
Expand Down
Loading
Loading