Skip to content

Commit 22c0a0c

Browse files
committed
fixed audit plugin
1 parent d7b9b6e commit 22c0a0c

File tree

8 files changed

+1474
-932
lines changed

8 files changed

+1474
-932
lines changed

.talismanrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ fileignoreconfig:
44
- filename: pnpm-lock.yaml
55
checksum: 113f9187b27a5c8fe0bb5b923e045cc129ef663b7d87b0aa1ba610c0e4429ffa
66
- filename: package-lock.json
7-
checksum: 099edd9ec7ed92eb61ce916511ac87e2fc1ff985efe64a25749ac88ba0d3fa7d
7+
checksum: 10cb21a8bedd57057e49843160f9e44768bce6d6642a177c581d401b483b0ec7
88
- filename: packages/contentstack-bootstrap/src/bootstrap/utils.ts
99
checksum: 5ab20e057fa9c4c300f7a882d30e1c68bbc91ed19de520488107e8c37239682a
1010
- filename: packages/contentstack-migration/README.md
@@ -13,4 +13,6 @@ fileignoreconfig:
1313
checksum: f4f44b6031d2936ec2da98b39bb5f5c1bd0f3be34dbe498c75e64a35b7d25a33
1414
- filename: packages/contentstack/README.md
1515
checksum: 3a0fab964797476a71d2149ce261d265f410bd756eb9cde9400be9e5250fdc35
16+
- filename: packages/contentstack-audit/src/modules/entries.ts
17+
checksum: 39992b33a18b2c94e050957255997ed3972d60937719452ef7f68cdcb5c3edf7
1618
version: '1.0'

package-lock.json

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

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

Lines changed: 18 additions & 11 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, readContentTypeSchemas } 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,10 +490,7 @@ 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 ctDirPath = join(
484-
this.sharedConfig.basePath,
485-
this.sharedConfig.moduleConfig['content-types'].dirName,
486-
);
493+
const ctDirPath = join(this.sharedConfig.basePath, this.sharedConfig.moduleConfig['content-types'].dirName);
487494
const gfPath = join(
488495
this.sharedConfig.basePath,
489496
this.sharedConfig.moduleConfig['global-fields'].dirName,

0 commit comments

Comments
 (0)