Skip to content

Commit

Permalink
Merge pull request #5156 from NativeScript/fatme/use-tns-run
Browse files Browse the repository at this point in the history
feat: improve the transition from preview to run command
  • Loading branch information
rosen-vladimirov authored Nov 26, 2019
2 parents f3b4be8 + 0c8bc50 commit 056d5dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
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

0 comments on commit 056d5dc

Please sign in to comment.