Skip to content

Commit 626e051

Browse files
authored
Merge pull request #2399 from contentstack/revert-2398-revert-2375-DX-3819
"udpated schema json to indvidual content type files"
2 parents 5e5f3fa + d314ab4 commit 626e051

36 files changed

Lines changed: 6928 additions & 3045 deletions

File tree

.talismanrc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
fileignoreconfig:
22
- filename: pnpm-lock.yaml
3-
checksum: 0d38bb12f29f0e69d78484a321bd17ca1ef0528f9e6294aac47fde45ab213a0b
3+
checksum: 160c630237c8460589759ddf1a86c3e932b18986c9bbbd96ff69d3bf3f61eb3c
44
- filename: package-lock.json
5-
checksum: 3f5620c23bcc7df713fcf017382e8ccbf102d06387898ae1f328594f09924fbf
5+
checksum: a230db8eb9df6f77e249d47c14b54ac18f4b971c25358d2e0a17e22eb1bd1b48
66
- filename: packages/contentstack-audit/src/modules/entries.ts
77
checksum: 8ad10d72522433bc5ce66079248aa2dabae1758ee63335024efd8526d76dd885
8+
- filename: packages/contentstack-config/src/utils/region-handler.ts
9+
checksum: 7fb77272b01e48e0cde7a0b25d18a6a237bd59a8e2156aed8a8de5acd27f2465
810
version: '1.0'

package-lock.json

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

packages/contentstack-audit/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $ npm install -g @contentstack/cli-audit
1919
$ csdx COMMAND
2020
running command...
2121
$ csdx (--version|-v)
22-
@contentstack/cli-audit/2.0.0-beta.3 darwin-arm64 node-v24.12.0
22+
@contentstack/cli-audit/2.0.0-beta.3 darwin-arm64 node-v22.13.1
2323
$ csdx --help [COMMAND]
2424
USAGE
2525
$ csdx COMMAND

packages/contentstack-audit/src/audit-base-command.ts

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,17 @@ import { v4 as uuid } from 'uuid';
55
import isEmpty from 'lodash/isEmpty';
66
import { join, resolve } from 'path';
77
import cloneDeep from 'lodash/cloneDeep';
8-
import { cliux, sanitizePath, TableFlags, TableHeader, log, configHandler, CLIProgressManager, clearProgressModuleSetting } from '@contentstack/cli-utilities';
8+
import {
9+
cliux,
10+
sanitizePath,
11+
TableFlags,
12+
TableHeader,
13+
log,
14+
configHandler,
15+
CLIProgressManager,
16+
clearProgressModuleSetting,
17+
readContentTypeSchemas,
18+
} from '@contentstack/cli-utilities';
919
import { createWriteStream, existsSync, mkdirSync, readFileSync, writeFileSync, rmSync } from 'fs';
1020
import config from './config';
1121
import { print } from './util/log';
@@ -59,7 +69,7 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
5969
*/
6070
async start(command: CommandNames): Promise<boolean> {
6171
this.currentCommand = command;
62-
72+
6373
// Set progress supported module and console logs setting BEFORE any log calls
6474
// This ensures the logger respects the setting when it's initialized
6575
const logConfig = configHandler.get('log') || {};
@@ -68,10 +78,10 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
6878
configHandler.set('log.showConsoleLogs', false);
6979
}
7080
configHandler.set('log.progressSupportedModule', 'audit');
71-
81+
7282
// Initialize global summary for progress tracking
7383
CLIProgressManager.initializeGlobalSummary('AUDIT', '', 'Auditing content...');
74-
84+
7585
await this.promptQueue();
7686
await this.createBackUp();
7787
this.sharedConfig.reportPath = resolve(this.flags['report-path'] || process.cwd(), 'audit-report');
@@ -166,7 +176,7 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
166176

167177
// Print comprehensive summary at the end
168178
CLIProgressManager.printGlobalSummary();
169-
179+
170180
// Clear progress module setting now that audit is complete
171181
clearProgressModuleSetting();
172182

@@ -234,11 +244,11 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
234244

235245
let dataModuleWise: Record<string, any> = await new ModuleDataReader(cloneDeep(constructorParam)).run();
236246
log.debug(`Data module wise: ${JSON.stringify(dataModuleWise)}`, this.auditContext);
237-
247+
238248
// Extract logConfig and showConsoleLogs once before the loop to reuse throughout
239249
const logConfig = configHandler.get('log') || {};
240250
const showConsoleLogs = logConfig.showConsoleLogs ?? false;
241-
251+
242252
for (const module of this.sharedConfig.flags.modules || this.sharedConfig.modules) {
243253
// Update audit context with current module
244254
this.auditContext = { module: module };
@@ -480,19 +490,15 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
480490
* `gfSchema`. The values of these properties are the parsed JSON data from two different files.
481491
*/
482492
getCtAndGfSchema() {
483-
const ctPath = join(
484-
this.sharedConfig.basePath,
485-
this.sharedConfig.moduleConfig['content-types'].dirName,
486-
this.sharedConfig.moduleConfig['content-types'].fileName,
487-
);
493+
const ctDirPath = join(this.sharedConfig.basePath, this.sharedConfig.moduleConfig['content-types'].dirName);
488494
const gfPath = join(
489495
this.sharedConfig.basePath,
490496
this.sharedConfig.moduleConfig['global-fields'].dirName,
491497
this.sharedConfig.moduleConfig['global-fields'].fileName,
492498
);
493499

494500
const gfSchema = existsSync(gfPath) ? (JSON.parse(readFileSync(gfPath, 'utf8')) as ContentTypeStruct[]) : [];
495-
const ctSchema = existsSync(ctPath) ? (JSON.parse(readFileSync(ctPath, 'utf8')) as ContentTypeStruct[]) : [];
501+
const ctSchema = (readContentTypeSchemas(ctDirPath) || []) as ContentTypeStruct[];
496502

497503
return { ctSchema, gfSchema };
498504
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const config = {
1818
moduleConfig: {
1919
'content-types': {
2020
name: 'content type',
21-
fileName: 'schema.json',
21+
fileName: 'schema.json', // Not used - reads from individual files
2222
dirName: 'content_types',
2323
},
2424
'global-fields': {

0 commit comments

Comments
 (0)