Skip to content

Commit 67cf84a

Browse files
newbe36524Copilot
andcommitted
fix: isolate OmniRoute Windows build home paths
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 3e2f098 commit 67cf84a

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

packages/omniroute/scripts/build-artifacts.mjs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const root = path.resolve(packageRoot, "../..")
1515
const upstreamRoot = path.join(packageRoot, "upstream")
1616
const artifactsDir = path.join(root, process.env.ARTIFACTS_OUTPUT_DIR || path.join("artifacts", "omniroute"))
1717
const releaseWorkspace = path.join(root, "release", "omniroute")
18+
const windowsHomeRoot = path.join(root, ".tmp", "omniroute-windows-home")
1819
const packageId = "omniroute"
1920
const platform = normalizePlatform(process.env.BUILD_ARTIFACTS_PLATFORM || process.platform)
2021
const arch = normalizeArch(process.env.ARCH || process.arch)
@@ -40,6 +41,7 @@ async function main() {
4041
await mkdir(releaseWorkspace, { recursive: true })
4142

4243
if (platform === "windows") {
44+
await ensureWindowsBuildHomes()
4345
await patchWindowsPrepublishCommands()
4446
}
4547

@@ -180,8 +182,21 @@ async function readUpstreamVersion() {
180182
}
181183

182184
function withBuildEnv(env, version) {
185+
const windowsEnv =
186+
platform === "windows"
187+
? {
188+
HOME: windowsHomeRoot,
189+
USERPROFILE: windowsHomeRoot,
190+
APPDATA: path.join(windowsHomeRoot, "AppData", "Roaming"),
191+
LOCALAPPDATA: path.join(windowsHomeRoot, "AppData", "Local"),
192+
TEMP: path.join(windowsHomeRoot, "Temp"),
193+
TMP: path.join(windowsHomeRoot, "Temp"),
194+
}
195+
: {}
196+
183197
return {
184198
...env,
199+
...windowsEnv,
185200
CI: "true",
186201
npm_config_fund: "false",
187202
npm_config_audit: "false",
@@ -191,6 +206,20 @@ function withBuildEnv(env, version) {
191206
}
192207
}
193208

209+
async function ensureWindowsBuildHomes() {
210+
const directories = [
211+
windowsHomeRoot,
212+
path.join(windowsHomeRoot, "AppData"),
213+
path.join(windowsHomeRoot, "AppData", "Roaming"),
214+
path.join(windowsHomeRoot, "AppData", "Local"),
215+
path.join(windowsHomeRoot, "Temp"),
216+
]
217+
218+
for (const directory of directories) {
219+
await mkdir(directory, { recursive: true })
220+
}
221+
}
222+
194223
async function patchWindowsPrepublishCommands() {
195224
const scriptPath = path.join(upstreamRoot, "scripts", "prepublish.ts")
196225
const script = await readFile(scriptPath, "utf8")

0 commit comments

Comments
 (0)