mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-19 20:00:48 +00:00
repo: push all current workspace changes
This commit is contained in:
parent
252fbdc93b
commit
e7dfff5836
29 changed files with 577 additions and 98 deletions
|
|
@ -2,15 +2,22 @@ import { execSync } from "node:child_process";
|
|||
import { cpSync, readFileSync, writeFileSync, rmSync, existsSync } from "node:fs";
|
||||
import { resolve, dirname } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { createFoundryLogger } from "@sandbox-agent/foundry-shared";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const desktopRoot = resolve(__dirname, "..");
|
||||
const repoRoot = resolve(desktopRoot, "../../..");
|
||||
const frontendDist = resolve(desktopRoot, "../frontend/dist");
|
||||
const destDir = resolve(desktopRoot, "frontend-dist");
|
||||
const logger = createFoundryLogger({
|
||||
service: "foundry-desktop-build",
|
||||
bindings: {
|
||||
script: "build-frontend",
|
||||
},
|
||||
});
|
||||
|
||||
function run(cmd: string, opts?: { cwd?: string; env?: NodeJS.ProcessEnv }) {
|
||||
console.log(`> ${cmd}`);
|
||||
logger.info({ command: cmd, cwd: opts?.cwd ?? repoRoot }, "run_command");
|
||||
execSync(cmd, {
|
||||
stdio: "inherit",
|
||||
cwd: opts?.cwd ?? repoRoot,
|
||||
|
|
@ -19,7 +26,7 @@ function run(cmd: string, opts?: { cwd?: string; env?: NodeJS.ProcessEnv }) {
|
|||
}
|
||||
|
||||
// Step 1: Build the frontend with the desktop-specific backend endpoint
|
||||
console.log("\n=== Building frontend for desktop ===\n");
|
||||
logger.info("building_frontend");
|
||||
run("pnpm --filter @sandbox-agent/foundry-frontend build", {
|
||||
env: {
|
||||
VITE_HF_BACKEND_ENDPOINT: "http://127.0.0.1:7741/v1/rivet",
|
||||
|
|
@ -27,7 +34,7 @@ run("pnpm --filter @sandbox-agent/foundry-frontend build", {
|
|||
});
|
||||
|
||||
// Step 2: Copy dist to frontend-dist/
|
||||
console.log("\n=== Copying frontend build output ===\n");
|
||||
logger.info({ frontendDist, destDir }, "copying_frontend_dist");
|
||||
if (existsSync(destDir)) {
|
||||
rmSync(destDir, { recursive: true });
|
||||
}
|
||||
|
|
@ -39,4 +46,4 @@ let html = readFileSync(indexPath, "utf-8");
|
|||
html = html.replace(/<script\s+src="https:\/\/unpkg\.com\/react-scan\/dist\/auto\.global\.js"[^>]*><\/script>\s*/g, "");
|
||||
writeFileSync(indexPath, html);
|
||||
|
||||
console.log("\n=== Frontend build complete ===\n");
|
||||
logger.info({ indexPath }, "frontend_build_complete");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue