@@ -15,16 +15,23 @@ export class UpdateCommand implements ICommand {
15
15
this . $projectData . initializeProjectData ( ) ;
16
16
}
17
17
18
- static readonly folders : string [ ] = [ "lib" , "hooks" , "platforms" , "node_modules" ] ;
18
+ static readonly folders : string [ ] = [
19
+ constants . LIB_DIR_NAME ,
20
+ constants . HOOKS_DIR_NAME ,
21
+ constants . PLATFORMS_DIR_NAME ,
22
+ constants . NODE_MODULES_FOLDER_NAME
23
+ ] ;
19
24
static readonly tempFolder : string = ".tmp_backup" ;
25
+ static readonly updateFailMessage : string = "Could not update the project!" ;
26
+ static readonly backupFailMessage : string = "Could not backup project folders!" ;
20
27
21
28
public async execute ( args : string [ ] ) : Promise < void > {
22
29
const tmpDir = path . join ( this . $projectData . projectDir , UpdateCommand . tempFolder ) ;
23
30
24
31
try {
25
32
this . backup ( tmpDir ) ;
26
33
} catch ( error ) {
27
- this . $logger . error ( "Could not backup project folders!" ) ;
34
+ this . $logger . error ( UpdateCommand . backupFailMessage ) ;
28
35
this . $fs . deleteDirectory ( tmpDir ) ;
29
36
return ;
30
37
}
@@ -33,7 +40,7 @@ export class UpdateCommand implements ICommand {
33
40
await this . executeCore ( args ) ;
34
41
} catch ( error ) {
35
42
this . restoreBackup ( tmpDir ) ;
36
- this . $logger . error ( "Could not update the project!" ) ;
43
+ this . $logger . error ( UpdateCommand . updateFailMessage ) ;
37
44
} finally {
38
45
this . $fs . deleteDirectory ( tmpDir ) ;
39
46
}
0 commit comments