Skip to content

Commit 101bfae

Browse files
committed
fix: tgz runtime resolution
1 parent 0f3e535 commit 101bfae

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

lib/services/platform/add-platform-service.ts

+28-3
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,32 @@ export class AddPlatformService implements IAddPlatformService {
130130

131131
private resolveFrameworkDir(projectDir: string, packageName: string): string {
132132
try {
133-
// strip version info if present <package>@1.2.3 -> <package>
134-
packageName = packageName.replace(/@[\d.]+$/g, "");
133+
// strip version info if present <package>@1.2.3-rc.0 -> <package>
134+
// tested cases:
135+
// @nativescript/ios
136+
// @nativescript/ios@1
137+
// @nativescript/[email protected]
138+
// @nativescript/[email protected]
139+
// @nativescript/[email protected]
140+
// @nativescript/[email protected]
141+
// @nativescript/[email protected].
142+
// @nativescript/[email protected]
143+
// @nativescript/ios@rc
144+
// @nativescript/ios@^7.0.0
145+
// @nativescript/ios@~7.0.0
146+
// tns-ios
147+
// tns-ios@1
148+
149+
150+
151+
152+
153+
154+
// tns-ios@rc
155+
// tns-ios@^7.0.0
156+
// tns-ios@~7.0.0
157+
packageName = packageName.replace(/(.+)@.+$/g, "$1");
158+
console.log({ packageName });
135159
const frameworkDir = require
136160
.resolve(`${packageName}/package.json`, {
137161
paths: [projectDir],
@@ -143,7 +167,8 @@ export class AddPlatformService implements IAddPlatformService {
143167
}
144168
} catch (err) {
145169
this.$logger.trace(
146-
`Couldn't resolve installed framework. Continuing with install...`
170+
`Couldn't resolve installed framework. Continuing with install...`,
171+
err
147172
);
148173
}
149174
return null;

0 commit comments

Comments
 (0)