Skip to content

Commit c71fbf9

Browse files
author
Dimitar Tachev
authored
Merge pull request #5206 from NativeScript/release
chore: merge release into master
2 parents 7c692ee + 188bc75 commit c71fbf9

10 files changed

+90
-16
lines changed

CHANGELOG.md

+36
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,41 @@
11
NativeScript CLI Changelog
22
================
3+
4+
6.3.2 (2020, January 9)
5+
===
6+
7+
### Fixed
8+
9+
* [Fixed #5200](https://github.com/NativeScript/nativescript-cli/issues/5200): api29 emulator is not recognized as latest
10+
11+
12+
6.3.1 (2020, January 7)
13+
===
14+
15+
### Fixed
16+
17+
* [Fixed #5192](https://github.com/NativeScript/nativescript-cli/issues/5192): `tns info` command does not work with @nativescript/core
18+
19+
20+
6.3.0 (2019, December 17)
21+
===
22+
23+
### New
24+
25+
* [Implemented #5128](https://github.com/NativeScript/nativescript-cli/issues/5128): Support for node v13
26+
* [Implemented #5155](https://github.com/NativeScript/nativescript-cli/issues/5155): Improve transition from tns preview to tns run
27+
* [Implemented #5180](https://github.com/NativeScript/nativescript-cli/issues/5180): Cache the result of environment checks
28+
29+
### Fixed
30+
31+
* [Fixed #4982](https://github.com/NativeScript/nativescript-cli/issues/4982): `tns deploy` does not verify if the project should be migrated
32+
* [Fixed #5069](https://github.com/NativeScript/nativescript-cli/issues/5069): Android API 29 emulator error
33+
* [Fixed #5113](https://github.com/NativeScript/nativescript-cli/issues/5113): tns test init page does not list frameworks properly.
34+
* [Fixed #5115](https://github.com/NativeScript/nativescript-cli/issues/5115): tns update command doesn't work in some plugins' demo apps
35+
* [Fixed #5149](https://github.com/NativeScript/nativescript-cli/issues/5149): `tns update` should handle scoped packages
36+
* [Fixed #5159](https://github.com/NativeScript/nativescript-cli/issues/5159): applyPluginsCocoaPods fails on case sensitive volumes
37+
* [Fixed #5173](https://github.com/NativeScript/nativescript-cli/issues/5173): `--justlaunch` flag enables HMR
38+
339
6.2.2 (2019, November 22)
440
==
541

lib/common/mobile/android/android-emulator-services.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,15 @@ export class AndroidEmulatorServices implements Mobile.IEmulatorPlatformService
144144
}
145145

146146
private getBestFit(emulators: Mobile.IDeviceInfo[]) {
147-
const best = _(emulators).maxBy(emulator => emulator.version);
147+
let best: Mobile.IDeviceInfo = null;
148+
for (const emulator of emulators) {
149+
const currentVersion = emulator.version && semver.coerce(emulator.version);
150+
const currentBestVersion = best && best.version && semver.coerce(best.version);
151+
if (!best || (currentVersion && currentBestVersion && semver.gt(currentVersion, currentBestVersion))) {
152+
best = emulator;
153+
}
154+
}
155+
148156
const minVersion = semver.coerce(AndroidVirtualDevice.MIN_ANDROID_VERSION);
149157
const bestVersion = best && best.version && semver.coerce(best.version);
150158

lib/common/test/unit-tests/services/json-file-settings-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ describe("jsonFileSettingsService", () => {
129129
const result = await new Promise((resolve, reject) => {
130130
setTimeout(() => {
131131
jsonFileSettingsService.getSettingValue<number>("prop1", { cacheTimeout: 1 }).then(resolve, reject);
132-
}, 2);
132+
}, 10);
133133
});
134134

135135
assert.equal(result, null);

lib/declarations.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -798,10 +798,10 @@ interface IVersionsService {
798798
getNativescriptCliVersion(): Promise<IVersionInformation>;
799799

800800
/**
801-
* Gets version information about tns-core-modules.
802-
* @return {Promise<IVersionInformation>} The version information.
801+
* Gets version information about tns-core-modules and @nativescript/core packages.
802+
* @return {Promise<IVersionInformation[]>} The version information.
803803
*/
804-
getTnsCoreModulesVersion(): Promise<IVersionInformation>;
804+
getTnsCoreModulesVersion(): Promise<IVersionInformation[]>;
805805

806806
/**
807807
* Gets versions information about nativescript runtimes.

lib/services/android-project-service.ts

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as semver from "semver";
55
import * as projectServiceBaseLib from "./platform-project-service-base";
66
import { DeviceAndroidDebugBridge } from "../common/mobile/android/device-android-debug-bridge";
77
import { Configurations, LiveSyncPaths } from "../common/constants";
8+
import { hook } from "../common/helpers";
89
import { performanceLog } from ".././common/decorators";
910

1011
export class AndroidProjectService extends projectServiceBaseLib.PlatformProjectServiceBase {
@@ -242,6 +243,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
242243
}
243244

244245
@performanceLog()
246+
@hook('buildAndroid')
245247
public async buildProject(projectRoot: string, projectData: IProjectData, buildData: IAndroidBuildData): Promise<void> {
246248
const platformData = this.getPlatformData(projectData);
247249
await this.$gradleBuildService.buildProject(platformData.projectRoot, buildData);

lib/services/ios-project-service.ts

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { IOSEntitlementsService } from "./ios-entitlements-service";
1414
import { IOSBuildData } from "../data/build-data";
1515
import { IOSPrepareData } from "../data/prepare-data";
1616
import { BUILD_XCCONFIG_FILE_NAME, IosProjectConstants } from "../constants";
17+
import { hook } from "../common/helpers";
1718

1819
interface INativeSourceCodeGroup {
1920
name: string;
@@ -200,6 +201,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
200201
path.join(projectRoot, projectData.projectName));
201202
}
202203

204+
@hook('buildIOS')
203205
public async buildProject(projectRoot: string, projectData: IProjectData, iOSBuildData: IOSBuildData): Promise<void> {
204206
const platformData = this.getPlatformData(projectData);
205207

lib/services/versions-service.ts

+32-7
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,51 @@ class VersionsService implements IVersionsService {
3737
};
3838
}
3939

40-
public async getTnsCoreModulesVersion(): Promise<IVersionInformation> {
40+
public async getTnsCoreModulesVersion(): Promise<IVersionInformation[]> {
4141
const latestTnsCoreModulesVersion = await this.$packageInstallationManager.getLatestVersion(constants.TNS_CORE_MODULES_NAME);
4242
const nativescriptCoreModulesInfo: IVersionInformation = {
4343
componentName: constants.TNS_CORE_MODULES_NAME,
4444
latestVersion: latestTnsCoreModulesVersion
4545
};
4646

47+
const versionInformations: IVersionInformation[] = [];
48+
4749
if (this.projectData) {
4850
const nodeModulesPath = path.join(this.projectData.projectDir, constants.NODE_MODULES_FOLDER_NAME);
51+
const scopedPackagePath = path.join(nodeModulesPath, constants.SCOPED_TNS_CORE_MODULES);
4952
const tnsCoreModulesPath = path.join(nodeModulesPath, constants.TNS_CORE_MODULES_NAME);
53+
54+
const dependsOnNonScopedPackage = !!this.projectData.dependencies[constants.TNS_CORE_MODULES_NAME];
55+
const dependsOnScopedPackage = !!this.projectData.dependencies[constants.SCOPED_TNS_CORE_MODULES];
56+
57+
// ensure the dependencies are installed, so we can get their actual versions from node_modules
5058
if (!this.$fs.exists(nodeModulesPath) ||
51-
!this.$fs.exists(tnsCoreModulesPath)) {
59+
(dependsOnNonScopedPackage && !this.$fs.exists(tnsCoreModulesPath)) ||
60+
(dependsOnScopedPackage && !this.$fs.exists(scopedPackagePath))) {
5261
await this.$pluginsService.ensureAllDependenciesAreInstalled(this.projectData);
5362
}
5463

55-
const currentTnsCoreModulesVersion = this.$fs.readJson(path.join(tnsCoreModulesPath, constants.PACKAGE_JSON_FILE_NAME)).version;
56-
nativescriptCoreModulesInfo.currentVersion = currentTnsCoreModulesVersion;
64+
if (dependsOnNonScopedPackage && this.$fs.exists(tnsCoreModulesPath)) {
65+
const currentTnsCoreModulesVersion = this.$fs.readJson(path.join(tnsCoreModulesPath, constants.PACKAGE_JSON_FILE_NAME)).version;
66+
nativescriptCoreModulesInfo.currentVersion = currentTnsCoreModulesVersion;
67+
versionInformations.push(nativescriptCoreModulesInfo);
68+
}
69+
70+
if (dependsOnScopedPackage && this.$fs.exists(scopedPackagePath)) {
71+
const scopedModulesInformation: IVersionInformation = {
72+
componentName: constants.SCOPED_TNS_CORE_MODULES,
73+
latestVersion: await this.$packageInstallationManager.getLatestVersion(constants.SCOPED_TNS_CORE_MODULES)
74+
};
75+
76+
const currentScopedPackageVersion = this.$fs.readJson(path.join(scopedPackagePath, constants.PACKAGE_JSON_FILE_NAME)).version;
77+
scopedModulesInformation.currentVersion = currentScopedPackageVersion;
78+
versionInformations.push(scopedModulesInformation);
79+
}
80+
} else {
81+
versionInformations.push(nativescriptCoreModulesInfo);
5782
}
5883

59-
return nativescriptCoreModulesInfo;
84+
return versionInformations;
6085
}
6186

6287
public async getRuntimesVersions(): Promise<IVersionInformation[]> {
@@ -101,9 +126,9 @@ class VersionsService implements IVersionsService {
101126
}
102127

103128
if (this.projectData) {
104-
const nativescriptCoreModulesInformation: IVersionInformation = await this.getTnsCoreModulesVersion();
129+
const nativescriptCoreModulesInformation: IVersionInformation[] = await this.getTnsCoreModulesVersion();
105130
if (nativescriptCoreModulesInformation) {
106-
allComponents.push(nativescriptCoreModulesInformation);
131+
allComponents.push(...nativescriptCoreModulesInformation);
107132
}
108133

109134
const runtimesVersions: IVersionInformation[] = await this.getRuntimesVersions();

npm-shrinkwrap.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "nativescript",
33
"preferGlobal": true,
4-
"version": "6.3.0",
4+
"version": "6.3.3",
55
"author": "Telerik <[email protected]>",
66
"description": "Command-line interface for building NativeScript projects",
77
"bin": {
@@ -141,4 +141,4 @@
141141
"engines": {
142142
"node": ">=10.0.0 <14.0.0"
143143
}
144-
}
144+
}

test/services/android-project-service.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { GradleBuildArgsService } from "../../lib/services/android/gradle-build-
1111
const createTestInjector = (): IInjector => {
1212
const testInjector = new Yok();
1313
testInjector.register("androidProjectService", AndroidProjectService);
14+
testInjector.register("hooksService", stubs.HooksServiceStub);
1415
testInjector.register("childProcess", stubs.ChildProcessStub);
1516
testInjector.register("hostInfo", {});
1617
testInjector.register("projectDataService", stubs.ProjectDataService);

0 commit comments

Comments
 (0)