Skip to content
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: 4 additions & 2 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
fileignoreconfig:
- filename: pnpm-lock.yaml
checksum: 0d38bb12f29f0e69d78484a321bd17ca1ef0528f9e6294aac47fde45ab213a0b
checksum: 160c630237c8460589759ddf1a86c3e932b18986c9bbbd96ff69d3bf3f61eb3c
- filename: package-lock.json
checksum: 3f5620c23bcc7df713fcf017382e8ccbf102d06387898ae1f328594f09924fbf
checksum: a230db8eb9df6f77e249d47c14b54ac18f4b971c25358d2e0a17e22eb1bd1b48
- filename: packages/contentstack-audit/src/modules/entries.ts
checksum: 8ad10d72522433bc5ce66079248aa2dabae1758ee63335024efd8526d76dd885
- filename: packages/contentstack-config/src/utils/region-handler.ts
checksum: 7fb77272b01e48e0cde7a0b25d18a6a237bd59a8e2156aed8a8de5acd27f2465
version: '1.0'
20 changes: 16 additions & 4 deletions package-lock.json

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

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/2.0.0-beta.3 darwin-arm64 node-v24.12.0
@contentstack/cli-audit/2.0.0-beta.3 darwin-arm64 node-v22.13.1
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
32 changes: 19 additions & 13 deletions packages/contentstack-audit/src/audit-base-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ import { v4 as uuid } from 'uuid';
import isEmpty from 'lodash/isEmpty';
import { join, resolve } from 'path';
import cloneDeep from 'lodash/cloneDeep';
import { cliux, sanitizePath, TableFlags, TableHeader, log, configHandler, CLIProgressManager, clearProgressModuleSetting } from '@contentstack/cli-utilities';
import {
cliux,
sanitizePath,
TableFlags,
TableHeader,
log,
configHandler,
CLIProgressManager,
clearProgressModuleSetting,
readContentTypeSchemas,
} from '@contentstack/cli-utilities';
import { createWriteStream, existsSync, mkdirSync, readFileSync, writeFileSync, rmSync } from 'fs';
import config from './config';
import { print } from './util/log';
Expand Down Expand Up @@ -59,7 +69,7 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
*/
async start(command: CommandNames): Promise<boolean> {
this.currentCommand = command;

// Set progress supported module and console logs setting BEFORE any log calls
// This ensures the logger respects the setting when it's initialized
const logConfig = configHandler.get('log') || {};
Expand All @@ -68,10 +78,10 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
configHandler.set('log.showConsoleLogs', false);
}
configHandler.set('log.progressSupportedModule', 'audit');

// Initialize global summary for progress tracking
CLIProgressManager.initializeGlobalSummary('AUDIT', '', 'Auditing content...');

await this.promptQueue();
await this.createBackUp();
this.sharedConfig.reportPath = resolve(this.flags['report-path'] || process.cwd(), 'audit-report');
Expand Down Expand Up @@ -166,7 +176,7 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma

// Print comprehensive summary at the end
CLIProgressManager.printGlobalSummary();

// Clear progress module setting now that audit is complete
clearProgressModuleSetting();

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

let dataModuleWise: Record<string, any> = await new ModuleDataReader(cloneDeep(constructorParam)).run();
log.debug(`Data module wise: ${JSON.stringify(dataModuleWise)}`, this.auditContext);

// Extract logConfig and showConsoleLogs once before the loop to reuse throughout
const logConfig = configHandler.get('log') || {};
const showConsoleLogs = logConfig.showConsoleLogs ?? false;

for (const module of this.sharedConfig.flags.modules || this.sharedConfig.modules) {
// Update audit context with current module
this.auditContext = { module: module };
Expand Down Expand Up @@ -480,19 +490,15 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
* `gfSchema`. The values of these properties are the parsed JSON data from two different files.
*/
getCtAndGfSchema() {
const ctPath = join(
this.sharedConfig.basePath,
this.sharedConfig.moduleConfig['content-types'].dirName,
this.sharedConfig.moduleConfig['content-types'].fileName,
);
const ctDirPath = join(this.sharedConfig.basePath, this.sharedConfig.moduleConfig['content-types'].dirName);
const gfPath = join(
this.sharedConfig.basePath,
this.sharedConfig.moduleConfig['global-fields'].dirName,
this.sharedConfig.moduleConfig['global-fields'].fileName,
);

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

return { ctSchema, gfSchema };
}
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-audit/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const config = {
moduleConfig: {
'content-types': {
name: 'content type',
fileName: 'schema.json',
fileName: 'schema.json', // Not used - reads from individual files
dirName: 'content_types',
},
'global-fields': {
Expand Down
Loading
Loading