mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
Run daemon dev diagnostics on workers
This commit is contained in:
@@ -8,21 +8,8 @@ dotenv.config({
|
||||
});
|
||||
|
||||
const daemonRunnerEntry = fileURLToPath(new URL("./supervisor-entrypoint.ts", import.meta.url));
|
||||
const inspectArg = process.env.PASEO_NODE_INSPECT ?? "--inspect";
|
||||
const inspectArgs =
|
||||
inspectArg === "0" || inspectArg === "false" || inspectArg === "off" ? [] : [inspectArg];
|
||||
|
||||
const supervisorArgs = [
|
||||
...inspectArgs,
|
||||
"--heapsnapshot-near-heap-limit=3",
|
||||
"--max-old-space-size=3072",
|
||||
"--report-on-fatalerror",
|
||||
"--report-directory=/tmp/paseo-reports",
|
||||
...process.execArgv,
|
||||
daemonRunnerEntry,
|
||||
"--dev",
|
||||
...process.argv.slice(2),
|
||||
];
|
||||
const supervisorArgs = [...process.execArgv, daemonRunnerEntry, "--dev", ...process.argv.slice(2)];
|
||||
|
||||
const supervisor = spawn(process.execPath, supervisorArgs, {
|
||||
stdio: "inherit",
|
||||
|
||||
@@ -58,8 +58,22 @@ function resolveDevWorkerEntry(): string {
|
||||
return candidate;
|
||||
}
|
||||
|
||||
function resolveWorkerExecArgv(workerEntry: string): string[] {
|
||||
return workerEntry.endsWith(".ts") ? ["--import", "tsx"] : [];
|
||||
function resolveWorkerExecArgv(workerEntry: string, devMode: boolean): string[] {
|
||||
const execArgv = workerEntry.endsWith(".ts") ? ["--import", "tsx"] : [];
|
||||
if (!devMode) {
|
||||
return execArgv;
|
||||
}
|
||||
const devArgs = [
|
||||
"--heapsnapshot-near-heap-limit=3",
|
||||
"--max-old-space-size=3072",
|
||||
"--report-on-fatalerror",
|
||||
"--report-directory=/tmp/paseo-reports",
|
||||
];
|
||||
const inspectArg = process.env.PASEO_NODE_INSPECT ?? "--inspect";
|
||||
if (inspectArg !== "0" && inspectArg !== "false" && inspectArg !== "off") {
|
||||
devArgs.push(inspectArg);
|
||||
}
|
||||
return [...devArgs, ...execArgv];
|
||||
}
|
||||
|
||||
function resolvePackagedNodeEntrypointRunnerPath(currentScriptPath: string): string | null {
|
||||
@@ -77,7 +91,7 @@ function resolvePackagedNodeEntrypointRunnerPath(currentScriptPath: string): str
|
||||
async function main(): Promise<void> {
|
||||
const config = parseConfig(process.argv.slice(2));
|
||||
const workerEntry = config.devMode ? resolveDevWorkerEntry() : resolveWorkerEntry();
|
||||
const workerExecArgv = resolveWorkerExecArgv(workerEntry);
|
||||
const workerExecArgv = resolveWorkerExecArgv(workerEntry, config.devMode);
|
||||
const workerEnv: NodeJS.ProcessEnv = { ...process.env };
|
||||
const packagedNodeEntrypointRunner =
|
||||
process.env.ELECTRON_RUN_AS_NODE === "1"
|
||||
|
||||
Reference in New Issue
Block a user