mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-10-07 16:38:34 +08:00
Fix Windows dev script startup (#199)
* Fix Windows dev script startup * Run CI on Windows * Disable npm cache on Windows CI
This commit is contained in:
+10
-10
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Static-frontend Development Stack
|
||||
*
|
||||
@@ -37,10 +36,10 @@
|
||||
* - OH_SECRET_KEY: Session secret key
|
||||
*/
|
||||
|
||||
import { spawn, spawnSync, execSync } from "node:child_process";
|
||||
import { spawn, spawnSync } from "node:child_process";
|
||||
import { existsSync } from "node:fs";
|
||||
import { join, resolve, dirname } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { fileURLToPath, pathToFileURL } from "node:url";
|
||||
import { setTimeout as delay } from "node:timers/promises";
|
||||
import process from "node:process";
|
||||
|
||||
@@ -178,12 +177,12 @@ NOTES:
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
|
||||
function commandExists(cmd) {
|
||||
try {
|
||||
execSync(`command -v ${cmd}`, { stdio: "pipe" });
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
const result =
|
||||
process.platform === "win32"
|
||||
? spawnSync("where.exe", [cmd], { stdio: "pipe" })
|
||||
: spawnSync("sh", ["-c", `command -v ${cmd}`], { stdio: "pipe" });
|
||||
|
||||
return result.status === 0;
|
||||
}
|
||||
|
||||
function checkPrerequisites() {
|
||||
@@ -653,7 +652,8 @@ export { buildFrontend, startStaticServer };
|
||||
// Main entry point (only when run directly, not when imported)
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
|
||||
const isMainModule = import.meta.url === `file://${process.argv[1]}`;
|
||||
const isMainModule =
|
||||
process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href;
|
||||
|
||||
if (isMainModule) {
|
||||
main().catch((err) => {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Development Stack with Automation Service
|
||||
*
|
||||
@@ -38,10 +37,10 @@
|
||||
* as OPENHANDS_AUTOMATION_API_KEY, making it available to agents in conversations.
|
||||
*/
|
||||
|
||||
import { spawn, execSync } from "node:child_process";
|
||||
import { spawn, spawnSync } from "node:child_process";
|
||||
import { mkdirSync } from "node:fs";
|
||||
import { join, resolve, dirname } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { fileURLToPath, pathToFileURL } from "node:url";
|
||||
import { homedir } from "node:os";
|
||||
import { setTimeout as delay } from "node:timers/promises";
|
||||
import process from "node:process";
|
||||
@@ -271,12 +270,12 @@ function buildConfig(args, env = process.env) {
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
|
||||
function commandExists(cmd) {
|
||||
try {
|
||||
execSync(`command -v ${cmd}`, { stdio: "pipe" });
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
const result =
|
||||
process.platform === "win32"
|
||||
? spawnSync("where.exe", [cmd], { stdio: "pipe" })
|
||||
: spawnSync("sh", ["-c", `command -v ${cmd}`], { stdio: "pipe" });
|
||||
|
||||
return result.status === 0;
|
||||
}
|
||||
|
||||
function checkPrerequisites() {
|
||||
@@ -717,7 +716,8 @@ export {
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
|
||||
// Check if this module is the main entry point
|
||||
const isMainModule = import.meta.url === `file://${process.argv[1]}`;
|
||||
const isMainModule =
|
||||
process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href;
|
||||
|
||||
if (isMainModule) {
|
||||
main().catch((err) => {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Combined static file server + reverse proxy.
|
||||
*
|
||||
@@ -32,6 +31,7 @@ import { createReadStream } from "node:fs";
|
||||
import { stat } from "node:fs/promises";
|
||||
import { extname, normalize, resolve } from "node:path";
|
||||
import process from "node:process";
|
||||
import { pathToFileURL } from "node:url";
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
// MIME types
|
||||
@@ -408,7 +408,8 @@ export function startStaticServer(config) {
|
||||
// Main
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
const isMainModule = import.meta.url === `file://${process.argv[1]}`;
|
||||
const isMainModule =
|
||||
process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href;
|
||||
|
||||
if (isMainModule) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user