| 1 | import assert from "assert"; |
| 2 | import type { Config } from "./types"; |
| 3 | |
| 4 | export function envReplacingCwdValues(env: Config["env"], dir: string) { |
| 5 | assert(env); |
| 6 | const newEnv = { ...env }; |
| 7 | for (const key of Object.keys(newEnv) as (keyof typeof newEnv)[]) { |
| 8 | if (newEnv[key] && newEnv[key] === "__CWD") { |
| 9 | newEnv[key] = dir; |
| 10 | } |
| 11 | } |
| 12 | return newEnv; |
| 13 | } |