1- import chalk from 'chalk ' ;
1+ import { getChalk } from '@contentstack/cli-utilities ' ;
22import forEach from 'lodash/forEach' ;
33import padStart from 'lodash/padStart' ;
44import startCase from 'lodash/startCase' ;
@@ -196,19 +196,19 @@ function printCompactTextView(branchTextRes: BranchCompactTextRes): void {
196196 cliux . print ( ' ' ) ;
197197 forEach ( branchTextRes . added , ( diff : BranchDiffRes ) => {
198198 if ( diff . merge_strategy !== 'ignore' ) {
199- cliux . print ( chalk . green ( `+ '${ diff . title } ' ${ startCase ( camelCase ( diff . type ) ) } ` ) ) ;
199+ cliux . print ( getChalk ( ) . green ( `+ '${ diff . title } ' ${ startCase ( camelCase ( diff . type ) ) } ` ) ) ;
200200 }
201201 } ) ;
202202
203203 forEach ( branchTextRes . modified , ( diff : BranchDiffRes ) => {
204204 if ( diff . merge_strategy !== 'ignore' ) {
205- cliux . print ( chalk . blue ( `± '${ diff . title } ' ${ startCase ( camelCase ( diff . type ) ) } ` ) ) ;
205+ cliux . print ( getChalk ( ) . blue ( `± '${ diff . title } ' ${ startCase ( camelCase ( diff . type ) ) } ` ) ) ;
206206 }
207207 } ) ;
208208
209209 forEach ( branchTextRes . deleted , ( diff : BranchDiffRes ) => {
210210 if ( diff . merge_strategy !== 'ignore' ) {
211- cliux . print ( chalk . red ( `- '${ diff . title } ' ${ startCase ( camelCase ( diff . type ) ) } ` ) ) ;
211+ cliux . print ( getChalk ( ) . red ( `- '${ diff . title } ' ${ startCase ( camelCase ( diff . type ) ) } ` ) ) ;
212212 }
213213 } ) ;
214214 }
@@ -442,16 +442,16 @@ function printVerboseTextView(branchTextRes: BranchDiffVerboseRes): void {
442442 if ( branchTextRes . modified ?. length || branchTextRes . added ?. length || branchTextRes . deleted ?. length ) {
443443 cliux . print ( ' ' ) ;
444444 forEach ( branchTextRes . added , ( diff : BranchDiffRes ) => {
445- cliux . print ( chalk . green ( `+ '${ diff . title } ' ${ startCase ( camelCase ( diff . type ) ) } ` ) ) ;
445+ cliux . print ( getChalk ( ) . green ( `+ '${ diff . title } ' ${ startCase ( camelCase ( diff . type ) ) } ` ) ) ;
446446 } ) ;
447447
448448 forEach ( branchTextRes . modified , ( diff : BranchModifiedDetails ) => {
449- cliux . print ( chalk . blue ( `± '${ diff . moduleDetails . title } ' ${ startCase ( camelCase ( diff . moduleDetails . type ) ) } ` ) ) ;
449+ cliux . print ( getChalk ( ) . blue ( `± '${ diff . moduleDetails . title } ' ${ startCase ( camelCase ( diff . moduleDetails . type ) ) } ` ) ) ;
450450 printModifiedFields ( diff . modifiedFields ) ;
451451 } ) ;
452452
453453 forEach ( branchTextRes . deleted , ( diff : BranchDiffRes ) => {
454- cliux . print ( chalk . red ( `- '${ diff . title } ' ${ startCase ( camelCase ( diff . type ) ) } ` ) ) ;
454+ cliux . print ( getChalk ( ) . red ( `- '${ diff . title } ' ${ startCase ( camelCase ( diff . type ) ) } ` ) ) ;
455455 } ) ;
456456 }
457457}
@@ -466,17 +466,17 @@ function printModifiedFields(modfiedFields: ModifiedFieldsInput): void {
466466 forEach ( modfiedFields . modified , ( diff : ModifiedFieldsType ) => {
467467 const field : string = diff . field ? `${ diff . field } ` : 'field' ;
468468 const fieldDetail = diff . path ? `(${ diff . path } ) ${ field } ` : `${ field } ` ;
469- cliux . print ( ` ${ chalk . blue ( `± "${ diff . displayName } " ${ fieldDetail } ` ) } ` ) ;
469+ cliux . print ( ` ${ getChalk ( ) . blue ( `± "${ diff . displayName } " ${ fieldDetail } ` ) } ` ) ;
470470 } ) ;
471471
472472 forEach ( modfiedFields . added , ( diff : ModifiedFieldsType ) => {
473473 const field : string = diff . field ? `${ diff . field } field` : 'field' ;
474- cliux . print ( ` ${ chalk . green ( `+ "${ diff . displayName } " (${ diff . path } ) ${ field } ` ) } ` ) ;
474+ cliux . print ( ` ${ getChalk ( ) . green ( `+ "${ diff . displayName } " (${ diff . path } ) ${ field } ` ) } ` ) ;
475475 } ) ;
476476
477477 forEach ( modfiedFields . deleted , ( diff : ModifiedFieldsType ) => {
478478 const field : string = diff . field ? `${ diff . field } field` : 'field' ;
479- cliux . print ( ` ${ chalk . red ( `- "${ diff . displayName } " (${ diff . path } ) ${ field } ` ) } ` ) ;
479+ cliux . print ( ` ${ getChalk ( ) . red ( `- "${ diff . displayName } " (${ diff . path } ) ${ field } ` ) } ` ) ;
480480 } ) ;
481481 }
482482}
0 commit comments