@@ -47,7 +47,7 @@ function bytesToHumanReadable(bytes: number): string {
47
47
function promiseMap < T > (
48
48
values : T [ ] ,
49
49
mapper : ( value : T ) => Promise < void > ,
50
- concurrency = 10
50
+ concurrency = 10 ,
51
51
) {
52
52
let index = 0 ;
53
53
let pending = 0 ;
@@ -89,7 +89,7 @@ export class CleanCommand implements ICommand {
89
89
private $logger : ILogger ,
90
90
private $options : IOptions ,
91
91
private $childProcess : IChildProcess ,
92
- private $staticConfig : IStaticConfig
92
+ private $staticConfig : IStaticConfig ,
93
93
) { }
94
94
95
95
public async execute ( args : string [ ] ) : Promise < void > {
@@ -117,7 +117,7 @@ export class CleanCommand implements ICommand {
117
117
const overridePathsToClean =
118
118
this . $projectConfigService . getValue ( "cli.pathsToClean" ) ;
119
119
const additionalPaths = this . $projectConfigService . getValue (
120
- "cli.additionalPathsToClean"
120
+ "cli.additionalPathsToClean" ,
121
121
) ;
122
122
123
123
// allow overriding default paths to clean
@@ -147,8 +147,8 @@ export class CleanCommand implements ICommand {
147
147
stats : Object . fromEntries ( res . stats . entries ( ) ) ,
148
148
} ,
149
149
null ,
150
- 2
151
- )
150
+ 2 ,
151
+ ) ,
152
152
) ;
153
153
154
154
return ;
@@ -169,7 +169,7 @@ export class CleanCommand implements ICommand {
169
169
}
170
170
171
171
const shouldScan = await this . $prompter . confirm (
172
- "No project found in the current directory. Would you like to scan for all projects in sub-directories instead?"
172
+ "No project found in the current directory. Would you like to scan for all projects in sub-directories instead?" ,
173
173
) ;
174
174
175
175
if ( ! shouldScan ) {
@@ -184,7 +184,7 @@ export class CleanCommand implements ICommand {
184
184
const updateProgress = ( ) => {
185
185
const current = color . grey ( `${ computed } /${ paths . length } ` ) ;
186
186
spinner . start (
187
- `Gathering cleanable sizes. This may take a while... ${ current } `
187
+ `Gathering cleanable sizes. This may take a while... ${ current } ` ,
188
188
) ;
189
189
} ;
190
190
@@ -201,7 +201,7 @@ export class CleanCommand implements ICommand {
201
201
`node ${ this . $staticConfig . cliBinPath } clean --dry-run --json --disable-analytics` ,
202
202
{
203
203
cwd : p ,
204
- }
204
+ } ,
205
205
)
206
206
. then ( ( res ) => {
207
207
const paths : Record < string , number > = JSON . parse ( res ) . stats ;
@@ -211,7 +211,7 @@ export class CleanCommand implements ICommand {
211
211
this . $logger . trace (
212
212
"Failed to get project size for %s, Error is:" ,
213
213
p ,
214
- err
214
+ err ,
215
215
) ;
216
216
return - 1 ;
217
217
} )
@@ -225,7 +225,7 @@ export class CleanCommand implements ICommand {
225
225
updateProgress ( ) ;
226
226
} ) ;
227
227
} ,
228
- os . cpus ( ) . length
228
+ os . cpus ( ) . length ,
229
229
) ;
230
230
231
231
spinner . clear ( ) ;
@@ -241,7 +241,7 @@ export class CleanCommand implements ICommand {
241
241
`Found ${
242
242
projects . size
243
243
} cleanable project(s) with a total size of: ${ color . green (
244
- bytesToHumanReadable ( totalSize )
244
+ bytesToHumanReadable ( totalSize ) ,
245
245
) } . Select projects to clean`,
246
246
Array . from ( projects . keys ( ) ) . map ( ( p ) => {
247
247
const size = projects . get ( p ) ;
@@ -260,21 +260,21 @@ export class CleanCommand implements ICommand {
260
260
true ,
261
261
{
262
262
optionsPerPage : process . stdout . rows - 6 , // 6 lines are taken up by the instructions
263
- } as Partial < PromptObject >
263
+ } as Partial < PromptObject > ,
264
264
) ;
265
265
this . $logger . clearScreen ( ) ;
266
266
267
267
spinner . warn (
268
268
`This will run "${ color . yellow (
269
- `ns clean`
269
+ `ns clean` ,
270
270
) } " in all the selected projects and ${ color . red . bold (
271
- "delete files from your system"
272
- ) } !`
271
+ "delete files from your system" ,
272
+ ) } !`,
273
273
) ;
274
274
spinner . warn ( `This action cannot be undone!` ) ;
275
275
276
276
let confirmed = await this . $prompter . confirm (
277
- "Are you sure you want to clean the selected projects?"
277
+ "Are you sure you want to clean the selected projects?" ,
278
278
) ;
279
279
if ( ! confirmed ) {
280
280
return ;
@@ -287,7 +287,7 @@ export class CleanCommand implements ICommand {
287
287
const currentPath = pathsToClean [ i ] ;
288
288
289
289
spinner . start (
290
- `Cleaning ${ color . cyan ( currentPath ) } ... ${ i + 1 } /${ pathsToClean . length } `
290
+ `Cleaning ${ color . cyan ( currentPath ) } ... ${ i + 1 } /${ pathsToClean . length } ` ,
291
291
) ;
292
292
293
293
const ok = await this . $childProcess
@@ -297,7 +297,7 @@ export class CleanCommand implements ICommand {
297
297
} --json --disable-analytics`,
298
298
{
299
299
cwd : currentPath ,
300
- }
300
+ } ,
301
301
)
302
302
. then ( ( res ) => {
303
303
const cleanupRes = JSON . parse ( res ) as IProjectCleanupResult ;
@@ -311,7 +311,7 @@ export class CleanCommand implements ICommand {
311
311
if ( ok ) {
312
312
const cleanedSize = projects . get ( currentPath ) ;
313
313
const cleanedSizeStr = color . grey (
314
- `- ${ bytesToHumanReadable ( cleanedSize ) } `
314
+ `- ${ bytesToHumanReadable ( cleanedSize ) } ` ,
315
315
) ;
316
316
spinner . succeed ( `Cleaned ${ color . cyan ( currentPath ) } ${ cleanedSizeStr } ` ) ;
317
317
totalSizeCleaned += cleanedSize ;
@@ -323,19 +323,19 @@ export class CleanCommand implements ICommand {
323
323
spinner . stop ( ) ;
324
324
spinner . succeed (
325
325
`Done! We've just freed up ${ color . green (
326
- bytesToHumanReadable ( totalSizeCleaned )
327
- ) } ! Woohoo! 🎉`
326
+ bytesToHumanReadable ( totalSizeCleaned ) ,
327
+ ) } ! Woohoo! 🎉`,
328
328
) ;
329
329
330
330
if ( this . $options . dryRun ) {
331
331
spinner . info (
332
- 'Note: the "--dry-run" flag was used, so no files were actually deleted.'
332
+ 'Note: the "--dry-run" flag was used, so no files were actually deleted.' ,
333
333
) ;
334
334
}
335
335
}
336
336
337
337
private async getNSProjectPathsInDirectory (
338
- dir = process . cwd ( )
338
+ dir = process . cwd ( ) ,
339
339
) : Promise < string [ ] > {
340
340
let nsDirs : string [ ] = [ ] ;
341
341
@@ -346,20 +346,20 @@ export class CleanCommand implements ICommand {
346
346
}
347
347
348
348
const dirents = await readdir ( dir , { withFileTypes : true } ) . catch (
349
- ( err ) => {
349
+ ( err ) : any [ ] => {
350
350
this . $logger . trace (
351
351
'Failed to read directory "%s". Error is:' ,
352
352
dir ,
353
- err
353
+ err ,
354
354
) ;
355
355
return [ ] ;
356
- }
356
+ } ,
357
357
) ;
358
358
359
359
const hasNSConfig = dirents . some (
360
360
( ent ) =>
361
361
ent . name . includes ( "nativescript.config.ts" ) ||
362
- ent . name . includes ( "nativescript.config.js" )
362
+ ent . name . includes ( "nativescript.config.js" ) ,
363
363
) ;
364
364
365
365
if ( hasNSConfig ) {
@@ -375,7 +375,7 @@ export class CleanCommand implements ICommand {
375
375
if ( dirent . isDirectory ( ) ) {
376
376
return getFiles ( res ) ;
377
377
}
378
- } )
378
+ } ) ,
379
379
) ;
380
380
} ;
381
381
0 commit comments