refactor: share plugin setup helpers

This commit is contained in:
Peter Steinberger
2026-03-26 18:34:51 +00:00
parent c98addeadd
commit cca577a0cc
10 changed files with 88 additions and 144 deletions

View File

@@ -1,7 +1,10 @@
import { isWSL, isWSLEnv } from "../infra/wsl.js";
import { isRemoteEnvironment } from "../infra/remote-env.js";
import { isWSL } from "../infra/wsl.js";
import { runCommandWithTimeout } from "../process/exec.js";
import { detectBinary } from "./setup-binary.js";
export { isRemoteEnvironment } from "../infra/remote-env.js";
function shouldSkipBrowserOpenInTests(): boolean {
if (process.env.VITEST) {
return true;
@@ -61,27 +64,6 @@ async function resolveBrowserOpenCommand(): Promise<BrowserOpenCommand> {
return { argv: null };
}
export function isRemoteEnvironment(): boolean {
if (process.env.SSH_CLIENT || process.env.SSH_TTY || process.env.SSH_CONNECTION) {
return true;
}
if (process.env.REMOTE_CONTAINERS || process.env.CODESPACES) {
return true;
}
if (
process.platform === "linux" &&
!process.env.DISPLAY &&
!process.env.WAYLAND_DISPLAY &&
!isWSLEnv()
) {
return true;
}
return false;
}
export async function openUrl(url: string): Promise<boolean> {
if (shouldSkipBrowserOpenInTests()) {
return false;