@@ -19,13 +19,15 @@ import {
1919 Workflows ,
2020 Assets ,
2121 FieldRule ,
22- ReadModulesAndGetData ,
22+ ModuleDataReader ,
2323 CustomRoles ,
2424} from './modules' ;
2525
2626import {
2727 CommandNames ,
2828 ContentTypeStruct ,
29+ CtConstructorParam ,
30+ ModuleConstructorParam ,
2931 OutputColumn ,
3032 RefErrorReturnType ,
3133 WorkflowExtensionsRefErrorReturnType ,
@@ -74,7 +76,7 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
7476 missingMultipleFields,
7577 } = await this . scanAndFix ( ) ;
7678
77- if ( this . flags [ 'show-console-output' ] || this . flags [ 's' ] ) {
79+ if ( this . flags [ 'show-console-output' ] ) {
7880 this . showOutputOnScreen ( [
7981 { module : 'Content types' , missingRefs : missingCtRefs } ,
8082 { module : 'Global Fields' , missingRefs : missingGfRefs } ,
@@ -103,8 +105,8 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
103105 { module : 'Entries Changed Multiple Fields' , missingRefs : missingMultipleFields } ,
104106 ] ) ;
105107
106- this . showOutputOnScreenWorkflowsAndExtension ( [ { module : 'Summary' , missingRefs : this . summaryDataToPrint } ] ) ;
107108 }
109+ this . showOutputOnScreenWorkflowsAndExtension ( [ { module : 'Summary' , missingRefs : this . summaryDataToPrint } ] ) ;
108110
109111 if (
110112 ! isEmpty ( missingCtRefs ) ||
@@ -174,18 +176,17 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
174176 missingEnvLocalesInAssets ,
175177 missingEnvLocalesInEntries ,
176178 missingFieldRules ,
177- missingMultipleFields ,
178- DataModuleWise : Record < string , any > ;
179+ missingMultipleFields ;
179180
180- const constructorParam : any = {
181+ const constructorParam : ModuleConstructorParam & CtConstructorParam = {
181182 ctSchema,
182183 gfSchema,
183184 log : this . log ,
184185 config : this . sharedConfig ,
185186 fix : this . currentCommand === 'cm:stacks:audit:fix' ,
186187 } ;
187188
188- DataModuleWise = await new ReadModulesAndGetData ( cloneDeep ( constructorParam ) ) . run ( ) ;
189+ let dataModuleWise : Record < string , any > = await new ModuleDataReader ( cloneDeep ( constructorParam ) ) . run ( ) ;
189190 for ( const module of this . sharedConfig . flags . modules || this . sharedConfig . modules ) {
190191 print ( [
191192 {
@@ -201,17 +202,17 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
201202 case 'assets' :
202203 missingEnvLocalesInAssets = await new Assets ( cloneDeep ( constructorParam ) ) . run ( ) ;
203204 await this . prepareReport ( module , missingEnvLocalesInAssets ) ;
204- this . getAffectedData ( 'assets' , DataModuleWise [ 'assets' ] , missingEnvLocalesInAssets ) ;
205+ this . getAffectedData ( 'assets' , dataModuleWise [ 'assets' ] , missingEnvLocalesInAssets ) ;
205206 break ;
206207 case 'content-types' :
207208 missingCtRefs = await new ContentType ( cloneDeep ( constructorParam ) ) . run ( ) ;
208209 await this . prepareReport ( module , missingCtRefs ) ;
209- this . getAffectedData ( 'content-types' , DataModuleWise [ 'content-types' ] , missingCtRefs ) ;
210+ this . getAffectedData ( 'content-types' , dataModuleWise [ 'content-types' ] , missingCtRefs ) ;
210211 break ;
211212 case 'global-fields' :
212213 missingGfRefs = await new GlobalField ( cloneDeep ( constructorParam ) ) . run ( ) ;
213214 await this . prepareReport ( module , missingGfRefs ) ;
214- this . getAffectedData ( 'global-fields' , DataModuleWise [ 'global-fields' ] , missingGfRefs ) ;
215+ this . getAffectedData ( 'global-fields' , dataModuleWise [ 'global-fields' ] , missingGfRefs ) ;
215216 break ;
216217 case 'entries' :
217218 missingEntry = await new Entries ( cloneDeep ( constructorParam ) ) . run ( ) ;
@@ -232,7 +233,7 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
232233 await this . prepareReport ( 'Entry_Missing_Locale_and_Env_in_Publish_Details' , missingEnvLocalesInEntries ) ;
233234
234235 await this . prepareReport ( 'Entry_Multiple_Fields' , missingMultipleFields ) ;
235- this . getAffectedData ( 'entries' , DataModuleWise [ 'entries' ] , missingEntry ) ;
236+ this . getAffectedData ( 'entries' , dataModuleWise [ 'entries' ] , missingEntry ) ;
236237
237238 break ;
238239 case 'workflows' :
@@ -244,24 +245,24 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
244245 fix : this . currentCommand === 'cm:stacks:audit:fix' ,
245246 } ) . run ( ) ;
246247 await this . prepareReport ( module , missingCtRefsInWorkflow ) ;
247- this . getAffectedData ( 'workflows' , DataModuleWise [ 'workflows' ] , missingCtRefsInWorkflow ) ;
248+ this . getAffectedData ( 'workflows' , dataModuleWise [ 'workflows' ] , missingCtRefsInWorkflow ) ;
248249
249250 break ;
250251 case 'extensions' :
251252 missingCtRefsInExtensions = await new Extensions ( cloneDeep ( constructorParam ) ) . run ( ) ;
252253 await this . prepareReport ( module , missingCtRefsInExtensions ) ;
253- this . getAffectedData ( 'extensions' , DataModuleWise [ 'extensions' ] , missingCtRefsInExtensions ) ;
254+ this . getAffectedData ( 'extensions' , dataModuleWise [ 'extensions' ] , missingCtRefsInExtensions ) ;
254255 break ;
255256 case 'custom-roles' :
256257 missingRefInCustomRoles = await new CustomRoles ( cloneDeep ( constructorParam ) ) . run ( ) ;
257258 await this . prepareReport ( module , missingRefInCustomRoles ) ;
258- this . getAffectedData ( 'custom-roles' , DataModuleWise [ 'custom-roles' ] , missingRefInCustomRoles ) ;
259+ this . getAffectedData ( 'custom-roles' , dataModuleWise [ 'custom-roles' ] , missingRefInCustomRoles ) ;
259260
260261 break ;
261262 case 'field-rules' :
262263 missingFieldRules = await new FieldRule ( cloneDeep ( constructorParam ) ) . run ( ) ;
263264 await this . prepareReport ( module , missingFieldRules ) ;
264- this . getAffectedData ( 'field-rules' , DataModuleWise [ 'content-types' ] , missingFieldRules ) ;
265+ this . getAffectedData ( 'field-rules' , dataModuleWise [ 'content-types' ] , missingFieldRules ) ;
265266 break ;
266267 }
267268
0 commit comments