Skip to content

chore: merge release into master #5206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jan 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
==

Expand Down
10 changes: 9 additions & 1 deletion lib/common/mobile/android/android-emulator-services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ describe("jsonFileSettingsService", () => {
const result = await new Promise((resolve, reject) => {
setTimeout(() => {
jsonFileSettingsService.getSettingValue<number>("prop1", { cacheTimeout: 1 }).then(resolve, reject);
}, 2);
}, 10);
});

assert.equal(result, null);
Expand Down
6 changes: 3 additions & 3 deletions lib/declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -798,10 +798,10 @@ interface IVersionsService {
getNativescriptCliVersion(): Promise<IVersionInformation>;

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

/**
* Gets versions information about nativescript runtimes.
Expand Down
2 changes: 2 additions & 0 deletions lib/services/android-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -242,6 +243,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
}

@performanceLog()
@hook('buildAndroid')
public async buildProject(projectRoot: string, projectData: IProjectData, buildData: IAndroidBuildData): Promise<void> {
const platformData = this.getPlatformData(projectData);
await this.$gradleBuildService.buildProject(platformData.projectRoot, buildData);
Expand Down
2 changes: 2 additions & 0 deletions lib/services/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<void> {
const platformData = this.getPlatformData(projectData);

Expand Down
39 changes: 32 additions & 7 deletions lib/services/versions-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,51 @@ class VersionsService implements IVersionsService {
};
}

public async getTnsCoreModulesVersion(): Promise<IVersionInformation> {
public async getTnsCoreModulesVersion(): Promise<IVersionInformation[]> {
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<IVersionInformation[]> {
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "nativescript",
"preferGlobal": true,
"version": "6.3.0",
"version": "6.3.3",
"author": "Telerik <[email protected]>",
"description": "Command-line interface for building NativeScript projects",
"bin": {
Expand Down Expand Up @@ -141,4 +141,4 @@
"engines": {
"node": ">=10.0.0 <14.0.0"
}
}
}
1 change: 1 addition & 0 deletions test/services/android-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down