Skip to content

Commit

Permalink
fix: tgz runtime resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
rigor789 committed Jan 26, 2021
1 parent 0f3e535 commit 101bfae
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions lib/services/platform/add-platform-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,32 @@ export class AddPlatformService implements IAddPlatformService {

private resolveFrameworkDir(projectDir: string, packageName: string): string {
try {
// strip version info if present <package>@1.2.3 -> <package>
packageName = packageName.replace(/@[\d.]+$/g, "");
// strip version info if present <package>@1.2.3-rc.0 -> <package>
// tested cases:
// @nativescript/ios
// @nativescript/ios@1
// @nativescript/ios@1.2
// @nativescript/ios@1.2.3
// @nativescript/ios@1.2.3-
// @nativescript/ios@1.2.3-rc
// @nativescript/ios@1.2.3-rc.
// @nativescript/ios@1.2.3-rc.0
// @nativescript/ios@rc
// @nativescript/ios@^7.0.0
// @nativescript/ios@~7.0.0
// tns-ios
// tns-ios@1
// tns-ios@1.2
// tns-ios@1.2.3
// tns-ios@1.2.3-
// tns-ios@1.2.3-rc
// tns-ios@1.2.3-rc.
// tns-ios@1.2.3-rc.0
// tns-ios@rc
// tns-ios@^7.0.0
// tns-ios@~7.0.0
packageName = packageName.replace(/(.+)@.+$/g, "$1");
console.log({ packageName });
const frameworkDir = require
.resolve(`${packageName}/package.json`, {
paths: [projectDir],
Expand All @@ -143,7 +167,8 @@ export class AddPlatformService implements IAddPlatformService {
}
} catch (err) {
this.$logger.trace(
`Couldn't resolve installed framework. Continuing with install...`
`Couldn't resolve installed framework. Continuing with install...`,
err
);
}
return null;
Expand Down

0 comments on commit 101bfae

Please sign in to comment.