Download tasks/linkedin/tests/oracle-runtime/clone/scripts/start-standalone.mjs from TIGER-Lab/WebsiteBench: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/datasets/TIGER-Lab/WebsiteBench/resolve/main/tasks/linkedin/tests/oracle-runtime/clone/scripts/start-standalone.mjs
- Command line
-
hf download hf://datasets/TIGER-Lab/WebsiteBench/tasks/linkedin/tests/oracle-runtime/clone/scripts/start-standalone.mjs
-
curl -L -o start-standalone.mjs https://huggingface.co/datasets/TIGER-Lab/WebsiteBench/resolve/main/tasks/linkedin/tests/oracle-runtime/clone/scripts/start-standalone.mjs
1.1 kB
| import { cp, mkdir } from "node:fs/promises"; | |
| import { existsSync } from "node:fs"; | |
| import { spawn } from "node:child_process"; | |
| import path from "node:path"; | |
| const root = process.cwd(); | |
| const standalone = path.join(root, ".next", "standalone"); | |
| const server = path.join(standalone, "server.js"); | |
| if (!existsSync(server)) { | |
| console.error("Standalone build not found. Run npm run build before npm start."); | |
| process.exit(1); | |
| } | |
| await mkdir(path.join(standalone, ".next"), { recursive: true }); | |
| await cp(path.join(root, ".next", "static"), path.join(standalone, ".next", "static"), { recursive: true, force: true }); | |
| if (existsSync(path.join(root, "public"))) { | |
| await cp(path.join(root, "public"), path.join(standalone, "public"), { recursive: true, force: true }); | |
| } | |
| const child = spawn(process.execPath, [server], { | |
| cwd: standalone, | |
| env: process.env, | |
| stdio: "inherit", | |
| }); | |
| for (const signal of ["SIGINT", "SIGTERM"]) { | |
| process.on(signal, () => child.kill(signal)); | |
| } | |
| child.on("exit", (code, signal) => { | |
| if (signal) process.kill(process.pid, signal); | |
| process.exit(code ?? 0); | |
| }); | |