1+ import { color } from "../color" ;
12import { ICommand , ICommandParameter } from "../common/definitions/commands" ;
23import { injector } from "../common/yok" ;
34import * as constants from "../constants" ;
@@ -114,9 +115,8 @@ export class CleanCommand implements ICommand {
114115 ] ;
115116
116117 try {
117- const overridePathsToClean = this . $projectConfigService . getValue (
118- "cli.pathsToClean"
119- ) ;
118+ const overridePathsToClean =
119+ this . $projectConfigService . getValue ( "cli.pathsToClean" ) ;
120120 const additionalPaths = this . $projectConfigService . getValue (
121121 "cli.additionalPathsToClean"
122122 ) ;
@@ -158,7 +158,7 @@ export class CleanCommand implements ICommand {
158158 if ( res . ok ) {
159159 spinner . succeed ( "Project successfully cleaned." ) ;
160160 } else {
161- spinner . fail ( ` ${ "Project unsuccessfully cleaned." . red } ` ) ;
161+ spinner . fail ( color . red ( "Project unsuccessfully cleaned." ) ) ;
162162 }
163163 }
164164
@@ -183,7 +183,7 @@ export class CleanCommand implements ICommand {
183183
184184 let computed = 0 ;
185185 const updateProgress = ( ) => {
186- const current = `${ computed } /${ paths . length } ` . grey ;
186+ const current = color . grey ( `${ computed } /${ paths . length } ` ) ;
187187 spinner . start (
188188 `Gathering cleanable sizes. This may take a while... ${ current } `
189189 ) ;
@@ -236,9 +236,11 @@ export class CleanCommand implements ICommand {
236236 . reduce ( ( a , b ) => a + b , 0 ) ;
237237
238238 const pathsToClean = await this . $prompter . promptForChoice (
239- `Found ${ projects . size } cleanable project(s) with a total size of: ${
240- bytesToHumanReadable ( totalSize ) . green
241- } . Select projects to clean`,
239+ `Found ${
240+ projects . size
241+ } cleanable project(s) with a total size of: ${ color . green (
242+ bytesToHumanReadable ( totalSize )
243+ ) } . Select projects to clean`,
242244 Array . from ( projects . keys ( ) ) . map ( ( p ) => {
243245 const size = projects . get ( p ) ;
244246 let description ;
@@ -249,7 +251,7 @@ export class CleanCommand implements ICommand {
249251 }
250252
251253 return {
252- title : `${ p } ${ description . grey } ` ,
254+ title : `${ p } ${ color . grey ( description ) } ` ,
253255 value : p ,
254256 } ;
255257 } ) ,
@@ -261,9 +263,11 @@ export class CleanCommand implements ICommand {
261263 this . $logger . clearScreen ( ) ;
262264
263265 spinner . warn (
264- `This will run "${ `ns clean` . yellow } " in all the selected projects and ${
265- "delete files from your system" . red . bold
266- } !`
266+ `This will run "${ color . yellow (
267+ `ns clean`
268+ ) } " in all the selected projects and ${ color . red . bold (
269+ "delete files from your system"
270+ ) } !`
267271 ) ;
268272 spinner . warn ( `This action cannot be undone!` ) ;
269273
@@ -281,7 +285,7 @@ export class CleanCommand implements ICommand {
281285 const currentPath = pathsToClean [ i ] ;
282286
283287 spinner . start (
284- `Cleaning ${ currentPath . cyan } ... ${ i + 1 } /${ pathsToClean . length } `
288+ `Cleaning ${ color . cyan ( currentPath ) } ... ${ i + 1 } /${ pathsToClean . length } `
285289 ) ;
286290
287291 const ok = await this . $childProcess
@@ -304,19 +308,21 @@ export class CleanCommand implements ICommand {
304308
305309 if ( ok ) {
306310 const cleanedSize = projects . get ( currentPath ) ;
307- const cleanedSizeStr = `- ${ bytesToHumanReadable ( cleanedSize ) } ` . grey ;
308- spinner . succeed ( `Cleaned ${ currentPath . cyan } ${ cleanedSizeStr } ` ) ;
311+ const cleanedSizeStr = color . grey (
312+ `- ${ bytesToHumanReadable ( cleanedSize ) } `
313+ ) ;
314+ spinner . succeed ( `Cleaned ${ color . cyan ( currentPath ) } ${ cleanedSizeStr } ` ) ;
309315 totalSizeCleaned += cleanedSize ;
310316 } else {
311- spinner . fail ( `Failed to clean ${ currentPath . cyan } - skipped` ) ;
317+ spinner . fail ( `Failed to clean ${ color . cyan ( currentPath ) } - skipped` ) ;
312318 }
313319 }
314320 spinner . clear ( ) ;
315321 spinner . stop ( ) ;
316322 spinner . succeed (
317- `Done! We've just freed up ${
318- bytesToHumanReadable ( totalSizeCleaned ) . green
319- } ! Woohoo! 🎉`
323+ `Done! We've just freed up ${ color . green (
324+ bytesToHumanReadable ( totalSizeCleaned )
325+ ) } ! Woohoo! 🎉`
320326 ) ;
321327
322328 if ( this . $options . dryRun ) {
0 commit comments