Skip to content

Commit

Permalink
Fix getting of project root on Command Palette commands execution (#1160
Browse files Browse the repository at this point in the history
)
  • Loading branch information
RedMickey authored Nov 8, 2019
1 parent a084c9c commit 911cacb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/common/packager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ export class Packager {
return this.packagerStatus;
}

public getProjectPath(): string {
return this.projectPath;
}

public getPackagerArgs(rnVersion: string, resetCache: boolean = false): Q.Promise<string[]> {
let args: string[] = ["--port", this.port.toString()];

Expand Down
10 changes: 5 additions & 5 deletions src/extension/commandPaletteHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class CommandPaletteHandler {
public static startPackager(): Q.Promise<void> {
return this.selectProject()
.then((project: IReactNativeProject) => {
return ReactNativeProjectHelper.getReactNativePackageVersionFromNodeModules(project.workspaceFolder.uri.fsPath)
return ReactNativeProjectHelper.getReactNativePackageVersionFromNodeModules(project.packager.getProjectPath())
.then(version => {
return this.executeCommandInContext("startPackager", project.workspaceFolder, () => {
return project.packager.isRunning()
Expand Down Expand Up @@ -105,7 +105,7 @@ export class CommandPaletteHandler {
public static restartPackager(): Q.Promise<void> {
return this.selectProject()
.then((project: IReactNativeProject) => {
return ReactNativeProjectHelper.getReactNativePackageVersionFromNodeModules(project.workspaceFolder.uri.fsPath)
return ReactNativeProjectHelper.getReactNativePackageVersionFromNodeModules(project.packager.getProjectPath())
.then(version => {
return this.executeCommandInContext("restartPackager", project.workspaceFolder, () =>
this.runRestartPackagerCommandAndUpdateStatus(project));
Expand Down Expand Up @@ -136,7 +136,7 @@ export class CommandPaletteHandler {
return this.selectProject()
.then((project: IReactNativeProject) => {
TargetPlatformHelper.checkTargetPlatformSupport("android");
return ReactNativeProjectHelper.getReactNativePackageVersionFromNodeModules(project.workspaceFolder.uri.fsPath)
return ReactNativeProjectHelper.getReactNativePackageVersionFromNodeModules(project.packager.getProjectPath())
.then(version => {
project.reactNativeVersion = version;
return this.executeCommandInContext("runAndroid", project.workspaceFolder, () => {
Expand All @@ -162,7 +162,7 @@ export class CommandPaletteHandler {
public static runIos(target: TargetType = "simulator"): Q.Promise<void> {
return this.selectProject()
.then((project: IReactNativeProject) => {
return ReactNativeProjectHelper.getReactNativePackageVersionFromNodeModules(project.workspaceFolder.uri.fsPath)
return ReactNativeProjectHelper.getReactNativePackageVersionFromNodeModules(project.packager.getProjectPath())
.then(version => {
project.reactNativeVersion = version;
TargetPlatformHelper.checkTargetPlatformSupport("ios");
Expand Down Expand Up @@ -191,7 +191,7 @@ export class CommandPaletteHandler {
public static runExponent(): Q.Promise<void> {
return this.selectProject()
.then((project: IReactNativeProject) => {
return ReactNativeProjectHelper.getReactNativePackageVersionFromNodeModules(project.workspaceFolder.uri.fsPath)
return ReactNativeProjectHelper.getReactNativePackageVersionFromNodeModules(project.packager.getProjectPath())
.then(version => {
return this.loginToExponent(project)
.then(() => {
Expand Down

0 comments on commit 911cacb

Please sign in to comment.