1
1
import { resolve } from 'path' ;
2
2
import { AuditFix } from '@contentstack/cli-audit' ;
3
3
import 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' ;
5
5
6
6
import startModuleImport from './modules' ;
7
7
import startJSModuleImport from './modules-js' ;
@@ -10,7 +10,6 @@ import {
10
10
backupHandler ,
11
11
masterLocalDetails ,
12
12
sanitizeStack ,
13
- initLogger ,
14
13
setupBranchConfig ,
15
14
executeImportPathLogic ,
16
15
} from '../utils' ;
@@ -30,14 +29,15 @@ class ModuleImporter {
30
29
}
31
30
32
31
async start ( ) : Promise < any > {
32
+
33
33
if ( ! this . importConfig . management_token ) {
34
34
const stackDetails : Record < string , unknown > = await this . stackAPIClient . fetch ( ) ;
35
35
this . importConfig . stackName = stackDetails . name as string ;
36
36
this . importConfig . org_uid = stackDetails . org_uid as string ;
37
37
}
38
-
38
+
39
39
await this . resolveImportPath ( ) ;
40
-
40
+
41
41
await setupBranchConfig ( this . importConfig , this . stackAPIClient ) ;
42
42
if ( this . importConfig . branchAlias && this . importConfig . branchName ) {
43
43
this . stackAPIClient = this . managementAPIClient . stack ( {
@@ -58,9 +58,6 @@ class ModuleImporter {
58
58
this . importConfig . data = backupDir ;
59
59
}
60
60
61
- // NOTE init log
62
- const logger = initLogger ( this . importConfig ) ;
63
-
64
61
// NOTE audit and fix the import content.
65
62
if (
66
63
! this . importConfig . skipAudit &&
@@ -69,7 +66,7 @@ class ModuleImporter {
69
66
this . importConfig . moduleName ,
70
67
) )
71
68
) {
72
- if ( ! ( await this . auditImportData ( logger ) ) ) {
69
+ if ( ! ( await this . auditImportData ( ) ) ) {
73
70
return { noSuccessMsg : true } ;
74
71
}
75
72
}
@@ -152,7 +149,7 @@ class ModuleImporter {
152
149
* @returns The function `auditImportData()` returns a boolean value. It returns `true` if there is a
153
150
* fix available and the user confirms to proceed with the fix, otherwise it returns `false`.
154
151
*/
155
- async auditImportData ( logger : Logger ) {
152
+ async auditImportData ( ) {
156
153
const basePath = resolve ( this . importConfig . cliLogsPath || this . importConfig . backupDir , 'logs' , 'audit' ) ;
157
154
const auditConfig = this . importConfig . auditConfig ;
158
155
auditConfig . config . basePath = basePath ;
@@ -189,7 +186,7 @@ class ModuleImporter {
189
186
const { hasFix, config } = result ;
190
187
191
188
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 ) ;
193
190
194
191
if (
195
192
this . importConfig . forceStopMarketplaceAppsPrompt ||
0 commit comments