diff --git a/lib/common b/lib/common index 46e271fc22..e8426828e3 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit 46e271fc2280d9b45bd027f78f0f411e9b8d474f +Subproject commit e8426828e3569571ddde07441e99591cdcfccb92 diff --git a/lib/definitions/plugins.d.ts b/lib/definitions/plugins.d.ts index 2935878a59..35e38b63ab 100644 --- a/lib/definitions/plugins.d.ts +++ b/lib/definitions/plugins.d.ts @@ -53,6 +53,7 @@ interface IPluginVariablesService { * @return {IFuture} returns the changed plugin configuration file content. */ getPluginVariablePropertyName(pluginData: IPluginData): string; + } interface IPluginVariableData { diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index ff8a20a8fd..271c9ebf77 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -516,15 +516,12 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ let podTool = this.$config.USE_POD_SANDBOX ? "sandbox-pod" : "pod"; let childProcess = this.$childProcess.spawnFromEvent(podTool, ["install"], "close", { cwd: this.platformData.projectRoot, stdio: ['pipe', process.stdout, 'pipe'] }).wait(); if (childProcess.stderr) { - let warnings = childProcess.stderr.match(/(\u001b\[(?:\d*;){0,5}\d*m[\s\S]+?\u001b\[(?:\d*;){0,5}\d*m)|(\[!\].*?\n)/g); + let warnings = childProcess.stderr.match(/(\u001b\[(?:\d*;){0,5}\d*m[\s\S]+?\u001b\[(?:\d*;){0,5}\d*m)|(\[!\].*?\n)|(.*?warning.*)/gi); _.each(warnings, (warning: string) => { this.$logger.warnWithLabel(warning.replace("\n", "")); }); - // HACK for silencing irrelevant linking warnings when pod installing on - // El Capitan with cocoa pods version 0.38.2 - // Reference https://github.com/CocoaPods/CocoaPods/issues/4302 - let errors = childProcess.stderr.replace(/dyld: warning, LC_RPATH @executable_path.*?@executable_path/g, ""); + let errors = childProcess.stderr; _.each(warnings, warning => { errors = errors.replace(warning, ""); }); diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index daf7447617..948c169c1c 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -154,11 +154,25 @@ export class PlatformService implements IPlatformService { }).future()(); } - @helpers.hook('prepare') public preparePlatform(platform: string): IFuture { return (() => { this.validatePlatform(platform); + //We need dev-dependencies here, so before-prepare hooks will be executed correctly. + try { + this.$pluginsService.ensureAllDependenciesAreInstalled().wait(); + } catch(err) { + this.$logger.trace(err); + this.$errors.failWithoutHelp(`Unable to install dependencies. Make sure your package.json is valid and all dependencies are correct. Error is: ${err.message}`); + } + + this.preparePlatformCore(platform).wait(); + }).future()(); + } + + @helpers.hook('prepare') + private preparePlatformCore(platform: string): IFuture { + return (() => { platform = platform.toLowerCase(); this.ensurePlatformInstalled(platform).wait(); @@ -214,7 +228,6 @@ export class PlatformService implements IPlatformService { // Process node_modules folder let appDir = path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME); try { - this.$pluginsService.ensureAllDependenciesAreInstalled().wait(); let tnsModulesDestinationPath = path.join(appDir, PlatformService.TNS_MODULES_FOLDER_NAME); this.$broccoliBuilder.prepareNodeModules(tnsModulesDestinationPath, platform, lastModifiedTime).wait(); } catch(error) { diff --git a/lib/services/plugins-service.ts b/lib/services/plugins-service.ts index ed85813b5b..0951f4de4e 100644 --- a/lib/services/plugins-service.ts +++ b/lib/services/plugins-service.ts @@ -160,7 +160,8 @@ export class PluginsService implements IPluginsService { return (() => { let installedDependencies = this.$fs.exists(this.nodeModulesPath).wait() ? this.$fs.readDirectory(this.nodeModulesPath).wait() : []; let packageJsonContent = this.$fs.readJson(this.getPackageJsonFilePath()).wait(); - if(this.$options.force || (packageJsonContent.dependencies && _.difference(_.keys(packageJsonContent.dependencies), installedDependencies).length)) { + let allDependencies = _.keys(packageJsonContent.dependencies).concat(_.keys(packageJsonContent.devDependencies)); + if(this.$options.force || _.difference(allDependencies, installedDependencies).length) { let command = "npm install "; if(this.$options.ignoreScripts) { command += "--ignore-scripts"; diff --git a/lib/services/usb-livesync-service.ts b/lib/services/usb-livesync-service.ts index 88ed619ea5..321eab9f0f 100644 --- a/lib/services/usb-livesync-service.ts +++ b/lib/services/usb-livesync-service.ts @@ -49,9 +49,10 @@ export class UsbLiveSyncService extends usbLivesyncServiceBaseLib.UsbLiveSyncSer let platformData = this.$platformsData.getPlatformData(platformLowerCase); + this.$projectDataService.initialize(this.$projectData.projectDir); + let frameworkVersion = this.$projectDataService.getValue(platformData.frameworkPackageName).wait().version; + if (platformLowerCase === this.$devicePlatformsConstants.Android.toLowerCase()) { - this.$projectDataService.initialize(this.$projectData.projectDir); - let frameworkVersion = this.$projectDataService.getValue(platformData.frameworkPackageName).wait().version; if (semver.lt(frameworkVersion, "1.2.1")) { let shouldUpdate = this.$prompter.confirm( "You need Android Runtime 1.2.1 or later for LiveSync to work properly. Do you want to update your runtime now?" @@ -139,6 +140,8 @@ export class UsbLiveSyncService extends usbLivesyncServiceBaseLib.UsbLiveSyncSer return platformSpecificUsbLiveSyncService.sendPageReloadMessageToDevice(deviceAppData).wait(); }); } + + this.$logger.info(`Successfully synced application ${this.$projectData.projectId}.`); }).future()(); }); }; @@ -156,7 +159,7 @@ export class UsbLiveSyncService extends usbLivesyncServiceBaseLib.UsbLiveSyncSer beforeLiveSyncAction: beforeLiveSyncAction, beforeBatchLiveSyncAction: beforeBatchLiveSyncAction, iOSSimulatorRelativeToProjectBasePathAction: iOSSimulatorRelativeToProjectBasePathAction, - canExecuteFastLiveSync: (filePath: string) => _.contains(fastLivesyncFileExtensions, path.extname(filePath)), + canExecuteFastLiveSync: (filePath: string) => _.contains(fastLivesyncFileExtensions, path.extname(filePath)) && semver.gte(frameworkVersion, "1.5.0"), fastLiveSync: fastLiveSync }; diff --git a/package.json b/package.json index b4a7f45813..1bcc36f325 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "nativescript", "preferGlobal": true, - "version": "1.5.0", + "version": "1.6.0", "author": "Telerik ", "description": "Command-line interface for building NativeScript projects", "bin": {