* Write env vars to a temp Docker `--env-file` (KEY=VALUE per line). Values * containing newlines are skipped (the env-file format is line-based and can't * represent them). Returns the file path.
(env: Record<string, string>)
| 72 | * represent them). Returns the file path. |
| 73 | */ |
| 74 | function writeEnvFile(env: Record<string, string>): string { |
| 75 | const dir = mkdtempSync(path.join(tmpdir(), 'vercel-container-dev-env-')); |
| 76 | const file = path.join(dir, 'env'); |
| 77 | const lines: string[] = []; |
| 78 | for (const [key, value] of Object.entries(env)) { |
| 79 | if (value.includes('\n')) { |
| 80 | continue; |
| 81 | } |
| 82 | lines.push(`${key}=${value}`); |
| 83 | } |
| 84 | writeFileSync(file, `${lines.join('\n')}\n`); |
| 85 | return file; |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Sink for all dev output. `vercel dev` runs many services in parallel and |
no test coverage detected