Skip to content

Commit f23a4bf

Browse files
committed
fix: edge case for runtimePackageName
1 parent f552abc commit f23a4bf

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

lib/services/android-plugin-build-service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
457457

458458
private async getLatestRuntimeVersion(): Promise<string> {
459459
let runtimeVersion: string = null;
460-
const packageName = this.$projectData.nsConfig.android.runtimePackageName || SCOPED_ANDROID_RUNTIME_NAME;
460+
const packageName = this.$projectData.nsConfig.android?.runtimePackageName || SCOPED_ANDROID_RUNTIME_NAME;
461461
try {
462462
let result = await this.$packageManager.view(
463463
packageName,
@@ -496,7 +496,7 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
496496
};
497497
}
498498

499-
const packageName = this.$projectData.nsConfig.android.runtimePackageName || SCOPED_ANDROID_RUNTIME_NAME;
499+
const packageName = this.$projectData.nsConfig.android?.runtimePackageName || SCOPED_ANDROID_RUNTIME_NAME;
500500
// try reading from installed runtime first before reading from the npm registry...
501501
const installedRuntimePackageJSONPath = resolvePackageJSONPath(
502502
packageName,
@@ -552,7 +552,7 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
552552
return localVersionInfo;
553553
}
554554

555-
const packageName = this.$projectData.nsConfig.android.runtimePackageName || SCOPED_ANDROID_RUNTIME_NAME;
555+
const packageName = this.$projectData.nsConfig.android?.runtimePackageName || SCOPED_ANDROID_RUNTIME_NAME;
556556
// fallback to reading from npm...
557557
try {
558558
let output = await this.$packageManager.view(

lib/services/project-data-service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -630,13 +630,13 @@ export class ProjectDataService implements IProjectDataService {
630630
.getDependenciesFromPackageJson(projectDir)
631631
.devDependencies.find((d) => {
632632
if (platform === constants.PlatformTypes.ios) {
633-
const packageName = this.$projectData.nsConfig.ios.runtimePackageName || constants.SCOPED_IOS_RUNTIME_NAME;
633+
const packageName = this.$projectData.nsConfig.ios?.runtimePackageName || constants.SCOPED_IOS_RUNTIME_NAME;
634634
return [
635635
packageName,
636636
constants.TNS_IOS_RUNTIME_NAME,
637637
].includes(d.name);
638638
} else if (platform === constants.PlatformTypes.android) {
639-
const packageName = this.$projectData.nsConfig.android.runtimePackageName || constants.SCOPED_ANDROID_RUNTIME_NAME;
639+
const packageName = this.$projectData.nsConfig.android?.runtimePackageName || constants.SCOPED_ANDROID_RUNTIME_NAME;
640640
return [
641641
packageName,
642642
constants.TNS_ANDROID_RUNTIME_NAME,
@@ -689,12 +689,12 @@ export class ProjectDataService implements IProjectDataService {
689689
);
690690
if (platform === constants.PlatformTypes.ios) {
691691
return {
692-
name: this.$projectData.nsConfig.ios.runtimePackageName || constants.SCOPED_IOS_RUNTIME_NAME,
692+
name: this.$projectData.nsConfig.ios?.runtimePackageName || constants.SCOPED_IOS_RUNTIME_NAME,
693693
version: null,
694694
};
695695
} else if (platform === constants.PlatformTypes.android) {
696696
return {
697-
name: this.$projectData.nsConfig.android.runtimePackageName || constants.SCOPED_ANDROID_RUNTIME_NAME,
697+
name: this.$projectData.nsConfig.android?.runtimePackageName || constants.SCOPED_ANDROID_RUNTIME_NAME,
698698
version: null,
699699
};
700700
}

0 commit comments

Comments
 (0)