@@ -37,26 +37,51 @@ class VersionsService implements IVersionsService {
3737 } ;
3838 }
3939
40- public async getTnsCoreModulesVersion ( ) : Promise < IVersionInformation > {
40+ public async getTnsCoreModulesVersion ( ) : Promise < IVersionInformation [ ] > {
4141 const latestTnsCoreModulesVersion = await this . $packageInstallationManager . getLatestVersion ( constants . TNS_CORE_MODULES_NAME ) ;
4242 const nativescriptCoreModulesInfo : IVersionInformation = {
4343 componentName : constants . TNS_CORE_MODULES_NAME ,
4444 latestVersion : latestTnsCoreModulesVersion
4545 } ;
4646
47+ const versionInformations : IVersionInformation [ ] = [ ] ;
48+
4749 if ( this . projectData ) {
4850 const nodeModulesPath = path . join ( this . projectData . projectDir , constants . NODE_MODULES_FOLDER_NAME ) ;
51+ const scopedPackagePath = path . join ( nodeModulesPath , constants . SCOPED_TNS_CORE_MODULES ) ;
4952 const tnsCoreModulesPath = path . join ( nodeModulesPath , constants . TNS_CORE_MODULES_NAME ) ;
53+
54+ const dependsOnNonScopedPackage = ! ! this . projectData . dependencies [ constants . TNS_CORE_MODULES_NAME ] ;
55+ const dependsOnScopedPackage = ! ! this . projectData . dependencies [ constants . SCOPED_TNS_CORE_MODULES ] ;
56+
57+ // ensure the dependencies are installed, so we can get their actual versions from node_modules
5058 if ( ! this . $fs . exists ( nodeModulesPath ) ||
51- ! this . $fs . exists ( tnsCoreModulesPath ) ) {
59+ ( dependsOnNonScopedPackage && ! this . $fs . exists ( tnsCoreModulesPath ) ) ||
60+ ( dependsOnScopedPackage && ! this . $fs . exists ( scopedPackagePath ) ) ) {
5261 await this . $pluginsService . ensureAllDependenciesAreInstalled ( this . projectData ) ;
5362 }
5463
55- const currentTnsCoreModulesVersion = this . $fs . readJson ( path . join ( tnsCoreModulesPath , constants . PACKAGE_JSON_FILE_NAME ) ) . version ;
56- nativescriptCoreModulesInfo . currentVersion = currentTnsCoreModulesVersion ;
64+ if ( dependsOnNonScopedPackage && this . $fs . exists ( tnsCoreModulesPath ) ) {
65+ const currentTnsCoreModulesVersion = this . $fs . readJson ( path . join ( tnsCoreModulesPath , constants . PACKAGE_JSON_FILE_NAME ) ) . version ;
66+ nativescriptCoreModulesInfo . currentVersion = currentTnsCoreModulesVersion ;
67+ versionInformations . push ( nativescriptCoreModulesInfo ) ;
68+ }
69+
70+ if ( dependsOnScopedPackage && this . $fs . exists ( scopedPackagePath ) ) {
71+ const scopedModulesInformation : IVersionInformation = {
72+ componentName : constants . SCOPED_TNS_CORE_MODULES ,
73+ latestVersion : await this . $packageInstallationManager . getLatestVersion ( constants . SCOPED_TNS_CORE_MODULES )
74+ } ;
75+
76+ const currentScopedPackageVersion = this . $fs . readJson ( path . join ( scopedPackagePath , constants . PACKAGE_JSON_FILE_NAME ) ) . version ;
77+ scopedModulesInformation . currentVersion = currentScopedPackageVersion ;
78+ versionInformations . push ( scopedModulesInformation ) ;
79+ }
80+ } else {
81+ versionInformations . push ( nativescriptCoreModulesInfo ) ;
5782 }
5883
59- return nativescriptCoreModulesInfo ;
84+ return versionInformations ;
6085 }
6186
6287 public async getRuntimesVersions ( ) : Promise < IVersionInformation [ ] > {
@@ -101,9 +126,9 @@ class VersionsService implements IVersionsService {
101126 }
102127
103128 if ( this . projectData ) {
104- const nativescriptCoreModulesInformation : IVersionInformation = await this . getTnsCoreModulesVersion ( ) ;
129+ const nativescriptCoreModulesInformation : IVersionInformation [ ] = await this . getTnsCoreModulesVersion ( ) ;
105130 if ( nativescriptCoreModulesInformation ) {
106- allComponents . push ( nativescriptCoreModulesInformation ) ;
131+ allComponents . push ( ... nativescriptCoreModulesInformation ) ;
107132 }
108133
109134 const runtimesVersions : IVersionInformation [ ] = await this . getRuntimesVersions ( ) ;
0 commit comments