@@ -5,6 +5,7 @@ import { parseJson } from "./common/helpers";
55import { EOL } from "os" ;
66import { cache } from "./common/decorators" ;
77import {
8+ BundlerType ,
89 INsConfig ,
910 IProjectConfigService ,
1011 IProjectData ,
@@ -99,6 +100,8 @@ export class ProjectData implements IProjectData {
99100 public podfilePath : string ;
100101 public isShared : boolean ;
101102 public webpackConfigPath : string ;
103+ public bundlerConfigPath : string ;
104+ public bundler : BundlerType ;
102105 public initialized : boolean ;
103106
104107 constructor (
@@ -110,7 +113,7 @@ export class ProjectData implements IProjectData {
110113 private $logger : ILogger ,
111114 private $injector : IInjector ,
112115 private $androidResourcesMigrationService : IAndroidResourcesMigrationService ,
113- private $devicePlatformsConstants : Mobile . IDevicePlatformsConstants
116+ private $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
114117 ) { }
115118
116119 get projectConfig ( ) : IProjectConfigService {
@@ -142,7 +145,7 @@ export class ProjectData implements IProjectData {
142145
143146 public initializeProjectDataFromContent (
144147 packageJsonContent : string ,
145- projectDir ?: string
148+ projectDir ?: string ,
146149 ) : void {
147150 projectDir = projectDir || this . $projectHelper . projectDir || "" ;
148151 this . projectDir = projectDir ;
@@ -157,7 +160,7 @@ export class ProjectData implements IProjectData {
157160 this . $errors . fail (
158161 `The project file ${ this . projectFilePath } is corrupted. ${ EOL } ` +
159162 `Consider restoring an earlier version from your source control or backup.${ EOL } ` +
160- `Additional technical info: ${ err . toString ( ) } `
163+ `Additional technical info: ${ err . toString ( ) } ` ,
161164 ) ;
162165 }
163166
@@ -178,36 +181,43 @@ export class ProjectData implements IProjectData {
178181 this . appDirectoryPath = this . getAppDirectoryPath ( ) ;
179182 this . appResourcesDirectoryPath = this . getAppResourcesDirectoryPath ( ) ;
180183 this . androidManifestPath = this . getPathToAndroidManifest (
181- this . appResourcesDirectoryPath
184+ this . appResourcesDirectoryPath ,
182185 ) ;
183186 this . gradleFilesDirectoryPath = path . join (
184187 this . appResourcesDirectoryPath ,
185- this . $devicePlatformsConstants . Android
188+ this . $devicePlatformsConstants . Android ,
186189 ) ;
187190 this . appGradlePath = path . join (
188191 this . gradleFilesDirectoryPath ,
189- constants . APP_GRADLE_FILE_NAME
192+ constants . APP_GRADLE_FILE_NAME ,
190193 ) ;
191194 this . infoPlistPath = path . join (
192195 this . appResourcesDirectoryPath ,
193196 this . $devicePlatformsConstants . iOS ,
194- constants . INFO_PLIST_FILE_NAME
197+ constants . INFO_PLIST_FILE_NAME ,
195198 ) ;
196199 this . buildXcconfigPath = path . join (
197200 this . appResourcesDirectoryPath ,
198201 this . $devicePlatformsConstants . iOS ,
199- constants . BUILD_XCCONFIG_FILE_NAME
202+ constants . BUILD_XCCONFIG_FILE_NAME ,
200203 ) ;
201204 this . podfilePath = path . join (
202205 this . appResourcesDirectoryPath ,
203206 this . $devicePlatformsConstants . iOS ,
204- constants . PODFILE_NAME
207+ constants . PODFILE_NAME ,
205208 ) ;
206209 this . isShared = ! ! ( this . nsConfig && this . nsConfig . shared ) ;
207- this . webpackConfigPath =
210+
211+ const webpackConfigPath =
208212 this . nsConfig && this . nsConfig . webpackConfigPath
209213 ? path . resolve ( this . projectDir , this . nsConfig . webpackConfigPath )
210214 : path . join ( this . projectDir , "webpack.config.js" ) ;
215+ this . webpackConfigPath = webpackConfigPath ;
216+ this . bundlerConfigPath =
217+ this . nsConfig && this . nsConfig . bundlerConfigPath
218+ ? path . resolve ( this . projectDir , this . nsConfig . bundlerConfigPath )
219+ : webpackConfigPath ;
220+ this . bundler = this ?. nsConfig ?. bundler ?? "webpack" ;
211221 return ;
212222 }
213223
@@ -217,7 +227,7 @@ export class ProjectData implements IProjectData {
217227 private getPathToAndroidManifest ( appResourcesDir : string ) : string {
218228 const androidDirPath = path . join (
219229 appResourcesDir ,
220- this . $devicePlatformsConstants . Android
230+ this . $devicePlatformsConstants . Android ,
221231 ) ;
222232 const androidManifestDir =
223233 this . $androidResourcesMigrationService . hasMigrated ( appResourcesDir )
@@ -230,13 +240,13 @@ export class ProjectData implements IProjectData {
230240 private errorInvalidProject ( projectDir : string ) : void {
231241 const currentDir = path . resolve ( "." ) ;
232242 this . $logger . trace (
233- `Unable to find project. projectDir: ${ projectDir } , options.path: ${ this . $options . path } , ${ currentDir } `
243+ `Unable to find project. projectDir: ${ projectDir } , options.path: ${ this . $options . path } , ${ currentDir } ` ,
234244 ) ;
235245
236246 // This is the case when no project file found
237247 this . $errors . fail (
238248 "No project found at or above '%s' and neither was a --path specified." ,
239- projectDir || this . $options . path || currentDir
249+ projectDir || this . $options . path || currentDir ,
240250 ) ;
241251 }
242252
@@ -291,7 +301,7 @@ export class ProjectData implements IProjectData {
291301
292302 private resolveToProjectDir (
293303 pathToResolve : string ,
294- projectDir ?: string
304+ projectDir ?: string ,
295305 ) : string {
296306 if ( ! projectDir ) {
297307 projectDir = this . projectDir ;
@@ -306,7 +316,7 @@ export class ProjectData implements IProjectData {
306316
307317 @cache ( )
308318 private initializeProjectIdentifiers (
309- config : INsConfig
319+ config : INsConfig ,
310320 ) : Mobile . IProjectIdentifier {
311321 this . $logger . trace ( `Initializing project identifiers. Config: ` , config ) ;
312322
@@ -341,18 +351,18 @@ export class ProjectData implements IProjectData {
341351 private getProjectType ( ) : string {
342352 let detectedProjectType = _ . find (
343353 ProjectData . PROJECT_TYPES ,
344- ( projectType ) => projectType . isDefaultProjectType
354+ ( projectType ) => projectType . isDefaultProjectType ,
345355 ) . type ;
346356
347357 const deps : string [ ] = _ . keys ( this . dependencies ) . concat (
348- _ . keys ( this . devDependencies )
358+ _ . keys ( this . devDependencies ) ,
349359 ) ;
350360
351361 _ . each ( ProjectData . PROJECT_TYPES , ( projectType ) => {
352362 if (
353363 _ . some (
354364 projectType . requiredDependencies ,
355- ( requiredDependency ) => deps . indexOf ( requiredDependency ) !== - 1
365+ ( requiredDependency ) => deps . indexOf ( requiredDependency ) !== - 1 ,
356366 )
357367 ) {
358368 detectedProjectType = projectType . type ;
@@ -366,7 +376,7 @@ export class ProjectData implements IProjectData {
366376 @cache ( )
367377 private warnProjectId ( ) : void {
368378 this . $logger . warn (
369- "[WARNING]: IProjectData.projectId is deprecated. Please use IProjectData.projectIdentifiers[platform]."
379+ "[WARNING]: IProjectData.projectId is deprecated. Please use IProjectData.projectIdentifiers[platform]." ,
370380 ) ;
371381 }
372382}
0 commit comments