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. 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: [] } ];