Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
77651f5
Use path.join for EAS configuration file path
EmmaYuan1015 Oct 28, 2026
6c79c8e
Refactor launch Expo Web command and improve test coverage
EmmaYuan1015 Oct 29, 2026
b3273db
Fix EAS CLI resolution for Expo build configuration
EmmaYuan1015 Oct 29, 2026
afa41d3
Log warnings when development environment detection fails
EmmaYuan1015 Nov 4, 2026
cc0d3a6
Fix React Native Doctor interaction using a terminal task
ZhiyanJia Nov 4, 2026
be7a50c
Merge branch 'master' into use-path-join-for-eas-config
EmmaYuan1015 Nov 10, 2026
59913c1
fix: clear stale Metro process references to allow restart
ZhiyanJia Nov 10, 2026
e10feb0
Merge pull request #3070 from microsoft/use-path-join-for-eas-config
EmmaYuan1015 Nov 10, 2026
3b38673
Merge branch 'master' into fix/metro-stale-process-reference
ZhiyanJia Nov 10, 2026
92bc34e
Merge pull request #3071 from microsoft/fix/metro-stale-process-refer…
ZhiyanJia Nov 10, 2026
e74b12f
fix: handle comments when inserting debug configurations
ZhiyanJia Nov 10, 2026
5e00850
Merge pull request #3072 from microsoft/fix/debug-config-completion-e…
ZhiyanJia Nov 10, 2026
6e09b16
fix: specify Android device for Expo Go installation
ZhiyanJia Nov 11, 2026
ea20701
Merge pull request #3074 from microsoft/fix/expo-go-android-install-t…
ZhiyanJia Nov 11, 2026
e352313
Merge branch 'master' into refactor-launch-expo-web-cleanup
EmmaYuan1015 Nov 11, 2026
78fc5bb
Merge pull request #3075 from microsoft/refactor-launch-expo-web-cleanup
EmmaYuan1015 Nov 11, 2026
56b4996
Merge branch 'master' into fix-eas-cli-resolution
EmmaYuan1015 Nov 12, 2026
78fa7d3
Merge pull request #3077 from microsoft/fix-eas-cli-resolution
EmmaYuan1015 Nov 12, 2026
12347d4
Merge branch 'master' into dev-environment-detection-warnings
EmmaYuan1015 Nov 16, 2026
06d367a
Merge branch 'master' into fix/doctor-interactive-task
ZhiyanJia Nov 16, 2026
ebde6b5
Merge pull request #3081 from microsoft/fix/doctor-interactive-task
ZhiyanJia Nov 16, 2026
612c625
Merge branch 'master' into dev-environment-detection-warnings
EmmaYuan1015 Nov 16, 2026
e2283d1
Merge pull request #3080 from microsoft/dev-environment-detection-war…
EmmaYuan1015 Nov 16, 2026
c9a0198
Merge branch 'master' of https://github.com/microsoft/vscode-react-na…
Nov 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ The full list of commands is:

### Command behavior highlights

- `Expo - Create EAS config file` runs `eas build:configure --platform all` for Expo managed projects. If `eas.json` already exists, the command exits without changing existing config.
- `Expo - Create EAS config file` runs `npx eas-cli build:configure --platform all` from the Expo managed project root, without requiring a global EAS CLI installation. It requires `npx` on your PATH and may download `eas-cli` if it is not installed locally. If `eas.json` already exists, the command exits without changing existing config.
- `Publish to Expo Host` (`reactNative.publishToExpHost`) was deprecated and removed. Use Expo EAS workflows (`eas build`, `eas submit`) instead.
- `Run EAS Build` initializes local EAS build files by creating `eas.json` and `.eas/workflows/create-production-builds.yml` when they are missing.
- `Enable Hermes` lets you choose platform and enable/disable Hermes:
Expand Down
6 changes: 3 additions & 3 deletions src/common/installHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ export async function installAndroidApplication(
`Found ${targets.length} online emulators, installing application on ${targets[0].id}. \n`,
);
try {
await adbHelper.installApplicationToEmulator(appPath);
await adbHelper.installApplicationToEmulator(appPath, targets[0].id);
} catch {
throw new Error(`Failed to install application: ${appPath}.`);
}
} else {
logger.logStream(`Installing application on ${targets[0].id}. \n`);
try {
await adbHelper.installApplicationToEmulator(appPath);
await adbHelper.installApplicationToEmulator(appPath, targets[0].id);
} catch {
throw new Error(`Failed to install application: ${appPath}.`);
}
logger.logStream(`Install Android application is completed. \n`);
}
logger.logStream(`Install Android application is completed. \n`);
}

export async function installiOSApplication(project: AppLauncher, appPath: string): Promise<void> {
Expand Down
34 changes: 9 additions & 25 deletions src/common/launchJsonCompletionHelper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.

import { DebugConfiguration, TextDocument, Position, Range } from "vscode";
import type { DebugConfiguration, TextDocument, Position } from "vscode";
import { createScanner, parse, SyntaxKind } from "jsonc-parser";

export type PositionOfCursor = "InsideEmptyArray" | "BeforeItem" | "AfterItem";
Expand Down Expand Up @@ -57,31 +57,15 @@ export class LaunchJsonCompletionHelper {
document: TextDocument,
position: Position,
): boolean {
const line = document.lineAt(position.line);
// Get text from start of line until the cursor.
const currentLine = document.getText(new Range(line.range.start, position));
if (currentLine.trim().endsWith(",")) {
return true;
const textBeforeCursor = document.getText().slice(0, document.offsetAt(position));
const scanner = createScanner(textBeforeCursor, true);
let previousToken = SyntaxKind.EOF;
let token = scanner.scan();
while (token !== SyntaxKind.EOF) {
previousToken = token;
token = scanner.scan();
}
// If there are other characters, then don't bother.
if (currentLine.trim().length !== 0) {
return false;
}

// Keep walking backwards until we hit a non-comma character or a comm character.
let startLineNumber = position.line - 1;
while (startLineNumber > 0) {
const lineText = document.lineAt(startLineNumber).text;
if (lineText.trim().endsWith(",")) {
return true;
}
// If there are other characters, then don't bother.
if (lineText.trim().length !== 0) {
return false;
}
startLineNumber -= 1;
}
return false;
return previousToken === SyntaxKind.CommaToken;
}

private static isConfigurationArrayEmpty(document: TextDocument): boolean {
Expand Down
85 changes: 70 additions & 15 deletions src/common/packager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,10 @@ export class Packager {
}

public async start(resetCache: boolean = false): Promise<void> {
this.clearExitedPackagerProcess();
this.packagerStatusIndicator.updatePackagerStatus(PackagerStatus.PACKAGER_STARTING);
let executedStartPackagerCmd = false;
let startedProcess: ChildProcess | undefined;
let rnVersion: string;
let reactEnv = {};
if (!(await this.isRunning())) {
Expand Down Expand Up @@ -310,9 +312,15 @@ export class Packager {
).spawnExpoPackager(["--web"]);
}

this.packagerProcess = packagerSpawnResult.spawnedProcess;

packagerSpawnResult.outcome.catch(() => {}); // We ignore all outcome errors
const spawnedProcess = packagerSpawnResult.spawnedProcess;
this.packagerProcess = startedProcess = spawnedProcess;
void packagerSpawnResult.outcome.then(
() => this.clearPackagerProcess(spawnedProcess),
error => {
this.logger.debug(String(error));
this.clearPackagerProcess(spawnedProcess);
},
);
}

if (await this.stopWithlowNode(reactEnv)) {
Expand All @@ -322,7 +330,7 @@ export class Packager {
);
}
await this.verifiyTSVersion();
await this.awaitStart();
await this.awaitStart(startedProcess);
if (executedStartPackagerCmd) {
this.logger.info(localize("PackagerStarted", "Packager started."));
this.packagerStatus = PackagerStatus.PACKAGER_STARTED;
Expand Down Expand Up @@ -359,6 +367,7 @@ export class Packager {
}

public async stop(silent: boolean = false): Promise<boolean> {
this.clearExitedPackagerProcess();
this.packagerStatusIndicator.updatePackagerStatus(PackagerStatus.PACKAGER_STOPPING);
let successfullyStopped = false;

Expand All @@ -382,6 +391,9 @@ export class Packager {
successfullyStopped = true;
}
} else {
if (this.packagerProcess) {
await this.killPackagerProcess();
}
if (!silent) {
this.logger.warning(
ErrorHelper.getWarning(
Expand All @@ -392,11 +404,6 @@ export class Packager {
successfullyStopped = true;
}
this.setPackagerStopStateUI();
void vscode.commands.executeCommand(
"setContext",
CONTEXT_VARIABLES_NAMES.IS_RN_PACKAGER_RUNNING,
false,
);
return successfullyStopped;
}

Expand Down Expand Up @@ -510,17 +517,39 @@ export class Packager {
});
}

private async awaitStart(retryCount = 60, delay = 3000): Promise<void> {
private async awaitStart(
packagerProcess?: ChildProcess,
retryCount = 60,
delay = 3000,
): Promise<void> {
const failure = localize("CouldNotStartPackager", "Could not start the packager.");
const checkProcess = () => {
if (
packagerProcess &&
(this.packagerProcess !== packagerProcess ||
("exitCode" in packagerProcess && packagerProcess.exitCode !== null) ||
("signalCode" in packagerProcess && packagerProcess.signalCode !== null))
) {
throw new Error(failure);
}
};
try {
await PromiseUtil.retryAsync(
() => this.isRunning(),
async () => {
checkProcess();
const running = await this.isRunning();
checkProcess();
return running;
},
running => running,
retryCount,
delay,
localize("CouldNotStartPackager", "Could not start the packager."),
failure,
);
} catch (error) {
this.setPackagerStopStateUI();
if (!this.packagerProcess || this.packagerProcess === packagerProcess) {
this.setPackagerStopStateUI();
}
throw error;
}
}
Expand Down Expand Up @@ -675,6 +704,29 @@ export class Packager {
private setPackagerStopStateUI() {
this.packagerStatus = PackagerStatus.PACKAGER_STOPPED;
this.packagerStatusIndicator.updatePackagerStatus(PackagerStatus.PACKAGER_STOPPED);
void vscode.commands.executeCommand(
"setContext",
CONTEXT_VARIABLES_NAMES.IS_RN_PACKAGER_RUNNING,
false,
);
}

private clearExitedPackagerProcess(): void {
const packagerProcess = this.packagerProcess;
if (
packagerProcess &&
(("exitCode" in packagerProcess && packagerProcess.exitCode !== null) ||
("signalCode" in packagerProcess && packagerProcess.signalCode !== null))
) {
this.clearPackagerProcess(packagerProcess);
}
}

private clearPackagerProcess(packagerProcess: ChildProcess): void {
if (this.packagerProcess === packagerProcess) {
this.packagerProcess = undefined;
this.setPackagerStopStateUI();
}
}

private async killPackagerProcess(): Promise<void> {
Expand All @@ -684,10 +736,13 @@ export class Packager {
this.projectPath,
);

const packagerProcess = this.packagerProcess;
await new CommandExecutor(nodeModulesRoot, this.projectPath, this.logger).killReactPackager(
this.packagerProcess,
packagerProcess,
);
this.packagerProcess = undefined;
if (packagerProcess) {
this.clearPackagerProcess(packagerProcess);
}
if (
await new ExponentHelper(this.workspacePath, this.projectPath).isExpoManagedApp(false)
) {
Expand Down
9 changes: 7 additions & 2 deletions src/extension/android/adb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,13 @@ export class AdbHelper {
]);
}

public installApplicationToEmulator(appPath: string): Promise<string> {
return this.childProcess.execFileToString("adb", ["install", appPath]);
public installApplicationToEmulator(appPath: string, deviceId: string): Promise<string> {
return this.childProcess.execFileToString(this.adbExecutable, [
"-s",
deviceId,
"install",
appPath,
]);
}

public executeQuery(deviceId: string, args: string[]): Promise<string> {
Expand Down
13 changes: 7 additions & 6 deletions src/extension/commands/configEASBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
// Licensed under the MIT license. See LICENSE file in the project root for details.

import assert = require("assert");
import * as path from "path";
import * as nls from "vscode-nls";
import { OutputChannelLogger } from "../log/OutputChannelLogger";
import { ErrorHelper } from "../../common/error/errorHelper";
import { InternalErrorCode } from "../../common/error/internalErrorCode";
import { CommandExecutor } from "../../common/commandExecutor";
import { ChildProcess } from "../../common/node/childProcess";
import { FileSystem } from "../../common/node/fileSystem";
import { ReactNativeCommand } from "./util/reactNativeCommand";

Expand All @@ -18,7 +19,6 @@ const localize = nls.loadMessageBundle();
const logger = OutputChannelLogger.getMainChannel();

export class ConfigEASBuild extends ReactNativeCommand {
nodeModulesRoot!: string;
codeName = "createExpoEASBuildConfigFile";
label = "Config Expo app with EAS build";
error = ErrorHelper.getInternalError(InternalErrorCode.FailedToConfigEASBuild);
Expand All @@ -32,7 +32,7 @@ export class ConfigEASBuild extends ReactNativeCommand {

if (isExpo) {
const fs = new FileSystem();
const exists = await fs.exists(`${projectRootPath}/eas.json`);
const exists = await fs.exists(path.join(projectRootPath, "eas.json"));
if (exists) {
logger.info(
localize(
Expand All @@ -46,8 +46,9 @@ export class ConfigEASBuild extends ReactNativeCommand {
);

try {
await new CommandExecutor(this.nodeModulesRoot, projectRootPath).execute(
"eas build:configure --platform all",
await new ChildProcess().execToString(
"npx eas-cli build:configure --platform all",
{ cwd: projectRootPath },
);

logger.info(
Expand All @@ -60,7 +61,7 @@ export class ConfigEASBuild extends ReactNativeCommand {
logger.error(
localize(
"NoExistingEASProject",
"Unable to find existing EAS project. Please run 'eas init' firstly to bind your app to EAS project.",
"Unable to find existing EAS project. Please run 'npx eas-cli init' firstly to bind your app to EAS project.",
),
);
throw error;
Expand Down
6 changes: 2 additions & 4 deletions src/extension/commands/launchExpoWeb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class launchExpoWeb extends Command {
label = "Launch ExpoWeb";
error = ErrorHelper.getInternalError(InternalErrorCode.FailedToLaunchExpoWeb);

async baseFn(): Promise<any> {
async baseFn(): Promise<void> {
assert(this.project);
const expoHelper = this.project.getExponentHelper();
logger.info(localize("CheckExpoEnvironment", "Checking Expo project environment."));
Expand All @@ -33,12 +33,10 @@ export class launchExpoWeb extends Command {
}
}

async function runExpoWeb(project: AppLauncher) {
async function runExpoWeb(project: AppLauncher): Promise<void> {
const platform = new ExponentPlatform(getRunOptions(project, PlatformType.ExpoWeb), {
packager: project.getPackager(),
});
platform;

await platform.beforeStartPackager();
await platform.startPackager();
}
2 changes: 1 addition & 1 deletion src/extension/commands/openEASProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class OpenEASProject extends ReactNativeCommand {
const id = await expoHelper.getExpoEasProjectId();
const owner = await expoHelper.getExpoEasProjectOwner();
const slug = await expoHelper.getExpoEasProjectSlug();
if (id == null || owner == null) {
if (id === null || id === undefined || owner === null || owner === undefined) {
const error = localize(
"ExpoProjectNotLinkToEAS",
"Your app not link to EAS project. Please run 'eas init' firstly to bind your app to EAS project.",
Expand Down
Loading
Loading