@@ -30,7 +30,7 @@ export class UpdateCommand implements ICommand {
3030 }
3131
3232 try {
33- this . executeCore ( args , folders ) ;
33+ this . executeCore ( args , folders ) . wait ( ) ;
3434 } catch ( error ) {
3535 shelljs . cp ( "-f" , path . join ( tmpDir , "package.json" ) , this . $projectData . projectDir ) ;
3636 for ( let folder of folders ) {
@@ -51,40 +51,42 @@ export class UpdateCommand implements ICommand {
5151 } ) . future < boolean > ( ) ( ) ;
5252 }
5353
54- private executeCore ( args : string [ ] , folders : string [ ] ) {
55- let platforms = this . $platformService . getInstalledPlatforms ( ) . wait ( ) ;
56- let availablePlatforms = this . $platformService . getAvailablePlatforms ( ) . wait ( ) ;
57- let packagePlatforms : string [ ] = [ ] ;
54+ private executeCore ( args : string [ ] , folders : string [ ] ) : IFuture < void > {
55+ return ( ( ) => {
56+ let platforms = this . $platformService . getInstalledPlatforms ( ) ;
57+ let availablePlatforms = this . $platformService . getAvailablePlatforms ( ) ;
58+ let packagePlatforms : string [ ] = [ ] ;
5859
59- this . $projectDataService . initialize ( this . $projectData . projectDir ) ;
60- for ( let platform of availablePlatforms ) {
61- let platformData = this . $platformsData . getPlatformData ( platform ) ;
62- let platformVersion = this . $projectDataService . getValue ( platformData . frameworkPackageName ) . wait ( ) ;
63- if ( platformVersion ) {
64- packagePlatforms . push ( platform ) ;
65- this . $projectDataService . removeProperty ( platformData . frameworkPackageName ) . wait ( ) ;
60+ this . $projectDataService . initialize ( this . $projectData . projectDir ) ;
61+ for ( let platform of availablePlatforms ) {
62+ let platformData = this . $platformsData . getPlatformData ( platform ) ;
63+ let platformVersion = this . $projectDataService . getValue ( platformData . frameworkPackageName ) . wait ( ) ;
64+ if ( platformVersion ) {
65+ packagePlatforms . push ( platform ) ;
66+ this . $projectDataService . removeProperty ( platformData . frameworkPackageName ) . wait ( ) ;
67+ }
6668 }
67- }
6869
69- this . $platformService . removePlatforms ( platforms ) . wait ( ) ;
70- this . $pluginsService . remove ( "tns-core-modules" ) . wait ( ) ;
71- this . $pluginsService . remove ( "tns-core-modules-widgets" ) . wait ( ) ;
70+ this . $platformService . removePlatforms ( platforms ) . wait ( ) ;
71+ this . $pluginsService . remove ( "tns-core-modules" ) . wait ( ) ;
72+ this . $pluginsService . remove ( "tns-core-modules-widgets" ) . wait ( ) ;
7273
73- for ( let folder of folders ) {
74- shelljs . rm ( "-fr" , folder ) ;
75- }
74+ for ( let folder of folders ) {
75+ shelljs . rm ( "-fr" , folder ) ;
76+ }
7677
77- platforms = platforms . concat ( packagePlatforms ) ;
78- if ( args . length === 1 ) {
79- for ( let platform of platforms ) {
80- this . $platformService . addPlatforms ( [ platform + "@" + args [ 0 ] ] ) . wait ( ) ;
78+ platforms = platforms . concat ( packagePlatforms ) ;
79+ if ( args . length === 1 ) {
80+ for ( let platform of platforms ) {
81+ this . $platformService . addPlatforms ( [ platform + "@" + args [ 0 ] ] ) . wait ( ) ;
82+ }
83+ this . $pluginsService . add ( "tns-core-modules@" + args [ 0 ] ) . wait ( ) ;
84+ } else {
85+ this . $platformService . addPlatforms ( platforms ) . wait ( ) ;
86+ this . $pluginsService . add ( "tns-core-modules" ) . wait ( ) ;
8187 }
82- this . $pluginsService . add ( "tns-core-modules@" + args [ 0 ] ) . wait ( ) ;
83- } else {
84- this . $platformService . addPlatforms ( platforms ) . wait ( ) ;
85- this . $pluginsService . add ( "tns-core-modules" ) . wait ( ) ;
86- }
87- this . $pluginsService . ensureAllDependenciesAreInstalled ( ) . wait ( ) ;
88+ this . $pluginsService . ensureAllDependenciesAreInstalled ( ) . wait ( ) ;
89+ } ) . future < void > ( ) ( ) ;
8890 }
8991
9092 allowedParameters : ICommandParameter [ ] = [ ] ;
0 commit comments