@@ -413,6 +413,8 @@ export class PlatformService implements IPlatformService {
413
413
let data = this . $projectDataService . getValue ( platformData . frameworkPackageName ) . wait ( ) ;
414
414
let currentVersion = data && data . version ? data . version : "0.2.0" ;
415
415
let newVersion = version || this . $npmInstallationManager . getLatestVersion ( platformData . frameworkPackageName ) . wait ( ) ;
416
+
417
+ this . ensurePackageIsCached ( platformData . frameworkPackageName , newVersion ) . wait ( ) ;
416
418
417
419
if ( platformData . platformProjectService . canUpdatePlatform ( currentVersion , newVersion ) . wait ( ) ) {
418
420
@@ -488,7 +490,6 @@ export class PlatformService implements IPlatformService {
488
490
private getFrameworkFiles ( platformData : IPlatformData , version : string ) : IFuture < any > {
489
491
return ( ( ) => {
490
492
let cachedPackagePath = this . $npmInstallationManager . getCachedPackagePath ( platformData . frameworkPackageName , version ) ;
491
- this . ensurePackageIsCached ( cachedPackagePath , platformData . frameworkPackageName , version ) . wait ( ) ;
492
493
493
494
let allFiles = this . $fs . enumerateFilesInDirectorySync ( cachedPackagePath ) ;
494
495
let filteredFiles = _ . filter ( allFiles , file => _ . contains ( platformData . frameworkFilesExtensions , path . extname ( file ) ) ) ;
@@ -504,9 +505,10 @@ export class PlatformService implements IPlatformService {
504
505
} ) . future < any > ( ) ( ) ;
505
506
}
506
507
507
- private ensurePackageIsCached ( cachedPackagePath : string , packageName : string , version : string ) : IFuture < void > {
508
+ private ensurePackageIsCached ( packageName : string , version : string ) : IFuture < void > {
508
509
return ( ( ) => {
509
510
this . $npmInstallationManager . addToCache ( packageName , version ) . wait ( ) ;
511
+ let cachedPackagePath = this . $npmInstallationManager . getCachedPackagePath ( packageName , version ) ;
510
512
if ( ! this . $fs . exists ( path . join ( cachedPackagePath , constants . PROJECT_FRAMEWORK_FOLDER_NAME ) ) . wait ( ) ) {
511
513
// In some cases the package is not fully downloaded and the framework directory is missing
512
514
// Try removing the old package and add the real one to cache again
0 commit comments