@@ -5,7 +5,7 @@ import { v4 as uuid } from 'uuid';
55import isEmpty from 'lodash/isEmpty' ;
66import { join , resolve } from 'path' ;
77import cloneDeep from 'lodash/cloneDeep' ;
8- import { cliux , sanitizePath , TableFlags , TableHeader , log , configHandler , CLIProgressManager , clearProgressModuleSetting } from '@contentstack/cli-utilities' ;
8+ import { cliux , sanitizePath , TableFlags , TableHeader , log , configHandler , CLIProgressManager , clearProgressModuleSetting , readContentTypeSchemas } from '@contentstack/cli-utilities' ;
99import { createWriteStream , existsSync , mkdirSync , readFileSync , writeFileSync , rmSync } from 'fs' ;
1010import config from './config' ;
1111import { print } from './util/log' ;
@@ -480,10 +480,9 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
480480 * `gfSchema`. The values of these properties are the parsed JSON data from two different files.
481481 */
482482 getCtAndGfSchema ( ) {
483- const ctPath = join (
483+ const ctDirPath = join (
484484 this . sharedConfig . basePath ,
485485 this . sharedConfig . moduleConfig [ 'content-types' ] . dirName ,
486- this . sharedConfig . moduleConfig [ 'content-types' ] . fileName ,
487486 ) ;
488487 const gfPath = join (
489488 this . sharedConfig . basePath ,
@@ -492,7 +491,7 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
492491 ) ;
493492
494493 const gfSchema = existsSync ( gfPath ) ? ( JSON . parse ( readFileSync ( gfPath , 'utf8' ) ) as ContentTypeStruct [ ] ) : [ ] ;
495- const ctSchema = existsSync ( ctPath ) ? ( JSON . parse ( readFileSync ( ctPath , 'utf8' ) ) as ContentTypeStruct [ ] ) : [ ] ;
494+ const ctSchema = ( readContentTypeSchemas ( ctDirPath ) || [ ] ) as ContentTypeStruct [ ] ;
496495
497496 return { ctSchema, gfSchema } ;
498497 }
0 commit comments