diff --git a/CHANGELOG.md b/CHANGELOG.md index 18aa3ae739..7f39b5bdf7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,41 @@ NativeScript CLI Changelog ================ + +6.3.2 (2020, January 9) +=== + +### Fixed + +* [Fixed #5200](https://github.com/NativeScript/nativescript-cli/issues/5200): api29 emulator is not recognized as latest + + +6.3.1 (2020, January 7) +=== + +### Fixed + +* [Fixed #5192](https://github.com/NativeScript/nativescript-cli/issues/5192): `tns info` command does not work with @nativescript/core + + +6.3.0 (2019, December 17) +=== + +### New + +* [Implemented #5128](https://github.com/NativeScript/nativescript-cli/issues/5128): Support for node v13 +* [Implemented #5155](https://github.com/NativeScript/nativescript-cli/issues/5155): Improve transition from tns preview to tns run +* [Implemented #5180](https://github.com/NativeScript/nativescript-cli/issues/5180): Cache the result of environment checks + +### Fixed + +* [Fixed #4982](https://github.com/NativeScript/nativescript-cli/issues/4982): `tns deploy` does not verify if the project should be migrated +* [Fixed #5069](https://github.com/NativeScript/nativescript-cli/issues/5069): Android API 29 emulator error +* [Fixed #5113](https://github.com/NativeScript/nativescript-cli/issues/5113): tns test init page does not list frameworks properly. +* [Fixed #5115](https://github.com/NativeScript/nativescript-cli/issues/5115): tns update command doesn't work in some plugins' demo apps +* [Fixed #5149](https://github.com/NativeScript/nativescript-cli/issues/5149): `tns update` should handle scoped packages +* [Fixed #5159](https://github.com/NativeScript/nativescript-cli/issues/5159): applyPluginsCocoaPods fails on case sensitive volumes +* [Fixed #5173](https://github.com/NativeScript/nativescript-cli/issues/5173): `--justlaunch` flag enables HMR + 6.2.2 (2019, November 22) == diff --git a/lib/common/mobile/android/android-emulator-services.ts b/lib/common/mobile/android/android-emulator-services.ts index a901981d19..414eeb1976 100644 --- a/lib/common/mobile/android/android-emulator-services.ts +++ b/lib/common/mobile/android/android-emulator-services.ts @@ -144,7 +144,15 @@ export class AndroidEmulatorServices implements Mobile.IEmulatorPlatformService } private getBestFit(emulators: Mobile.IDeviceInfo[]) { - const best = _(emulators).maxBy(emulator => emulator.version); + let best: Mobile.IDeviceInfo = null; + for (const emulator of emulators) { + const currentVersion = emulator.version && semver.coerce(emulator.version); + const currentBestVersion = best && best.version && semver.coerce(best.version); + if (!best || (currentVersion && currentBestVersion && semver.gt(currentVersion, currentBestVersion))) { + best = emulator; + } + } + const minVersion = semver.coerce(AndroidVirtualDevice.MIN_ANDROID_VERSION); const bestVersion = best && best.version && semver.coerce(best.version); diff --git a/lib/common/test/unit-tests/services/json-file-settings-service.ts b/lib/common/test/unit-tests/services/json-file-settings-service.ts index 2ca75d297f..a7e946fcb3 100644 --- a/lib/common/test/unit-tests/services/json-file-settings-service.ts +++ b/lib/common/test/unit-tests/services/json-file-settings-service.ts @@ -129,7 +129,7 @@ describe("jsonFileSettingsService", () => { const result = await new Promise((resolve, reject) => { setTimeout(() => { jsonFileSettingsService.getSettingValue("prop1", { cacheTimeout: 1 }).then(resolve, reject); - }, 2); + }, 10); }); assert.equal(result, null); diff --git a/lib/declarations.d.ts b/lib/declarations.d.ts index 71c137847e..7afd8d6e9b 100644 --- a/lib/declarations.d.ts +++ b/lib/declarations.d.ts @@ -798,10 +798,10 @@ interface IVersionsService { getNativescriptCliVersion(): Promise; /** - * Gets version information about tns-core-modules. - * @return {Promise} The version information. + * Gets version information about tns-core-modules and @nativescript/core packages. + * @return {Promise} The version information. */ - getTnsCoreModulesVersion(): Promise; + getTnsCoreModulesVersion(): Promise; /** * Gets versions information about nativescript runtimes. diff --git a/lib/services/android-project-service.ts b/lib/services/android-project-service.ts index e33ee726be..f7434c28cb 100644 --- a/lib/services/android-project-service.ts +++ b/lib/services/android-project-service.ts @@ -5,6 +5,7 @@ import * as semver from "semver"; import * as projectServiceBaseLib from "./platform-project-service-base"; import { DeviceAndroidDebugBridge } from "../common/mobile/android/device-android-debug-bridge"; import { Configurations, LiveSyncPaths } from "../common/constants"; +import { hook } from "../common/helpers"; import { performanceLog } from ".././common/decorators"; export class AndroidProjectService extends projectServiceBaseLib.PlatformProjectServiceBase { @@ -242,6 +243,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject } @performanceLog() + @hook('buildAndroid') public async buildProject(projectRoot: string, projectData: IProjectData, buildData: IAndroidBuildData): Promise { const platformData = this.getPlatformData(projectData); await this.$gradleBuildService.buildProject(platformData.projectRoot, buildData); diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index 6a0854c2fb..6046f970bb 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -14,6 +14,7 @@ import { IOSEntitlementsService } from "./ios-entitlements-service"; import { IOSBuildData } from "../data/build-data"; import { IOSPrepareData } from "../data/prepare-data"; import { BUILD_XCCONFIG_FILE_NAME, IosProjectConstants } from "../constants"; +import { hook } from "../common/helpers"; interface INativeSourceCodeGroup { name: string; @@ -193,6 +194,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ path.join(projectRoot, projectData.projectName)); } + @hook('buildIOS') public async buildProject(projectRoot: string, projectData: IProjectData, iOSBuildData: IOSBuildData): Promise { const platformData = this.getPlatformData(projectData); diff --git a/lib/services/versions-service.ts b/lib/services/versions-service.ts index 9f5ef644a2..865e4a8652 100644 --- a/lib/services/versions-service.ts +++ b/lib/services/versions-service.ts @@ -37,26 +37,51 @@ class VersionsService implements IVersionsService { }; } - public async getTnsCoreModulesVersion(): Promise { + public async getTnsCoreModulesVersion(): Promise { const latestTnsCoreModulesVersion = await this.$packageInstallationManager.getLatestVersion(constants.TNS_CORE_MODULES_NAME); const nativescriptCoreModulesInfo: IVersionInformation = { componentName: constants.TNS_CORE_MODULES_NAME, latestVersion: latestTnsCoreModulesVersion }; + const versionInformations: IVersionInformation[] = []; + if (this.projectData) { const nodeModulesPath = path.join(this.projectData.projectDir, constants.NODE_MODULES_FOLDER_NAME); + const scopedPackagePath = path.join(nodeModulesPath, constants.SCOPED_TNS_CORE_MODULES); const tnsCoreModulesPath = path.join(nodeModulesPath, constants.TNS_CORE_MODULES_NAME); + + const dependsOnNonScopedPackage = !!this.projectData.dependencies[constants.TNS_CORE_MODULES_NAME]; + const dependsOnScopedPackage = !!this.projectData.dependencies[constants.SCOPED_TNS_CORE_MODULES]; + + // ensure the dependencies are installed, so we can get their actual versions from node_modules if (!this.$fs.exists(nodeModulesPath) || - !this.$fs.exists(tnsCoreModulesPath)) { + (dependsOnNonScopedPackage && !this.$fs.exists(tnsCoreModulesPath)) || + (dependsOnScopedPackage && !this.$fs.exists(scopedPackagePath))) { await this.$pluginsService.ensureAllDependenciesAreInstalled(this.projectData); } - const currentTnsCoreModulesVersion = this.$fs.readJson(path.join(tnsCoreModulesPath, constants.PACKAGE_JSON_FILE_NAME)).version; - nativescriptCoreModulesInfo.currentVersion = currentTnsCoreModulesVersion; + if (dependsOnNonScopedPackage && this.$fs.exists(tnsCoreModulesPath)) { + const currentTnsCoreModulesVersion = this.$fs.readJson(path.join(tnsCoreModulesPath, constants.PACKAGE_JSON_FILE_NAME)).version; + nativescriptCoreModulesInfo.currentVersion = currentTnsCoreModulesVersion; + versionInformations.push(nativescriptCoreModulesInfo); + } + + if (dependsOnScopedPackage && this.$fs.exists(scopedPackagePath)) { + const scopedModulesInformation: IVersionInformation = { + componentName: constants.SCOPED_TNS_CORE_MODULES, + latestVersion: await this.$packageInstallationManager.getLatestVersion(constants.SCOPED_TNS_CORE_MODULES) + }; + + const currentScopedPackageVersion = this.$fs.readJson(path.join(scopedPackagePath, constants.PACKAGE_JSON_FILE_NAME)).version; + scopedModulesInformation.currentVersion = currentScopedPackageVersion; + versionInformations.push(scopedModulesInformation); + } + } else { + versionInformations.push(nativescriptCoreModulesInfo); } - return nativescriptCoreModulesInfo; + return versionInformations; } public async getRuntimesVersions(): Promise { @@ -101,9 +126,9 @@ class VersionsService implements IVersionsService { } if (this.projectData) { - const nativescriptCoreModulesInformation: IVersionInformation = await this.getTnsCoreModulesVersion(); + const nativescriptCoreModulesInformation: IVersionInformation[] = await this.getTnsCoreModulesVersion(); if (nativescriptCoreModulesInformation) { - allComponents.push(nativescriptCoreModulesInformation); + allComponents.push(...nativescriptCoreModulesInformation); } const runtimesVersions: IVersionInformation[] = await this.getRuntimesVersions(); diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index f39f776b37..eb1117574b 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "nativescript", - "version": "6.3.0", + "version": "6.3.3", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -8389,4 +8389,4 @@ "integrity": "sha512-99p+ohUBZ2Es0AXrw/tpazMcJ0/acpdQXr0UPrVWF0p7i8XiOYvjiXTdwXUVCTPopBGCSDtWBzOoYNPtF3z/8w==" } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 6138919847..612a03d301 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "nativescript", "preferGlobal": true, - "version": "6.3.0", + "version": "6.3.3", "author": "Telerik ", "description": "Command-line interface for building NativeScript projects", "bin": { @@ -141,4 +141,4 @@ "engines": { "node": ">=10.0.0 <14.0.0" } -} +} \ No newline at end of file diff --git a/test/services/android-project-service.ts b/test/services/android-project-service.ts index b541c182a4..13cddd66ce 100644 --- a/test/services/android-project-service.ts +++ b/test/services/android-project-service.ts @@ -11,6 +11,7 @@ import { GradleBuildArgsService } from "../../lib/services/android/gradle-build- const createTestInjector = (): IInjector => { const testInjector = new Yok(); testInjector.register("androidProjectService", AndroidProjectService); + testInjector.register("hooksService", stubs.HooksServiceStub); testInjector.register("childProcess", stubs.ChildProcessStub); testInjector.register("hostInfo", {}); testInjector.register("projectDataService", stubs.ProjectDataService);