From 4d3746294be4421b47cdc798e3480501f18b8ed9 Mon Sep 17 00:00:00 2001 From: Daniel Diaz Date: Sun, 14 Oct 2018 19:29:07 -0700 Subject: [PATCH 1/2] chore(plugin.md) - Remove find and search commands from man pages --- docs/man_pages/lib-management/plugin.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/man_pages/lib-management/plugin.md b/docs/man_pages/lib-management/plugin.md index eaba35570d..6a739ccf63 100644 --- a/docs/man_pages/lib-management/plugin.md +++ b/docs/man_pages/lib-management/plugin.md @@ -17,8 +17,6 @@ Lets you manage the plugins for your project. * `add` - Installs the specified plugin and its dependencies. * `remove` - Uninstalls the specified plugin and its dependencies. * `update` - Uninstalls and installs the specified plugin(s) and its dependencies. -* `find` - Finds NativeScript plugins in npm. -* `search` - Finds NativeScript plugins in npm. * `build` - Builds the Android parts of a NativeScript plugin. * `create` - Creates a project for building a new NativeScript plugin. From f9cdbc63d3f8840d8a8e00baf4215873d9a7375b Mon Sep 17 00:00:00 2001 From: sis0k0 Date: Fri, 19 Oct 2018 12:41:37 +0300 Subject: [PATCH 2/2] fix(preview): skip check if local plugin version is invalid If the local version of the plugin cannot be parsed by `semver`, the check should be skipped and no warning shown. fixes #4043 --- .../playground/preview-app-plugins-service.ts | 25 +++++++++++-------- .../playground/preview-app-plugins-service.ts | 10 ++++++++ 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/lib/services/livesync/playground/preview-app-plugins-service.ts b/lib/services/livesync/playground/preview-app-plugins-service.ts index 41a2480cfd..ecf7fc0b57 100644 --- a/lib/services/livesync/playground/preview-app-plugins-service.ts +++ b/lib/services/livesync/playground/preview-app-plugins-service.ts @@ -74,20 +74,25 @@ export class PreviewAppPluginsService implements IPreviewAppPluginsService { private getWarningForPluginCore(localPlugin: string, localPluginVersion: string, devicePluginVersion: string, deviceId: string): string { this.$logger.trace(`Comparing plugin ${localPlugin} with localPluginVersion ${localPluginVersion} and devicePluginVersion ${devicePluginVersion}`); - if (devicePluginVersion) { - const localPluginVersionData = semver.coerce(localPluginVersion); - const devicePluginVersionData = semver.coerce(devicePluginVersion); - - if (localPluginVersionData.major !== devicePluginVersionData.major) { - return util.format(PluginComparisonMessages.LOCAL_PLUGIN_WITH_DIFFERENCE_IN_MAJOR_VERSION, localPlugin, localPluginVersion, devicePluginVersion); - } else if (localPluginVersionData.minor > devicePluginVersionData.minor) { - return util.format(PluginComparisonMessages.LOCAL_PLUGIN_WITH_GREATHER_MINOR_VERSION, localPlugin, localPluginVersion, devicePluginVersion); - } + if (!devicePluginVersion) { + return util.format(PluginComparisonMessages.PLUGIN_NOT_INCLUDED_IN_PREVIEW_APP, localPlugin, deviceId); + } + const shouldSkipCheck = !semver.valid(localPluginVersion) && !semver.validRange(localPluginVersion); + if (shouldSkipCheck) { return null; } - return util.format(PluginComparisonMessages.PLUGIN_NOT_INCLUDED_IN_PREVIEW_APP, localPlugin, deviceId); + const localPluginVersionData = semver.coerce(localPluginVersion); + const devicePluginVersionData = semver.coerce(devicePluginVersion); + + if (localPluginVersionData.major !== devicePluginVersionData.major) { + return util.format(PluginComparisonMessages.LOCAL_PLUGIN_WITH_DIFFERENCE_IN_MAJOR_VERSION, localPlugin, localPluginVersion, devicePluginVersion); + } else if (localPluginVersionData.minor > devicePluginVersionData.minor) { + return util.format(PluginComparisonMessages.LOCAL_PLUGIN_WITH_GREATHER_MINOR_VERSION, localPlugin, localPluginVersion, devicePluginVersion); + } + + return null; } private hasNativeCode(localPlugin: string, platform: string, projectDir: string): boolean { diff --git a/test/services/playground/preview-app-plugins-service.ts b/test/services/playground/preview-app-plugins-service.ts index 1b21282909..13087a0a7f 100644 --- a/test/services/playground/preview-app-plugins-service.ts +++ b/test/services/playground/preview-app-plugins-service.ts @@ -243,6 +243,16 @@ describe("previewAppPluginsService", () => { "nativescript-theme-core": "3.5.0" }, expectedWarnings: [] + }, + { + name: "should not show warning when the local plugin version is tag", + localPlugins: { + "tns-core-modules": "rc" + }, + previewAppPlugins: { + "tns-core-modules": "5.0.0" + }, + expectedWarnings: [] } ];