@@ -9,11 +9,20 @@ import { PLATFORMS_DIR_NAME, PACKAGE_JSON_FILE_NAME } from "../../../constants";
99export class PreviewAppPluginsService implements IPreviewAppPluginsService {
1010 private previewAppVersionWarnings : IDictionary < string [ ] > = { } ;
1111
12- constructor ( private $fs : IFileSystem ,
12+ constructor ( private $errors : IErrors ,
13+ private $fs : IFileSystem ,
1314 private $logger : ILogger ,
1415 private $pluginsService : IPluginsService ) { }
1516
16- public async comparePluginsOnDevice ( data : IPreviewAppLiveSyncData , device : Device ) : Promise < void > {
17+ public getPluginsUsageWarnings ( data : IPreviewAppLiveSyncData , device : Device ) : string [ ] {
18+ if ( ! device ) {
19+ this . $errors . failWithoutHelp ( "No device provided." ) ;
20+ }
21+
22+ if ( ! device . previewAppVersion ) {
23+ this . $errors . failWithoutHelp ( "No version of preview app provided." ) ;
24+ }
25+
1726 if ( ! this . previewAppVersionWarnings [ device . previewAppVersion ] ) {
1827 const devicePlugins = this . getDevicePlugins ( device ) ;
1928 const localPlugins = this . getLocalPlugins ( data . projectDir ) ;
@@ -27,7 +36,12 @@ export class PreviewAppPluginsService implements IPreviewAppPluginsService {
2736 this . previewAppVersionWarnings [ device . previewAppVersion ] = warnings ;
2837 }
2938
30- this . previewAppVersionWarnings [ device . previewAppVersion ] . map ( warning => this . $logger . warn ( warning ) ) ;
39+ return this . previewAppVersionWarnings [ device . previewAppVersion ] ;
40+ }
41+
42+ public async comparePluginsOnDevice ( data : IPreviewAppLiveSyncData , device : Device ) : Promise < void > {
43+ const warnings = this . getPluginsUsageWarnings ( data , device ) ;
44+ _ . map ( warnings , warning => this . $logger . warn ( warning ) ) ;
3145 }
3246
3347 public getExternalPlugins ( device : Device ) : string [ ] {
0 commit comments