File tree 2 files changed +18
-6
lines changed
2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -19,17 +19,26 @@ export class CleanCommand implements ICommand {
19
19
const spinner = this . $terminalSpinnerService . createSpinner ( ) ;
20
20
spinner . start ( "Cleaning project...\n" ) ;
21
21
22
- const pathsToClean = [
22
+ let pathsToClean = [
23
23
constants . HOOKS_DIR_NAME ,
24
24
constants . PLATFORMS_DIR_NAME ,
25
25
constants . NODE_MODULES_FOLDER_NAME ,
26
26
constants . PACKAGE_LOCK_JSON_FILE_NAME ,
27
27
] ;
28
28
29
29
try {
30
+ const overridePathsToClean = this . $projectConfigService . getValue (
31
+ "cli.pathsToClean"
32
+ ) ;
30
33
const additionalPaths = this . $projectConfigService . getValue (
31
34
"cli.additionalPathsToClean"
32
35
) ;
36
+
37
+ // allow overriding default paths to clean
38
+ if ( Array . isArray ( overridePathsToClean ) ) {
39
+ pathsToClean = overridePathsToClean ;
40
+ }
41
+
33
42
if ( Array . isArray ( additionalPaths ) ) {
34
43
pathsToClean . push ( ...additionalPaths ) ;
35
44
}
Original file line number Diff line number Diff line change @@ -11,11 +11,10 @@ export class ProjectCleanupService implements IProjectCleanupService {
11
11
private $logger : ILogger ,
12
12
private $projectHelper : IProjectHelper ,
13
13
private $terminalSpinnerService : ITerminalSpinnerService
14
- ) {
15
- this . spinner = this . $terminalSpinnerService . createSpinner ( ) ;
16
- }
14
+ ) { }
17
15
18
16
public async clean ( pathsToClean : string [ ] ) : Promise < boolean > {
17
+ this . spinner = this . $terminalSpinnerService . createSpinner ( ) ;
19
18
let success = true ;
20
19
for ( const pathToClean of pathsToClean ) {
21
20
const isCleaned = await this . cleanPath ( pathToClean ) . catch ( ( error ) => {
@@ -27,13 +26,17 @@ export class ProjectCleanupService implements IProjectCleanupService {
27
26
} ) ;
28
27
success = success && isCleaned ;
29
28
}
29
+
30
+ // required to print an empty line for the spinner to not replace the last status... (probably a bug in the spinners)
31
+ console . log ( ) ;
30
32
return success ;
31
33
}
32
34
33
35
public async cleanPath ( pathToClean : string ) : Promise < boolean > {
34
36
this . spinner . clear ( ) ;
35
37
let success = true ;
36
38
let fileType : string ;
39
+
37
40
if ( ! pathToClean || pathToClean . trim ( ) . length === 0 ) {
38
41
this . $logger . trace ( "cleanPath called with no pathToClean." ) ;
39
42
return success ;
@@ -70,8 +73,8 @@ export class ProjectCleanupService implements IProjectCleanupService {
70
73
return success ;
71
74
}
72
75
this . $logger . trace ( `Path '${ filePath } ' not found, skipping.` ) ;
73
- // this.spinner.text = `Skipping ${displayPath} because it doesn't exist.`;
74
- // this.spinner.info();
76
+ this . spinner . info ( `Skipping ${ displayPath } because it doesn't exist.` ) ;
77
+
75
78
return success ;
76
79
}
77
80
}
You can’t perform that action at this time.
0 commit comments