Skip to content

Commit 056d5dc

Browse files
Merge pull request #5156 from NativeScript/fatme/use-tns-run
feat: improve the transition from preview to run command
2 parents f3b4be8 + 0c8bc50 commit 056d5dc

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

lib/services/livesync/playground/preview-app-plugins-service.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as util from "util";
44
import { Device } from "nativescript-preview-sdk";
55
import { PluginComparisonMessages } from "./preview-app-constants";
66
import { NODE_MODULES_DIR_NAME } from "../../../common/constants";
7-
import { PLATFORMS_DIR_NAME, PACKAGE_JSON_FILE_NAME, TNS_CORE_THEME_NAME, SCOPED_TNS_CORE_THEME_NAME } from "../../../constants";
7+
import { PLATFORMS_DIR_NAME, PACKAGE_JSON_FILE_NAME, TNS_CORE_THEME_NAME, SCOPED_TNS_CORE_THEME_NAME, LoggerConfigData } from "../../../constants";
88

99
export class PreviewAppPluginsService implements IPreviewAppPluginsService {
1010
constructor(private $errors: IErrors,
@@ -40,6 +40,11 @@ export class PreviewAppPluginsService implements IPreviewAppPluginsService {
4040
public async comparePluginsOnDevice(data: IPreviewAppLiveSyncData, device: Device): Promise<void> {
4141
const warnings = await this.getPluginsUsageWarnings(data, device);
4242
_.map(warnings, warning => this.$logger.warn(warning));
43+
44+
if (warnings && warnings.length) {
45+
this.$logger.warn(`In the app are used one or more NativeScript plugins with native dependencies.
46+
Those plugins will not work while building the project via \`$ tns preview\`. Please, use \`$ tns run <platform>\` command instead.`, { [LoggerConfigData.wrapMessageWithBorders]: true });
47+
}
4348
}
4449

4550
public getExternalPlugins(device: Device): string[] {

test/services/playground/preview-app-plugins-service.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ function createTestInjector(localPlugins: IStringDictionary, options?: { isNativ
4242
});
4343
injector.register("logger", {
4444
trace: () => ({}),
45-
warn: (message: string) => warnParams.push(message)
45+
warn: (message: string, opts: any) => {
46+
if (!opts || !opts.wrapMessageWithBorders) {
47+
warnParams.push(message);
48+
}
49+
}
4650
});
4751

4852
injector.register("packageInstallationManager", PackageInstallationManagerStub);

0 commit comments

Comments
 (0)