Files
deepseek-harness/apps/desktop/src/node-environment.ts
T

20 lines
809 B
TypeScript

/** Electron's Node mode inherited by the Host, pnpm, and their subprocesses. */
import { delimiter } from 'node:path'
/**
* Select Electron's Node mode and the shell launcher used by package scripts.
* @param executable - Electron executable running the application.
* @param bin - Directory containing the node shell launcher.
* @param environment - Caller environment preserved for plugin execution.
* @returns Environment for a Node-mode child process.
*/
export function desktopNodeEnvironment(executable: string, bin: string | undefined, environment: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
return {
...environment,
ELECTRON_RUN_AS_NODE: '1',
DSH_DESKTOP_NODE_EXECUTABLE: executable,
...(bin === undefined ? {} : { PATH: `${bin}${delimiter}${environment.PATH ?? ''}` }),
}
}