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

Lines changed: 28 additions & 3 deletions
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/ios@1.2
138+
// @nativescript/ios@1.2.3
139+
// @nativescript/ios@1.2.3-
140+
// @nativescript/ios@1.2.3-rc
141+
// @nativescript/ios@1.2.3-rc.
142+
// @nativescript/ios@1.2.3-rc.0
143+
// @nativescript/ios@rc
144+
// @nativescript/ios@^7.0.0
145+
// @nativescript/ios@~7.0.0
146+
// tns-ios
147+
// tns-ios@1
148+
// tns-ios@1.2
149+
// tns-ios@1.2.3
150+
// tns-ios@1.2.3-
151+
// tns-ios@1.2.3-rc
152+
// tns-ios@1.2.3-rc.
153+
// tns-ios@1.2.3-rc.0
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)