@@ -4,12 +4,14 @@ import * as util from "util";
44import { Device } from "nativescript-preview-sdk" ;
55import { PluginComparisonMessages } from "./preview-app-constants" ;
66import { NODE_MODULES_DIR_NAME } from "../../../common/constants" ;
7+ import { PLATFORMS_DIR_NAME } from "../../../constants" ;
78
89export class PreviewAppPluginsService implements IPreviewAppPluginsService {
910 private previewAppVersionWarnings : IDictionary < string [ ] > = { } ;
1011
1112 constructor ( private $fs : IFileSystem ,
1213 private $logger : ILogger ,
14+ private $pluginsService : IPluginsService ,
1315 private $projectData : IProjectData ) { }
1416
1517 public async comparePluginsOnDevice ( data : IPreviewAppLiveSyncData , device : Device ) : Promise < void > {
@@ -91,17 +93,11 @@ export class PreviewAppPluginsService implements IPreviewAppPluginsService {
9193 }
9294
9395 private isNativeScriptPluginWithoutNativeCode ( localPlugin : string , platform : string ) : boolean {
94- return this . isNativeScriptPlugin ( localPlugin ) && ! this . hasNativeCode ( localPlugin , platform ) ;
95- }
96-
97- private isNativeScriptPlugin ( localPlugin : string ) : boolean {
98- const pluginPackageJsonPath = path . join ( this . $projectData . projectDir , NODE_MODULES_DIR_NAME , localPlugin , "package.json" ) ;
99- const pluginPackageJsonContent = this . $fs . readJson ( pluginPackageJsonPath ) ;
100- return pluginPackageJsonContent && pluginPackageJsonContent . nativescript ;
96+ return this . $pluginsService . isNativeScriptPlugin ( localPlugin , this . $projectData ) && ! this . hasNativeCode ( localPlugin , platform ) ;
10197 }
10298
10399 private hasNativeCode ( localPlugin : string , platform : string ) : boolean {
104- const nativeFolderPath = path . join ( this . $projectData . projectDir , NODE_MODULES_DIR_NAME , localPlugin , "platforms" , platform . toLowerCase ( ) ) ;
100+ const nativeFolderPath = path . join ( this . $projectData . projectDir , NODE_MODULES_DIR_NAME , localPlugin , PLATFORMS_DIR_NAME , platform . toLowerCase ( ) ) ;
105101 return this . $fs . exists ( nativeFolderPath ) && ! this . $fs . isEmptyDir ( nativeFolderPath ) ;
106102 }
107103}
0 commit comments