@@ -32,11 +32,11 @@ export class ProjectData implements IProjectData {
32
32
public projectFilePath : string ;
33
33
public projectIdentifiers : IProjectIdentifier ;
34
34
get projectId ( ) : string {
35
- this . $logger . warnWithLabel ( "This propery is depricated. Please use projectData.projectIdentifiers[platform]." ) ;
35
+ this . warnProjectId ( ) ;
36
36
return this . projectIdentifiers . ios ;
37
37
}
38
38
set projectId ( identifier : string ) {
39
- this . $logger . warnWithLabel ( "This propery is depricated. Please use projectData.projectIdentifiers[platform]." ) ;
39
+ this . warnProjectId ( ) ;
40
40
this . projectIdentifiers . ios = identifier ;
41
41
this . projectIdentifiers . android = identifier ;
42
42
}
@@ -56,6 +56,7 @@ export class ProjectData implements IProjectData {
56
56
57
57
public initializeProjectData ( projectDir ?: string ) : void {
58
58
projectDir = projectDir || this . $projectHelper . projectDir ;
59
+
59
60
// If no project found, projectDir should be null
60
61
if ( projectDir ) {
61
62
const projectFilePath = path . join ( projectDir , this . $staticConfig . PROJECT_FILE_NAME ) ;
@@ -79,10 +80,7 @@ export class ProjectData implements IProjectData {
79
80
this . projectFilePath = projectFilePath ;
80
81
this . appDirectoryPath = path . join ( projectDir , constants . APP_FOLDER_NAME ) ;
81
82
this . appResourcesDirectoryPath = path . join ( projectDir , constants . APP_FOLDER_NAME , constants . APP_RESOURCES_FOLDER_NAME ) ;
82
- this . projectIdentifiers = {
83
- android : data . id . android || data . id ,
84
- ios : data . id . ios || data . id
85
- } ;
83
+ this . projectIdentifiers = this . getProjectIdentifiers ( data . id ) ;
86
84
this . dependencies = fileContent . dependencies ;
87
85
this . devDependencies = fileContent . devDependencies ;
88
86
this . projectType = this . getProjectType ( ) ;
@@ -99,6 +97,25 @@ export class ProjectData implements IProjectData {
99
97
this . $errors . fail ( "No project found at or above '%s' and neither was a --path specified." , projectDir || this . $options . path || currentDir ) ;
100
98
}
101
99
100
+ private getProjectIdentifiers ( data :any ) : IProjectIdentifier {
101
+ let identifier : IProjectIdentifier ;
102
+ data = data || "" ;
103
+
104
+ if ( typeof data === "string" ) {
105
+ identifier = {
106
+ android : data ,
107
+ ios : data
108
+ } ;
109
+ } else {
110
+ identifier = {
111
+ android : data . android || "" ,
112
+ ios : data . ios || ""
113
+ } ;
114
+ }
115
+
116
+ return identifier ;
117
+ }
118
+
102
119
private getProjectType ( ) : string {
103
120
let detectedProjectType = _ . find ( ProjectData . PROJECT_TYPES , ( projectType ) => projectType . isDefaultProjectType ) . type ;
104
121
@@ -113,5 +130,9 @@ export class ProjectData implements IProjectData {
113
130
114
131
return detectedProjectType ;
115
132
}
133
+
134
+ private warnProjectId ( ) : void {
135
+ this . $logger . warnWithLabel ( "IProjectData.projectId is depricated. Please use IProjectData.projectIdentifiers[platform]." ) ;
136
+ }
116
137
}
117
138
$injector . register ( "projectData" , ProjectData ) ;
0 commit comments