Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as util from "util";
import { Device } from "nativescript-preview-sdk";
import { PluginComparisonMessages } from "./preview-app-constants";
import { NODE_MODULES_DIR_NAME } from "../../../common/constants";
import { PLATFORMS_DIR_NAME, PACKAGE_JSON_FILE_NAME, TNS_CORE_THEME_NAME, SCOPED_TNS_CORE_THEME_NAME } from "../../../constants";
import { PLATFORMS_DIR_NAME, PACKAGE_JSON_FILE_NAME, TNS_CORE_THEME_NAME, SCOPED_TNS_CORE_THEME_NAME, LoggerConfigData } from "../../../constants";

export class PreviewAppPluginsService implements IPreviewAppPluginsService {
constructor(private $errors: IErrors,
Expand Down Expand Up @@ -40,6 +40,11 @@ export class PreviewAppPluginsService implements IPreviewAppPluginsService {
public async comparePluginsOnDevice(data: IPreviewAppLiveSyncData, device: Device): Promise<void> {
const warnings = await this.getPluginsUsageWarnings(data, device);
_.map(warnings, warning => this.$logger.warn(warning));

if (warnings && warnings.length) {
this.$logger.warn(`In the app are used one or more NativeScript plugins with native dependencies.
Those plugins will not work while building the project via \`$ tns preview\`. Please, use \`$ tns run <platform>\` command instead.`, { [LoggerConfigData.wrapMessageWithBorders]: true });
}
}

public getExternalPlugins(device: Device): string[] {
Expand Down
6 changes: 5 additions & 1 deletion test/services/playground/preview-app-plugins-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ function createTestInjector(localPlugins: IStringDictionary, options?: { isNativ
});
injector.register("logger", {
trace: () => ({}),
warn: (message: string) => warnParams.push(message)
warn: (message: string, opts: any) => {
if (!opts || !opts.wrapMessageWithBorders) {
warnParams.push(message);
}
}
});

injector.register("packageInstallationManager", PackageInstallationManagerStub);
Expand Down