Skip to content
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

feat: improve the transition from preview to run command #5156

Merged
merged 2 commits into from
Nov 26, 2019
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