Skip to content
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

CS- 44750 - fix: Checking the title for the entry before running the audit command and version bump. #1377

Merged
merged 2 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion packages/contentstack-audit/src/modules/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default class Entries {
protected missingRefs: Record<string, any> = {};
public entryMetaData: Record<string, any>[] = [];
public moduleName: keyof typeof auditConfig.moduleConfig = 'entries';
public isEntryWithoutTitleField: boolean = false;

constructor({ log, fix, config, moduleName, ctSchema, gfSchema }: ModuleConstructorParam & CtConstructorParam) {
this.log = log;
Expand Down Expand Up @@ -105,7 +106,6 @@ export default class Entries {
if (this.fix) {
this.removeMissingKeysOnEntry(ctSchema.schema as ContentTypeSchemaType[], this.entries[entryUid]);
}

this.lookForReference([{ locale: code, uid, name: title }], ctSchema, this.entries[entryUid]);
const message = $t(auditMsg.SCAN_ENTRY_SUCCESS_MSG, {
title,
Expand Down Expand Up @@ -981,10 +981,20 @@ export default class Entries {
const entries = (await fsUtility.readChunkFiles.next()) as Record<string, EntryStruct>;
for (const entryUid in entries) {
let { title } = entries[entryUid];
if (!title) {
this.isEntryWithoutTitleField = true;
this.log(
`Entry with UID '${entryUid}' of Content Type '${uid}' in Locale '${code}' does not have a 'title' field.`,
`error`,
);
}
this.entryMetaData.push({ uid: entryUid, title });
}
}
}
}
if (this.isEntryWithoutTitleField) {
throw Error(`Entries found with missing 'title' field! Please make the data corrections and re-run the audit.`);
}
}
}
2 changes: 1 addition & 1 deletion packages/contentstack-import/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-audit": "~1.5.3",
"@contentstack/cli-audit": "~1.5.4",
"@contentstack/cli-command": "~1.2.16",
"@contentstack/cli-utilities": "~1.6.0",
"@contentstack/management": "~1.15.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"prepack": "pnpm compile && oclif manifest && oclif readme"
},
"dependencies": {
"@contentstack/cli-audit": "~1.5.3",
"@contentstack/cli-audit": "~1.5.4",
"@contentstack/cli-auth": "~1.3.17",
"@contentstack/cli-cm-bootstrap": "~1.9.0",
"@contentstack/cli-cm-branches": "~1.0.24",
Expand Down
4 changes: 2 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading