From e059ab59a0d919e60e05c743a64960baae55d695 Mon Sep 17 00:00:00 2001 From: Fatme Havaluova Date: Wed, 1 Jul 2015 16:39:02 +0300 Subject: [PATCH] Ensure all npm deps are installed when no platform is specified in package.json and aggregate errors --- lib/commands/install.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/commands/install.ts b/lib/commands/install.ts index bb2b0668fa..e26e99aca9 100644 --- a/lib/commands/install.ts +++ b/lib/commands/install.ts @@ -7,7 +7,9 @@ export class InstallCommand implements ICommand { constructor(private $platformsData: IPlatformsData, private $platformService: IPlatformService, private $projectData: IProjectData, - private $projectDataService: IProjectDataService) { } + private $projectDataService: IProjectDataService, + private $pluginsService: IPluginsService, + private $logger: ILogger) { } public enableHooks = false; @@ -15,15 +17,27 @@ export class InstallCommand implements ICommand { public execute(args: string[]): IFuture { return (() => { - this.$projectDataService.initialize(this.$projectData.projectDir); + let error: string = ""; + this.$pluginsService.ensureAllDependenciesAreInstalled().wait(); + + this.$projectDataService.initialize(this.$projectData.projectDir); _.each(this.$platformsData.platformsNames, platform => { let platformData = this.$platformsData.getPlatformData(platform); let frameworkPackageData = this.$projectDataService.getValue(platformData.frameworkPackageName).wait(); if(frameworkPackageData && frameworkPackageData.version) { - this.$platformService.addPlatforms([`${platform}@${frameworkPackageData.version}`]).wait(); + try { + this.$platformService.addPlatforms([`${platform}@${frameworkPackageData.version}`]).wait(); + } catch(err) { + error += err; + } } }); + + if(error) { + this.$logger.error(error); + } + }).future()(); } }