Skip to content

Commit

Permalink
Fix app launcher create issue in subfolder project (#2048)
Browse files Browse the repository at this point in the history
  • Loading branch information
EzioLi01 committed Sep 27, 2023
1 parent e803fb1 commit d80f173
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
13 changes: 12 additions & 1 deletion src/common/reactNativeProjectHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,18 @@ export class ReactNativeProjectHelper {

public static async verifyMetroConfigFile(projectRoot: string) {
const logger = OutputChannelLogger.getChannel(OutputChannelLogger.MAIN_CHANNEL_NAME, true);
const version = await ProjectVersionHelper.getReactNativeVersions(projectRoot);

let version;
try {
version = await ProjectVersionHelper.getReactNativeVersions(projectRoot);
} catch {
version = await ProjectVersionHelper.getReactNativeVersions(
projectRoot,
undefined,
projectRoot,
);
}

const metroConfigPath = path.join(projectRoot, "metro.config.js");
const content = fs.readFileSync(metroConfigPath, "utf-8");
const isNewMetroConfig = content.includes("getDefaultConfig");
Expand Down
2 changes: 1 addition & 1 deletion src/debugger/direct/directDebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import { TipNotificationService } from "../../extension/services/tipsNotificatio
import { RNSession } from "../debugSessionWrapper";
import { SettingsHelper } from "../../extension/settingsHelper";
import { ReactNativeProjectHelper } from "../../common/reactNativeProjectHelper";
import { IWDPHelper } from "./IWDPHelper";
import { ExponentHelper } from "../../extension/exponent/exponentHelper";
import { IWDPHelper } from "./IWDPHelper";

nls.config({
messageFormat: nls.MessageFormat.bundle,
Expand Down
2 changes: 1 addition & 1 deletion src/debugger/rnDebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { RnCDPMessageHandler } from "../cdp-proxy/CDPMessageHandlers/rnCDPMessag
import { ErrorHelper } from "../common/error/errorHelper";
import { InternalErrorCode } from "../common/error/internalErrorCode";
import { ReactNativeProjectHelper } from "../common/reactNativeProjectHelper";
import { ExponentHelper } from "../extension/exponent/exponentHelper";
import { MultipleLifetimesAppWorker } from "./appWorker";
import {
DebugSessionBase,
Expand All @@ -22,7 +23,6 @@ import {
} from "./debugSessionBase";
import { JsDebugConfigAdapter } from "./jsDebugConfigAdapter";
import { RNSession } from "./debugSessionWrapper";
import { ExponentHelper } from "../extension/exponent/exponentHelper";

nls.config({
messageFormat: nls.MessageFormat.bundle,
Expand Down

0 comments on commit d80f173

Please sign in to comment.