diff --git a/firebase-vscode/src/cli.ts b/firebase-vscode/src/cli.ts index 74d3a03f64b..beae5b8a777 100644 --- a/firebase-vscode/src/cli.ts +++ b/firebase-vscode/src/cli.ts @@ -14,17 +14,13 @@ import { requireAuth } from "../../src/requireAuth"; import { deploy } from "../../src/deploy"; import { getDefaultHostingSite } from "../../src/getDefaultHostingSite"; import { initAction } from "../../src/commands/init"; -import { startAll as startAllEmulators, cleanShutdown as stopAllEmulators } from "../../src/emulator/controller"; -import { EmulatorRegistry } from "../../src/emulator/registry"; -import { EmulatorInfo, Emulators } from "../../src/emulator/types"; import { Account, User } from "../../src/types/auth"; import { Options } from "../../src/options"; import { currentOptions, getCommandOptions } from "./options"; import { setInquirerOptions } from "./stubs/inquirer-stub"; import { ServiceAccount } from "../common/types"; import { listChannels } from "../../src/hosting/api"; -import * as commandUtils from "../../src/emulator/commandUtils"; -import { EmulatorUiSelections, ChannelWithId } from "../common/messaging/types"; +import { ChannelWithId } from "../common/messaging/types"; import { pluginLogger } from "./logger-wrapper"; import { Config } from "../../src/config"; @@ -170,33 +166,6 @@ export async function initHosting( setInquirerOptions(inquirerOptions); await initAction("hosting", commandOptions); } - -export async function emulatorsStart(emulatorUiSelections: EmulatorUiSelections) { - const commandOptions = await getCommandOptions(undefined, { - ...currentOptions, - project: emulatorUiSelections.projectId, - exportOnExit: emulatorUiSelections.exportStateOnExit, - import: emulatorUiSelections.importStateFolderPath, - only: emulatorUiSelections.mode === "hosting" ? "hosting" : "" - }); - // Adjusts some options, export on exit can be a boolean or a path. - commandUtils.setExportOnExitOptions(commandOptions as commandUtils.ExportOnExitOptions); - return startAllEmulators(commandOptions, /*showUi=*/ true); -} - -export async function stopEmulators() { - await stopAllEmulators(); -} - -export function listRunningEmulators(): EmulatorInfo[] { - return EmulatorRegistry.listRunningWithInfo(); -} - -export function getEmulatorUiUrl(): string | undefined { - const url: URL = EmulatorRegistry.url(Emulators.UI); - return url.hostname === "unknown" ? undefined : url.toString(); -} - export async function deployToHosting( firebaseJSON: Config, deployTarget: string diff --git a/firebase-vscode/src/extension.ts b/firebase-vscode/src/extension.ts index 368fecf5afb..7cc25c41d76 100644 --- a/firebase-vscode/src/extension.ts +++ b/firebase-vscode/src/extension.ts @@ -11,7 +11,6 @@ import { import { setupSidebar } from "./sidebar"; import { setupWorkflow } from "./workflow"; import { pluginLogger } from "./logger-wrapper"; -import { onShutdown } from "./workflow"; const broker = createBroker< ExtensionToWebviewParamsMap, @@ -26,9 +25,3 @@ export function activate(context: vscode.ExtensionContext) { setupWorkflow(context, broker); setupSidebar(context, broker); } - -// This method is called when the extension is deactivated -export async function deactivate() { - // This await is optimistic but it might wait for a moment longer while we run cleanup activities - await onShutdown(); -} diff --git a/firebase-vscode/src/workflow.ts b/firebase-vscode/src/workflow.ts index ce23f0b23d1..7ec6186cc6f 100644 --- a/firebase-vscode/src/workflow.ts +++ b/firebase-vscode/src/workflow.ts @@ -9,16 +9,12 @@ import { FirebaseProjectMetadata } from "../../src/types/project"; import { ExtensionBrokerImpl } from "./extension-broker"; import { deployToHosting, - emulatorsStart, getAccounts, getChannels, - getEmulatorUiUrl, initHosting, listProjects, - listRunningEmulators, login, logoutUser, - stopEmulators, } from "./cli"; import { User } from "../../src/types/auth"; import { currentOptions } from "./options"; @@ -364,47 +360,4 @@ export async function setupWorkflow( { projectId, folderPath: currentOptions.cwd }); await fetchChannels(true); } - broker.on( - "launchEmulators", - async ({ emulatorUiSelections }) => { - await emulatorsStart(emulatorUiSelections); - broker.send("notifyRunningEmulatorInfo", { uiUrl: getEmulatorUiUrl(), displayInfo: listRunningEmulators() }); - } - ); - - broker.on( - "stopEmulators", - async () => { - await stopEmulators(); - // Update the UI - broker.send("notifyEmulatorsStopped"); - } - ); - - broker.on( - "selectEmulatorImportFolder", - async () => { - const options: vscode.OpenDialogOptions = { - canSelectMany: false, - openLabel: `Pick an import folder`, - title: `Pick an import folder`, - canSelectFiles: false, - canSelectFolders: true, - }; - const fileUri = await vscode.window.showOpenDialog(options); - // Update the UI of the selection - if (!fileUri || fileUri.length < 1) { - vscode.window.showErrorMessage("Invalid import folder selected."); - return; - } - broker.send("notifyEmulatorImportFolder", { folder: fileUri[0].fsPath }); - } - ); -} - -/** - * Cleans up any open resources before shutting down. - */ -export async function onShutdown() { - await stopEmulators(); } diff --git a/firebase-vscode/webviews/SidebarApp.tsx b/firebase-vscode/webviews/SidebarApp.tsx index c5f9e9bd77d..5a5b4c61175 100644 --- a/firebase-vscode/webviews/SidebarApp.tsx +++ b/firebase-vscode/webviews/SidebarApp.tsx @@ -9,7 +9,6 @@ import { ServiceAccountUser } from "../common/types"; import { DeployPanel } from "./components/DeployPanel"; import { HostingState } from "./webview-types"; import { ChannelWithId } from "./messaging/types"; -import { EmulatorPanel } from "./components/EmulatorPanel"; import { webLogger } from "./globals/web-logger"; import { InitFirebasePanel } from "./components/InitPanel"; @@ -146,7 +145,6 @@ export function SidebarApp() { }} /> )} - {(!!userEmail && !!firebaseJson) && } ); }