Skip to content

Commit 897721c

Browse files
committed
Merge branch 'main' of github.com:farfromrefug/nativescript-cli
2 parents 5b29d6e + f5fb601 commit 897721c

7 files changed

Lines changed: 29 additions & 20 deletions

File tree

lib/controllers/migrate-controller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export class MigrateController
147147
},
148148
{
149149
packageName: "nativescript-dev-webpack",
150-
replaceWith: "@nativescript/webpack",
150+
replaceWith: constants.WEBPACK_PLUGIN_NAME,
151151
shouldRemove: true,
152152
isDev: true,
153153
async shouldMigrateAction() {
@@ -156,7 +156,7 @@ export class MigrateController
156156
migrateAction: this.migrateWebpack.bind(this),
157157
},
158158
{
159-
packageName: "@nativescript/webpack",
159+
packageName: constants.WEBPACK_PLUGIN_NAME,
160160
minVersion: "3.0.0",
161161
desiredVersion: "~5.0.0",
162162
shouldAddIfMissing: true,
@@ -1566,7 +1566,7 @@ export class MigrateController
15661566
);
15671567

15681568
try {
1569-
const scopedWebpackPackage = `@nativescript/webpack`;
1569+
const scopedWebpackPackage = constants.WEBPACK_PLUGIN_NAME;
15701570
const resolvedVersion =
15711571
await this.$packageInstallationManager.getMaxSatisfyingVersion(
15721572
scopedWebpackPackage,

lib/controllers/update-controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class UpdateController
3636

3737
// devDependencies
3838
{
39-
packageName: "@nativescript/webpack",
39+
packageName: constants.WEBPACK_PLUGIN_NAME,
4040
isDev: true,
4141
},
4242
{

lib/definitions/project.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ interface INsConfigPlaform {
103103

104104
interface INsConfigIOS extends INsConfigPlaform {
105105
discardUncaughtJsExceptions?: boolean;
106+
runtimePackageName?: string
106107
}
107108

108109
interface INSConfigVisionOS extends INsConfigIOS {}
@@ -143,6 +144,8 @@ interface INsConfigAndroid extends INsConfigPlaform {
143144
enableMultithreadedJavascript?: boolean;
144145

145146
gradleVersion?: string;
147+
148+
runtimePackageName?: string
146149
}
147150

148151
interface INsConfigHooks {
@@ -158,6 +161,7 @@ interface INsConfig {
158161
buildPath?: string;
159162
shared?: boolean;
160163
overridePods?: string;
164+
webpackPackageName?: string;
161165
webpackConfigPath?: string;
162166
ios?: INsConfigIOS;
163167
android?: INsConfigAndroid;

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

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

458458
private async getLatestRuntimeVersion(): Promise<string> {
459459
let runtimeVersion: string = null;
460-
460+
const packageName = this.$projectData.nsConfig.android?.runtimePackageName || SCOPED_ANDROID_RUNTIME_NAME;
461461
try {
462462
let result = await this.$packageManager.view(
463-
SCOPED_ANDROID_RUNTIME_NAME,
463+
packageName,
464464
{
465465
"dist-tags": true,
466466
}
@@ -472,7 +472,7 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
472472
`Error while getting latest android runtime version from view command: ${err}`
473473
);
474474
const registryData = await this.$packageManager.getRegistryPackageData(
475-
SCOPED_ANDROID_RUNTIME_NAME
475+
packageName
476476
);
477477
runtimeVersion = registryData["dist-tags"].latest;
478478
}
@@ -496,9 +496,10 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
496496
};
497497
}
498498

499+
const packageName = this.$projectData.nsConfig.android?.runtimePackageName || SCOPED_ANDROID_RUNTIME_NAME;
499500
// try reading from installed runtime first before reading from the npm registry...
500501
const installedRuntimePackageJSONPath = resolvePackageJSONPath(
501-
SCOPED_ANDROID_RUNTIME_NAME,
502+
packageName,
502503
{
503504
paths: [this.$projectData.projectDir],
504505
}
@@ -551,10 +552,11 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
551552
return localVersionInfo;
552553
}
553554

555+
const packageName = this.$projectData.nsConfig.android?.runtimePackageName || SCOPED_ANDROID_RUNTIME_NAME;
554556
// fallback to reading from npm...
555557
try {
556558
let output = await this.$packageManager.view(
557-
`${SCOPED_ANDROID_RUNTIME_NAME}@${runtimeVersion}`,
559+
`${packageName}@${runtimeVersion}`,
558560
{ version_info: true }
559561
);
560562
output = output?.["version_info"] ?? output;
@@ -569,7 +571,7 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
569571
*
570572
*/
571573
output = await this.$packageManager.view(
572-
`${SCOPED_ANDROID_RUNTIME_NAME}@${runtimeVersion}`,
574+
`${packageName}@${runtimeVersion}`,
573575
{ gradle: true }
574576
);
575577
output = output?.["gradle"] ?? output;
@@ -589,7 +591,7 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
589591
`Error while getting gradle data for android runtime from view command: ${err}`
590592
);
591593
const registryData = await this.$packageManager.getRegistryPackageData(
592-
SCOPED_ANDROID_RUNTIME_NAME
594+
packageName
593595
);
594596
runtimeGradleVersions = registryData.versions[runtimeVersion];
595597
}

lib/services/project-data-service.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export class ProjectDataService implements IProjectDataService {
5050
private $fs: IFileSystem,
5151
private $staticConfig: IStaticConfig,
5252
private $logger: ILogger,
53+
private $projectData: IProjectData,
5354
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
5455
private $androidResourcesMigrationService: IAndroidResourcesMigrationService,
5556
private $injector: IInjector
@@ -628,13 +629,15 @@ export class ProjectDataService implements IProjectDataService {
628629
.getDependenciesFromPackageJson(projectDir)
629630
.devDependencies.find((d) => {
630631
if (platform === constants.PlatformTypes.ios) {
632+
const packageName = this.$projectData.nsConfig.ios?.runtimePackageName || constants.SCOPED_IOS_RUNTIME_NAME;
631633
return [
632-
constants.SCOPED_IOS_RUNTIME_NAME,
634+
packageName,
633635
constants.TNS_IOS_RUNTIME_NAME,
634636
].includes(d.name);
635637
} else if (platform === constants.PlatformTypes.android) {
638+
const packageName = this.$projectData.nsConfig.android?.runtimePackageName || constants.SCOPED_ANDROID_RUNTIME_NAME;
636639
return [
637-
constants.SCOPED_ANDROID_RUNTIME_NAME,
640+
packageName,
638641
constants.TNS_ANDROID_RUNTIME_NAME,
639642
].includes(d.name);
640643
} else if (platform === constants.PlatformTypes.visionos) {
@@ -687,12 +690,12 @@ export class ProjectDataService implements IProjectDataService {
687690
);
688691
if (platform === constants.PlatformTypes.ios) {
689692
return {
690-
name: constants.SCOPED_IOS_RUNTIME_NAME,
693+
name: this.$projectData.nsConfig.ios?.runtimePackageName || constants.SCOPED_IOS_RUNTIME_NAME,
691694
version: null,
692695
};
693696
} else if (platform === constants.PlatformTypes.android) {
694697
return {
695-
name: constants.SCOPED_ANDROID_RUNTIME_NAME,
698+
name: this.$projectData.nsConfig.android?.runtimePackageName || constants.SCOPED_ANDROID_RUNTIME_NAME,
696699
version: null,
697700
};
698701
} else if (platform === constants.PlatformTypes.visionos) {

lib/services/webpack/webpack-compiler-service.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,8 @@ export class WebpackCompilerService
599599

600600
private getWebpackExecutablePath(projectData: IProjectData): string {
601601
if (this.isWebpack5(projectData)) {
602-
const packagePath = resolvePackagePath("@nativescript/webpack", {
602+
const packageName = projectData.nsConfig.webpackPackageName || WEBPACK_PLUGIN_NAME;
603+
let packagePath = resolvePackagePath(packageName, {
603604
paths: [projectData.projectDir],
604605
});
605606

@@ -620,7 +621,8 @@ export class WebpackCompilerService
620621
}
621622

622623
private isWebpack5(projectData: IProjectData): boolean {
623-
const packageJSONPath = resolvePackageJSONPath("@nativescript/webpack", {
624+
const packageName = projectData.nsConfig.webpackPackageName || WEBPACK_PLUGIN_NAME;
625+
const packageJSONPath = resolvePackageJSONPath(packageName, {
624626
paths: [projectData.projectDir],
625627
});
626628

vendor/gradle-app/app/build.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,9 +1027,7 @@ project.tasks.configureEach {
10271027
name =~ /mergeBenchmark(Debug|Release)JavaResource/ ||
10281028
name =~ /transform(Debug|Release)ClassesWithAsm/ ||
10291029
// because of sentry plugin. There must be a better way
1030-
name =~ /collectExternal(Debug|Release)/ ||
1031-
name =~ /generateSentryProguardUuid(Debug|Release)/ ||
1032-
name =~ /generateSentryDebugMetaProperties(Debug|Release)/
1030+
name =~ /collectExternal(Debug|Release)/
10331031
)) {
10341032
it.finalizedBy(buildMetadata)
10351033
}

0 commit comments

Comments
 (0)