@@ -74,53 +74,55 @@ export class PluginsService implements IPluginsService {
7474
7575 let action = ( pluginDestinationPath : string , platform : string , platformData : IPlatformData ) => {
7676 return ( ( ) => {
77- // Process .js files
78- let installedFrameworkVersion = this . getInstalledFrameworkVersion ( platform ) . wait ( ) ;
79- let pluginPlatformsData = pluginData . platformsData ;
80- if ( pluginPlatformsData ) {
81- let pluginVersion = ( < any > pluginPlatformsData ) [ platform ] ;
82- if ( ! pluginVersion ) {
83- this . $logger . warn ( `${ pluginData . name } is not supported for ${ platform } .` ) ;
84- return ;
77+ if ( this . $fs . exists ( path . join ( platformData . appDestinationDirectoryPath , constants . APP_FOLDER_NAME ) ) . wait ( ) ) {
78+ // Process .js files
79+ let installedFrameworkVersion = this . getInstalledFrameworkVersion ( platform ) . wait ( ) ;
80+ let pluginPlatformsData = pluginData . platformsData ;
81+ if ( pluginPlatformsData ) {
82+ let pluginVersion = ( < any > pluginPlatformsData ) [ platform ] ;
83+ if ( ! pluginVersion ) {
84+ this . $logger . warn ( `${ pluginData . name } is not supported for ${ platform } .` ) ;
85+ return ;
86+ }
87+
88+ if ( semver . gt ( pluginVersion , installedFrameworkVersion ) ) {
89+ this . $logger . warn ( `${ pluginData . name } ${ pluginVersion } for ${ platform } is not compatible with the currently installed framework version ${ installedFrameworkVersion } .` ) ;
90+ return ;
91+ }
8592 }
8693
87- if ( semver . gt ( pluginVersion , installedFrameworkVersion ) ) {
88- this . $logger . warn ( `${ pluginData . name } ${ pluginVersion } for ${ platform } is not compatible with the currently installed framework version ${ installedFrameworkVersion } .` ) ;
89- return ;
90- }
91- }
92-
93- this . $fs . ensureDirectoryExists ( pluginDestinationPath ) . wait ( ) ;
94- shelljs . cp ( "-Rf" , pluginData . fullPath , pluginDestinationPath ) ;
94+ this . $fs . ensureDirectoryExists ( pluginDestinationPath ) . wait ( ) ;
95+ shelljs . cp ( "-Rf" , pluginData . fullPath , pluginDestinationPath ) ;
9596
96- let pluginPlatformsFolderPath = path . join ( pluginDestinationPath , pluginData . name , "platforms" , platform ) ;
97- let pluginConfigurationFilePath = path . join ( pluginPlatformsFolderPath , platformData . configurationFileName ) ;
98- let configurationFilePath = platformData . configurationFilePath ;
97+ let pluginPlatformsFolderPath = path . join ( pluginDestinationPath , pluginData . name , "platforms" , platform ) ;
98+ let pluginConfigurationFilePath = path . join ( pluginPlatformsFolderPath , platformData . configurationFileName ) ;
99+ let configurationFilePath = platformData . configurationFilePath ;
99100
100- if ( this . $fs . exists ( pluginConfigurationFilePath ) . wait ( ) ) {
101- // Validate plugin configuration file
102- let pluginConfigurationFileContent = this . $fs . readText ( pluginConfigurationFilePath ) . wait ( ) ;
103- this . validateXml ( pluginConfigurationFileContent , pluginConfigurationFilePath ) ;
101+ if ( this . $fs . exists ( pluginConfigurationFilePath ) . wait ( ) ) {
102+ // Validate plugin configuration file
103+ let pluginConfigurationFileContent = this . $fs . readText ( pluginConfigurationFilePath ) . wait ( ) ;
104+ this . validateXml ( pluginConfigurationFileContent , pluginConfigurationFilePath ) ;
104105
105- // Validate configuration file
106- let configurationFileContent = this . $fs . readText ( configurationFilePath ) . wait ( ) ;
107- this . validateXml ( configurationFileContent , configurationFilePath ) ;
106+ // Validate configuration file
107+ let configurationFileContent = this . $fs . readText ( configurationFilePath ) . wait ( ) ;
108+ this . validateXml ( configurationFileContent , configurationFilePath ) ;
108109
109- // Merge xml
110- let resultXml = this . mergeXml ( configurationFileContent , pluginConfigurationFileContent , platformData . mergeXmlConfig || [ ] ) . wait ( ) ;
111- this . validateXml ( resultXml ) ;
112- this . $fs . writeFile ( configurationFilePath , resultXml ) . wait ( ) ;
113- }
110+ // Merge xml
111+ let resultXml = this . mergeXml ( configurationFileContent , pluginConfigurationFileContent , platformData . mergeXmlConfig || [ ] ) . wait ( ) ;
112+ this . validateXml ( resultXml ) ;
113+ this . $fs . writeFile ( configurationFilePath , resultXml ) . wait ( ) ;
114+ }
114115
115- this . $projectFilesManager . processPlatformSpecificFiles ( pluginDestinationPath , platform ) . wait ( ) ;
116+ this . $projectFilesManager . processPlatformSpecificFiles ( pluginDestinationPath , platform ) . wait ( ) ;
116117
117- pluginData . pluginPlatformsFolderPath = ( _platform : string ) => path . join ( pluginData . fullPath , "platforms" , _platform ) ;
118- platformData . platformProjectService . preparePluginNativeCode ( pluginData ) . wait ( ) ;
118+ pluginData . pluginPlatformsFolderPath = ( _platform : string ) => path . join ( pluginData . fullPath , "platforms" , _platform ) ;
119+ platformData . platformProjectService . preparePluginNativeCode ( pluginData ) . wait ( ) ;
119120
120- shelljs . rm ( "-rf" , path . join ( pluginDestinationPath , pluginData . name , "platforms" ) ) ;
121+ shelljs . rm ( "-rf" , path . join ( pluginDestinationPath , pluginData . name , "platforms" ) ) ;
121122
122- // Show message
123- this . $logger . out ( `Successfully prepared plugin ${ pluginData . name } for ${ platform } .` ) ;
123+ // Show message
124+ this . $logger . out ( `Successfully prepared plugin ${ pluginData . name } for ${ platform } .` ) ;
125+ }
124126
125127 } ) . future < void > ( ) ( ) ;
126128 } ;
0 commit comments