@@ -11,7 +11,7 @@ import { readFileSync } from 'node:fs';
1111import { readFile , rm , writeFile } from 'node:fs/promises' ;
1212import { basename } from 'node:path' ;
1313
14- import { $ , type Build , build , fileURLToPath } from 'bun' ;
14+ import { type Build , build , fileURLToPath } from 'bun' ;
1515
1616import { version } from '../package.json' with { type : 'json' } ;
1717
@@ -21,6 +21,7 @@ const targets = (() => {
2121 //
2222 'bun-windows-x64' ,
2323 'bun-windows-x64-baseline' ,
24+ 'bun-windows-arm64' ,
2425 'bun-linux-x64' ,
2526 'bun-linux-x64-baseline' ,
2627 'bun-linux-arm64' ,
@@ -31,13 +32,16 @@ const targets = (() => {
3132 'bun-darwin-arm64-baseline' ,
3233 'bun-linux-x64-musl' ,
3334 'bun-linux-arm64-musl' ,
34- // TODO: when adding native windows arm64 builds, remove these too
3535 'bun-linux-x64-musl-baseline' as never ,
3636 'bun-linux-arm64-musl-baseline' as never ,
3737 ] satisfies Build . CompileTarget [ ] ;
3838 }
3939
4040 if ( process . platform === 'win32' ) {
41+ if ( process . arch === 'arm64' ) {
42+ return [ 'bun-windows-arm64' ] satisfies Build . CompileTarget [ ] ;
43+ }
44+
4145 return [ 'bun-windows-x64' , 'bun-windows-x64-baseline' ] satisfies Build . CompileTarget [ ] ;
4246 }
4347
@@ -117,24 +121,6 @@ for (const entryPoint of entryPoints) {
117121 baseline = 'baseline' ;
118122 }
119123
120- // If we are building on Windows ARM64, even though the target is x64, we mark it as "arm64" (there are some weird errors when compiling on x64
121- // and running on arm64). Hopefully bun will get arm64 native builds
122- // TODO: Vlad remove this in a subsequent PR as Bun now has native arm64 windows builds
123- if ( os === 'windows' && process . platform === 'win32' ) {
124- const systemType = await $ `pwsh -c "(Get-CimInstance Win32_ComputerSystem).SystemType"` . text ( ) ;
125-
126- if ( systemType . toLowerCase ( ) . includes ( 'arm' ) ) {
127- arch = 'arm64' ;
128-
129- // On arm, process.arch will still return x64, which will break the upgrade command.
130- // So we override the arch to arm64
131-
132- const newNewContent = newContent . replace ( 'process.env.APIFY_BUNDLE_ARCH' , '"arm64"' ) ;
133-
134- await writeFile ( metadataFile , newNewContent ) ;
135- }
136- }
137-
138124 const fileName = `${ cliName } -${ version } -${ os } -${ arch } ${ musl ? '-musl' : '' } ${ baseline ? '-baseline' : '' } ` ;
139125
140126 const outFile = fileURLToPath ( new URL ( `../bundles/${ fileName } ` , import . meta. url ) ) ;
@@ -155,9 +141,6 @@ for (const entryPoint of entryPoints) {
155141 } ,
156142 bytecode : true ,
157143 } ) ;
158-
159- // Remove the arch override
160- await writeFile ( metadataFile , newContent ) ;
161144 }
162145}
163146
0 commit comments