Skip to content

Commit 95812b8

Browse files
committed
fix: project detection
1 parent 5e15627 commit 95812b8

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

lib/common/helpers.ts

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ function isInstallingNativeScriptGloballyWithNpm(): boolean {
7373
const isGlobalCommand = doesCurrentNpmCommandMatch([/^--global$/, /^-g$/]);
7474
const hasNativeScriptPackage = doesCurrentNpmCommandMatch([
7575
/^nativescript(@.*)?$/,
76+
/nativescript-(.*)\.tgz?$/,
7677
]);
7778

7879
return isInstallCommand && isGlobalCommand && hasNativeScriptPackage;
@@ -84,6 +85,7 @@ function isInstallingNativeScriptGloballyWithYarn(): boolean {
8485
const isGlobalCommand = doesCurrentNpmCommandMatch([/^global$/]);
8586
const hasNativeScriptPackage = doesCurrentNpmCommandMatch([
8687
/^nativescript(@.*)?$/,
88+
/nativescript-(.*)\.tgz?$/,
8789
]);
8890

8991
return isInstallCommand && isGlobalCommand && hasNativeScriptPackage;

lib/common/project-helper.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as _ from "lodash";
33
import { IErrors, IFileSystem, IProjectHelper } from "./declarations";
44
import { IOptions } from "../declarations";
55
import { injector } from "./yok";
6+
import { SCOPED_TNS_CORE_MODULES, TNS_CORE_MODULES_NAME } from "../constants";
67

78
export class ProjectHelper implements IProjectHelper {
89
constructor(
@@ -75,7 +76,10 @@ export class ProjectHelper implements IProjectHelper {
7576
private isProjectFileCorrect(projectFilePath: string): boolean {
7677
try {
7778
const fileContent = this.$fs.readText(projectFilePath);
78-
return fileContent.includes("nativescript");
79+
return (
80+
fileContent.includes(SCOPED_TNS_CORE_MODULES) ||
81+
fileContent.includes(TNS_CORE_MODULES_NAME)
82+
);
7983
} catch (err) {
8084
this.$errors.fail(
8185
"The project file is corrupted. Additional technical information: %s",

test/plugins-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ function createProjectFile(testInjector: IInjector): string {
245245

246246
const packageJsonData = {
247247
name: "testModuleName",
248-
description: "nativescript", // important for project file checks - currently just looking for the nativescript keyword
248+
description: "@nativescript/core", // important for project file checks - currently just looking for the @nativescript/core keyword
249249
version: "0.1.0",
250250
devDependencies: {
251251
"tns-android": "1.4.0",

0 commit comments

Comments
 (0)