From 83522a77498f620706b6e192c2bd12e71efe91a8 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Fri, 7 Jun 2019 09:49:01 +0300 Subject: [PATCH 1/4] fix: unable to start iOS simulator when Android is not setup In case CLI is used as a library, you need both Android and iOS to be setup in order to start simulator/emulator. The problem is that we check for errors in the setup before actually checking if we have found simulator/emulator with the specified name. Change the logic and do not raise errors in case the specified name/id is found. This way you can start iOS Simulator without having any Android setup on local machine. --- lib/common/mobile/mobile-core/devices-service.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/common/mobile/mobile-core/devices-service.ts b/lib/common/mobile/mobile-core/devices-service.ts index 00858d4510..663d6f72c1 100644 --- a/lib/common/mobile/mobile-core/devices-service.ts +++ b/lib/common/mobile/mobile-core/devices-service.ts @@ -128,9 +128,6 @@ export class DevicesService extends EventEmitter implements Mobile.IDevicesServi const availableEmulatorsOutput = await this.getEmulatorImages({ platform: options.platform }); const emulators = this.$emulatorHelper.getEmulatorsFromAvailableEmulatorsOutput(availableEmulatorsOutput); const errors = this.$emulatorHelper.getErrorsFromAvailableEmulatorsOutput(availableEmulatorsOutput); - if (errors.length) { - return errors; - } let emulator = null; if (options.imageIdentifier) { @@ -140,7 +137,8 @@ export class DevicesService extends EventEmitter implements Mobile.IDevicesServi } if (!emulator) { - return [`Unable to find emulator with provided options: ${options}`]; + const additionalErrors = errors && errors.length ? errors : []; + return [`Unable to find emulator with provided options: ${options}`, ...additionalErrors]; } // emulator is already running From 64ede73730f393a605c7d64812cfe01901bc70f6 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Fri, 7 Jun 2019 13:21:54 +0300 Subject: [PATCH 2/4] fix: debugging on iOS Device is very slow Debugging on iOS Device is very slow with bundle workflow. The problem is in the way ios-device-lib handles the huge messages. Update the library to its latest version where this issue is resolved. --- npm-shrinkwrap.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index daee787035..bcdd9b67f6 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -3919,9 +3919,9 @@ "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=" }, "ios-device-lib": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/ios-device-lib/-/ios-device-lib-0.5.1.tgz", - "integrity": "sha512-HW96QpgGCCtg5E8rz+758FrieUbwqHFC7c2g6Al2kTIF2iaKBeVXZhONE8PoQPtpm+PrFBBkA9i4ZlyntS2FoA==", + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/ios-device-lib/-/ios-device-lib-0.5.2.tgz", + "integrity": "sha512-OSUcEkyS5AnoLs9g+oONIyPUOFHJNaSR93aep9QeLN6xkaY+fNqfUIIj45AQZDaFUpDcWiqiWr7gMOImqNcoYQ==", "requires": { "bufferpack": "0.0.6", "node-uuid": "1.4.7" diff --git a/package.json b/package.json index 7ac2c1091d..93304186f6 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "esprima": "2.7.0", "iconv-lite": "0.4.11", "inquirer": "6.2.0", - "ios-device-lib": "0.5.1", + "ios-device-lib": "0.5.2", "ios-mobileprovision-finder": "1.0.10", "ios-sim-portable": "4.0.9", "istextorbinary": "2.2.1", From fd003fa8aa17927a926cd079f0fc53e0546ba1ff Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Mon, 10 Jun 2019 22:16:29 +0300 Subject: [PATCH 3/4] fix: show deprecation message on tns init `tns init` command will be deleted in 6.0.0 release, so we need to show deprecation message when someone uses it. --- lib/commands/init.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/commands/init.ts b/lib/commands/init.ts index 36984c0dd6..85eb86a785 100644 --- a/lib/commands/init.ts +++ b/lib/commands/init.ts @@ -2,9 +2,11 @@ export class ProjectInitCommand implements ICommand { public allowedParameters: ICommandParameter[] = []; public enableHooks = false; - constructor(private $projectInitService: IProjectInitService) { } + constructor(private $logger: ILogger, + private $projectInitService: IProjectInitService) { } public async execute(args: string[]): Promise { + this.$logger.warn("This command is deprecated and it will be removed in the next major release of NativeScript"); return this.$projectInitService.initialize(); } } From 679e86d31eb1434bbe4727d18a0007dbb7adadd9 Mon Sep 17 00:00:00 2001 From: DimitarTachev Date: Tue, 11 Jun 2019 08:44:12 +0300 Subject: [PATCH 4/4] fix: disable the Webpack plugins which require the files from the file system as the Karma is compiling only in memory --- resources/test/karma.conf.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/test/karma.conf.js b/resources/test/karma.conf.js index 705b5a713e..e646ebb976 100644 --- a/resources/test/karma.conf.js +++ b/resources/test/karma.conf.js @@ -102,5 +102,7 @@ function setWebpack(config, options) { options.webpack = require('./webpack.config')(env); delete options.webpack.entry; delete options.webpack.output.libraryTarget; + const invalidPluginsForUnitTesting = ["GenerateBundleStarterPlugin", "GenerateNativeScriptEntryPointsPlugin"]; + options.webpack.plugins = options.webpack.plugins.filter(p => !invalidPluginsForUnitTesting.includes(p.constructor.name)); } }