@@ -15,6 +15,7 @@ const root = path.resolve(packageRoot, "../..")
1515const upstreamRoot = path . join ( packageRoot , "upstream" )
1616const artifactsDir = path . join ( root , process . env . ARTIFACTS_OUTPUT_DIR || path . join ( "artifacts" , "omniroute" ) )
1717const releaseWorkspace = path . join ( root , "release" , "omniroute" )
18+ const windowsHomeRoot = path . join ( root , ".tmp" , "omniroute-windows-home" )
1819const packageId = "omniroute"
1920const platform = normalizePlatform ( process . env . BUILD_ARTIFACTS_PLATFORM || process . platform )
2021const 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
182184function 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+
194223async function patchWindowsPrepublishCommands ( ) {
195224 const scriptPath = path . join ( upstreamRoot , "scripts" , "prepublish.ts" )
196225 const script = await readFile ( scriptPath , "utf8" )
0 commit comments