From 98d3ecbacd10d8b9dc76109f31b5b703ecb247a1 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Thu, 7 Feb 2019 16:44:36 +0200 Subject: [PATCH 1/7] docs: add missing resources command in index --- docs/man_pages/index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/man_pages/index.md b/docs/man_pages/index.md index 76fc7c0684..542395e2ea 100644 --- a/docs/man_pages/index.md +++ b/docs/man_pages/index.md @@ -33,7 +33,9 @@ Command | Description [platform list](project/configuration/platform.html) | Lists all platforms that the project currently targets. [platform remove ``](project/configuration/platform-remove.html) | Removes the selected platform from the platforms that the project currently targets. This operation deletes all platform-specific files and subdirectories from your project. [platform update ``](project/configuration/platform-update.html) | Updates the NativeScript runtime for the specified platform. -[resources update](project/configuration/resources-update.html) | Updates the App_Resources/'s internal folder structure to conform to that of an Android Studio project. +[resources update](project/configuration/resources/resources-update.html) | Updates the App_Resources/'s internal folder structure to conform to that of an Android Studio project. +[resources generate splashes](project/configuration/resources/resources-generate-splashes.html) | Generates all splashscreens for Android and iOS platforms and places the generated images in the correct directories under `App_Resources/` directory. +[resources generate icons](project/configuration/resources/resources-generate-icons.html) | Generates all icons for Android and iOS platforms and places the generated images in the correct directories under `App_Resources/` directory. [prepare ``](project/configuration/prepare.html) | Copies relevant content from the app directory to the subdirectory for the selected target platform to let you build the project. [build ``](project/testing/build.html) | Builds the project for the selected target platform and produces an application package or an emulator package. [deploy ``](project/testing/deploy.html) | Deploys the project to a connected physical or virtual device. From b5af6e689d6379064e7244f4e09fff453ccf72f3 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Thu, 7 Feb 2019 11:33:42 +0200 Subject: [PATCH 2/7] chore: set version to 5.2.1 --- npm-shrinkwrap.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index d339813092..ae4eb31946 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "nativescript", - "version": "5.2.0", + "version": "5.2.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 32393055df..09f2808420 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "nativescript", "preferGlobal": true, - "version": "5.2.0", + "version": "5.2.1", "author": "Telerik ", "description": "Command-line interface for building NativeScript projects", "bin": { From 546d4a3089c1fddbea03902abd52a86cf64b6b09 Mon Sep 17 00:00:00 2001 From: DimitarTachev Date: Fri, 8 Feb 2019 13:50:12 +0200 Subject: [PATCH 3/7] fix: shouldRestart will now return true if the app is not running instead of throwing an exception --- lib/services/livesync/ios-device-livesync-service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/services/livesync/ios-device-livesync-service.ts b/lib/services/livesync/ios-device-livesync-service.ts index 9239eb4d53..37494537df 100644 --- a/lib/services/livesync/ios-device-livesync-service.ts +++ b/lib/services/livesync/ios-device-livesync-service.ts @@ -24,7 +24,12 @@ export class IOSDeviceLiveSyncService extends DeviceLiveSyncServiceBase implemen } const appId = projectData.projectIdentifiers.ios; - this.socket = await this.device.getDebugSocket(appId, projectData.projectName); + try { + this.socket = await this.device.getDebugSocket(appId, projectData.projectName); + } catch (err) { + this.$logger.trace(`Error while connecting to the debug socket. Error is:`, err); + } + if (!this.socket) { return false; } From 0de062262da11ad5fb1dd7f47b5bbcf4c12a4aa0 Mon Sep 17 00:00:00 2001 From: DimitarTachev Date: Fri, 8 Feb 2019 15:56:35 +0200 Subject: [PATCH 4/7] fix: update lodash because of "a potential security vulnerability" --- 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 ae4eb31946..e925e0edf5 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -4217,9 +4217,9 @@ "integrity": "sha1-Jjj8OaAzHpysGgS3F5mTHJxQ33k=" }, "lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" }, "lodash-node": { "version": "2.4.1", diff --git a/package.json b/package.json index 09f2808420..ec598951b5 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "istextorbinary": "2.2.1", "jimp": "0.2.28", "lockfile": "1.0.3", - "lodash": "4.17.10", + "lodash": "4.17.11", "log4js": "1.0.1", "marked": "0.5.1", "marked-terminal": "3.1.1", From 4ed85f0d9622432281eb9aad4ad161121cfd3d94 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Mon, 11 Feb 2019 13:21:19 +0200 Subject: [PATCH 5/7] docs: update CHANGELOG for 5.2.0 --- CHANGELOG.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d968a248d4..ba86f840e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,33 @@ NativeScript CLI Changelog ================ + +5.2.0 (2018, February 13) +== + +### Implemented +* [Implemented #3807](https://github.com/NativeScript/nativescript-cli/issues/3807): Enable app Podfile +* [Implemented #4243](https://github.com/NativeScript/nativescript-cli/issues/4243): CLI command steps profiling and performance analytics +* [Implemented #4305](https://github.com/NativeScript/nativescript-cli/issues/4305): Add official support for Node.js 11 +* [Implemented #4313](https://github.com/NativeScript/nativescript-cli/issues/4313): Track how many users used {N} CLI and Playground +* [Implemented #4323](https://github.com/NativeScript/nativescript-cli/issues/4323): Skip CLI's postinstall in case it is not installed globally +* [Implemented #4325](https://github.com/NativeScript/nativescript-cli/issues/4325): Angular apps should work with HMR out of the box +* [Implemented #4343](https://github.com/NativeScript/nativescript-cli/issues/4343): Support Objective-C code in App Resources for iOS applications + +### Fixed +* [Fixed #3122](https://github.com/NativeScript/nativescript-cli/issues/3122): `tns debug ios --debug-brk` fails the majority of the time +* [Fixed #3161](https://github.com/NativeScript/nativescript-cli/issues/3161): `tns test` command fails to find a running iOS simulator +* [Fixed #4232](https://github.com/NativeScript/nativescript-cli/issues/4232): Unit testing for freshly created angular project is broken on Android emulator +* [Fixed #4253](https://github.com/NativeScript/nativescript-cli/issues/4253): LiveSync stops working in Preview app when make change in scss file +* [Fixed #4255](https://github.com/NativeScript/nativescript-cli/issues/4255): Uninstalling NativeScript should also remove its extensions +* [Fixed #4283](https://github.com/NativeScript/nativescript-cli/issues/4283): `tns run android` fails with private npm registry +* [Fixed #4300](https://github.com/NativeScript/nativescript-cli/issues/4300): Strange logs after project built for Android +* [Fixed #4311](https://github.com/NativeScript/nativescript-cli/issues/4311): [iOS] Build with nativescript-plugin-firebase requires legacy build system +* [Fixed #4324](https://github.com/NativeScript/nativescript-cli/issues/4324): High CPU utilization during `tns run` +* [Fixed #4327](https://github.com/NativeScript/nativescript-cli/issues/4327): `tns devices --availableDevices` prompts to install Xcode command line tools +* [Fixed #4347](https://github.com/NativeScript/nativescript-cli/issues/4347): `tns resources generate splashes ` fails for newly created project + + 5.1.1 (2019, January 17) == From 6caa482c345626eebb8782fda216f3397a9a9bc2 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Mon, 11 Feb 2019 17:42:00 +0200 Subject: [PATCH 6/7] fix: cli's local adb is not used In case there's no ANDROI_HOME on user's machine, CLI tries to use its local copy of adb. However, the current path to adb is not correct and CLI does not work with any Android devices in this case. Fix the path to local copy of adb. --- lib/config.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/config.ts b/lib/config.ts index 9c43b70a30..4a3d7ceecd 100644 --- a/lib/config.ts +++ b/lib/config.ts @@ -156,10 +156,10 @@ export class StaticConfig implements IStaticConfig { $hostInfo: IHostInfo = this.$injector.resolve("$hostInfo"); // prepare the directory to host our copy of adb - const defaultAdbDirPath = path.join(__dirname, `resources/platform-tools/android/${process.platform}`); - const pathToPackageJson = path.join(__dirname, "..", "..", "package.json"); - const commonLibVersion = require(pathToPackageJson).version; - const tmpDir = path.join(os.tmpdir(), `telerik-common-lib-${commonLibVersion}`); + const defaultAdbDirPath = path.join(__dirname, "common", "resources", "platform-tools", "android", process.platform); + const pathToPackageJson = path.join(__dirname, "..", "package.json"); + const nsCliVersion = require(pathToPackageJson).version; + const tmpDir = path.join(os.tmpdir(), `nativescript-cli-${nsCliVersion}`); $fs.createDirectory(tmpDir); // copy the adb and associated files From 20874b4305f76d531876f174fa3aab385bf763eb Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Wed, 13 Feb 2019 16:57:42 +0200 Subject: [PATCH 7/7] chore: skip tns_modules cleanup from CLI In case `--bundle` is passed CLI tries to clean the `tns_modules` directory produced from previous prepare operations. However, this is not required in latest versions as webpack cleans the directory on its own. The current clean was required for Webpack before 0.14.0, particularly the one used with 3.x versions of NativeScript. Delete unit test that is no longer relevant, as it tests functionality that is now handled by `nativescript-dev-webpack` plugin. --- lib/definitions/platform.d.ts | 1 - .../node-modules/node-modules-builder.ts | 24 +++++-------------- test/npm-support.ts | 22 ----------------- 3 files changed, 6 insertions(+), 41 deletions(-) diff --git a/lib/definitions/platform.d.ts b/lib/definitions/platform.d.ts index 5d29921748..ac8874cea1 100644 --- a/lib/definitions/platform.d.ts +++ b/lib/definitions/platform.d.ts @@ -284,7 +284,6 @@ interface INodeModulesBuilderData { interface INodeModulesBuilder { prepareNodeModules(opts: INodeModulesBuilderData): Promise; prepareJSNodeModules(opts: INodeModulesBuilderData): Promise; - cleanNodeModules(absoluteOutputPath: string): void; } interface INodeModulesDependenciesBuilder { diff --git a/lib/tools/node-modules/node-modules-builder.ts b/lib/tools/node-modules/node-modules-builder.ts index aad4a34fdd..17f1c27317 100644 --- a/lib/tools/node-modules/node-modules-builder.ts +++ b/lib/tools/node-modules/node-modules-builder.ts @@ -1,4 +1,3 @@ -import * as shelljs from "shelljs"; import { TnsModulesCopy, NpmPluginPrepare } from "./node-modules-dest-copy"; export class NodeModulesBuilder implements INodeModulesBuilder { @@ -23,20 +22,14 @@ export class NodeModulesBuilder implements INodeModulesBuilder { const { nodeModulesData } = opts; const productionDependencies = this.$nodeModulesDependenciesBuilder.getProductionDependencies(nodeModulesData.projectData.projectDir); - if (opts.copyNodeModules) { + if (opts.copyNodeModules && !nodeModulesData.appFilesUpdaterOptions.bundle) { this.initialPrepareNodeModules(opts, productionDependencies); - } else if (nodeModulesData.appFilesUpdaterOptions.bundle) { - this.cleanNodeModules(nodeModulesData.absoluteOutputPath); } return productionDependencies; } - public cleanNodeModules(absoluteOutputPath: string): void { - shelljs.rm("-rf", absoluteOutputPath); - } - - private initialPrepareNodeModules(opts: INodeModulesBuilderData, productionDependencies: IDependencyData[]): IDependencyData[] { + private initialPrepareNodeModules(opts: INodeModulesBuilderData, productionDependencies: IDependencyData[]): void { const { nodeModulesData, release } = opts; if (!this.$fs.exists(nodeModulesData.absoluteOutputPath)) { @@ -44,16 +37,11 @@ export class NodeModulesBuilder implements INodeModulesBuilder { nodeModulesData.lastModifiedTime = null; } - if (!nodeModulesData.appFilesUpdaterOptions.bundle) { - const tnsModulesCopy: TnsModulesCopy = this.$injector.resolve(TnsModulesCopy, { - outputRoot: nodeModulesData.absoluteOutputPath - }); - tnsModulesCopy.copyModules({ dependencies: productionDependencies, release }); - } else { - this.cleanNodeModules(nodeModulesData.absoluteOutputPath); - } + const tnsModulesCopy: TnsModulesCopy = this.$injector.resolve(TnsModulesCopy, { + outputRoot: nodeModulesData.absoluteOutputPath + }); - return productionDependencies; + tnsModulesCopy.copyModules({ dependencies: productionDependencies, release }); } } diff --git a/test/npm-support.ts b/test/npm-support.ts index e917bf4dd3..cb6bb86eed 100644 --- a/test/npm-support.ts +++ b/test/npm-support.ts @@ -294,28 +294,6 @@ describe("Npm support tests", () => { assert.isTrue(filteredResults.length === 1); }); - - it("Ensures that tns_modules absent when bundling", async () => { - const fs = testInjector.resolve("fs"); - const options = testInjector.resolve("options"); - const tnsModulesFolderPath = path.join(appDestinationFolderPath, "app", "tns_modules"); - - try { - options.bundle = false; - await preparePlatform(testInjector); - assert.isTrue(fs.exists(tnsModulesFolderPath), "tns_modules created first"); - - options.bundle = true; - await preparePlatform(testInjector); - assert.isFalse(fs.exists(tnsModulesFolderPath), "tns_modules deleted when bundling"); - - options.bundle = false; - await preparePlatform(testInjector); - assert.isTrue(fs.exists(tnsModulesFolderPath), "tns_modules recreated"); - } finally { - options.bundle = false; - } - }); }); describe("Flatten npm modules tests", () => {