@@ -5,7 +5,9 @@ export class UpdateCommand implements ICommand {
55 constructor (
66 private $projectData : IProjectData ,
77 private $platformService : IPlatformService ,
8+ private $platformsData : IPlatformsData ,
89 private $pluginsService : IPluginsService ,
10+ private $projectDataService : IProjectDataService ,
911 private $logger : ILogger ,
1012 private $options : IOptions ,
1113 private $errors : IErrors ) { }
@@ -51,6 +53,18 @@ export class UpdateCommand implements ICommand {
5153
5254 private executeCore ( args : string [ ] , folders : string [ ] ) {
5355 let platforms = this . $platformService . getInstalledPlatforms ( ) . wait ( ) ;
56+ let availablePlatforms = this . $platformService . getAvailablePlatforms ( ) . wait ( ) ;
57+ let packagePlatforms : string [ ] = [ ] ;
58+
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 ( ) ;
66+ }
67+ }
5468
5569 this . $platformService . removePlatforms ( platforms ) . wait ( ) ;
5670 this . $pluginsService . remove ( "tns-core-modules" ) . wait ( ) ;
@@ -60,6 +74,7 @@ export class UpdateCommand implements ICommand {
6074 shelljs . rm ( "-fr" , folder ) ;
6175 }
6276
77+ platforms = platforms . concat ( packagePlatforms ) ;
6378 if ( args . length === 1 ) {
6479 for ( let platform of platforms ) {
6580 this . $platformService . addPlatforms ( [ platform + "@" + args [ 0 ] ] ) . wait ( ) ;
0 commit comments