Skip to content

Commit 2f99ed9

Browse files
authored
Merge pull request #1377 from contentstack/bugfix/CS-44750
CS- 44750 - fix: Checking the title for the entry before running the audit command and version bump.
2 parents 9fabb6d + 7296c84 commit 2f99ed9

5 files changed

Lines changed: 18 additions & 8 deletions

File tree

package-lock.json

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

packages/contentstack-audit/src/modules/entries.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export default class Entries {
5555
protected missingRefs: Record<string, any> = {};
5656
public entryMetaData: Record<string, any>[] = [];
5757
public moduleName: keyof typeof auditConfig.moduleConfig = 'entries';
58+
public isEntryWithoutTitleField: boolean = false;
5859

5960
constructor({ log, fix, config, moduleName, ctSchema, gfSchema }: ModuleConstructorParam & CtConstructorParam) {
6061
this.log = log;
@@ -105,7 +106,6 @@ export default class Entries {
105106
if (this.fix) {
106107
this.removeMissingKeysOnEntry(ctSchema.schema as ContentTypeSchemaType[], this.entries[entryUid]);
107108
}
108-
109109
this.lookForReference([{ locale: code, uid, name: title }], ctSchema, this.entries[entryUid]);
110110
const message = $t(auditMsg.SCAN_ENTRY_SUCCESS_MSG, {
111111
title,
@@ -981,10 +981,20 @@ export default class Entries {
981981
const entries = (await fsUtility.readChunkFiles.next()) as Record<string, EntryStruct>;
982982
for (const entryUid in entries) {
983983
let { title } = entries[entryUid];
984+
if (!title) {
985+
this.isEntryWithoutTitleField = true;
986+
this.log(
987+
`Entry with UID '${entryUid}' of Content Type '${uid}' in Locale '${code}' does not have a 'title' field.`,
988+
`error`,
989+
);
990+
}
984991
this.entryMetaData.push({ uid: entryUid, title });
985992
}
986993
}
987994
}
988995
}
996+
if (this.isEntryWithoutTitleField) {
997+
throw Error(`Entries found with missing 'title' field! Please make the data corrections and re-run the audit.`);
998+
}
989999
}
9901000
}

packages/contentstack-import/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"author": "Contentstack",
66
"bugs": "https://github.com/contentstack/cli/issues",
77
"dependencies": {
8-
"@contentstack/cli-audit": "~1.5.3",
8+
"@contentstack/cli-audit": "~1.5.4",
99
"@contentstack/cli-command": "~1.2.16",
1010
"@contentstack/cli-utilities": "~1.6.0",
1111
"@contentstack/management": "~1.15.3",

packages/contentstack/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"prepack": "pnpm compile && oclif manifest && oclif readme"
2323
},
2424
"dependencies": {
25-
"@contentstack/cli-audit": "~1.5.3",
25+
"@contentstack/cli-audit": "~1.5.4",
2626
"@contentstack/cli-auth": "~1.3.17",
2727
"@contentstack/cli-cm-bootstrap": "~1.9.0",
2828
"@contentstack/cli-cm-branches": "~1.0.24",

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)