11import { resolve } from 'path' ;
22import { AuditFix } from '@contentstack/cli-audit' ;
33import messages , { $t } from '@contentstack/cli-audit/lib/messages' ;
4- import { addLocale , cliux , ContentstackClient , Logger , log } from '@contentstack/cli-utilities' ;
4+ import { addLocale , cliux , ContentstackClient , log } from '@contentstack/cli-utilities' ;
55
66import startModuleImport from './modules' ;
77import startJSModuleImport from './modules-js' ;
@@ -10,7 +10,6 @@ import {
1010 backupHandler ,
1111 masterLocalDetails ,
1212 sanitizeStack ,
13- initLogger ,
1413 setupBranchConfig ,
1514 executeImportPathLogic ,
1615} from '../utils' ;
@@ -30,14 +29,15 @@ class ModuleImporter {
3029 }
3130
3231 async start ( ) : Promise < any > {
32+
3333 if ( ! this . importConfig . management_token ) {
3434 const stackDetails : Record < string , unknown > = await this . stackAPIClient . fetch ( ) ;
3535 this . importConfig . stackName = stackDetails . name as string ;
3636 this . importConfig . org_uid = stackDetails . org_uid as string ;
3737 }
38-
38+
3939 await this . resolveImportPath ( ) ;
40-
40+
4141 await setupBranchConfig ( this . importConfig , this . stackAPIClient ) ;
4242 if ( this . importConfig . branchAlias && this . importConfig . branchName ) {
4343 this . stackAPIClient = this . managementAPIClient . stack ( {
@@ -58,9 +58,6 @@ class ModuleImporter {
5858 this . importConfig . data = backupDir ;
5959 }
6060
61- // NOTE init log
62- const logger = initLogger ( this . importConfig ) ;
63-
6461 // NOTE audit and fix the import content.
6562 if (
6663 ! this . importConfig . skipAudit &&
@@ -69,7 +66,7 @@ class ModuleImporter {
6966 this . importConfig . moduleName ,
7067 ) )
7168 ) {
72- if ( ! ( await this . auditImportData ( logger ) ) ) {
69+ if ( ! ( await this . auditImportData ( ) ) ) {
7370 return { noSuccessMsg : true } ;
7471 }
7572 }
@@ -152,7 +149,7 @@ class ModuleImporter {
152149 * @returns The function `auditImportData()` returns a boolean value. It returns `true` if there is a
153150 * fix available and the user confirms to proceed with the fix, otherwise it returns `false`.
154151 */
155- async auditImportData ( logger : Logger ) {
152+ async auditImportData ( ) {
156153 const basePath = resolve ( this . importConfig . cliLogsPath || this . importConfig . backupDir , 'logs' , 'audit' ) ;
157154 const auditConfig = this . importConfig . auditConfig ;
158155 auditConfig . config . basePath = basePath ;
@@ -189,7 +186,7 @@ class ModuleImporter {
189186 const { hasFix, config } = result ;
190187
191188 if ( hasFix ) {
192- logger . log ( $t ( messages . FINAL_REPORT_PATH , { path : config . reportPath } ) , 'warn' ) ;
189+ log . warn ( $t ( messages . FINAL_REPORT_PATH , { path : config . reportPath } ) , this . importConfig . context ) ;
193190
194191 if (
195192 this . importConfig . forceStopMarketplaceAppsPrompt ||
0 commit comments