|
15 | 15 | "hash": [ |
16 | 16 | "7a77b3e245e2e26965c93089a4a1332e8a326d3364c89fae1d1fd99cdd3cd73d", |
17 | 17 | "715709c69b176e20994533d3292bd0b7c32de9c0c5575b916746ec6b2aa38346" |
18 | | - ], |
19 | | - "pre_install": [ |
20 | | - "$avx2 = Start-Job -ScriptBlock {", |
21 | | - " Add-Type -MemberDefinition '[DllImport(\"kernel32.dll\")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);' -Name Kernel32 -Namespace Win32", |
22 | | - " return [Win32.Kernel32]::IsProcessorFeaturePresent(40)", |
23 | | - "} | Receive-Job -Wait -AutoRemoveJob", |
24 | | - "$target = 'bun-windows-x64'", |
25 | | - "if (-not $avx2) {", |
26 | | - " $target += '-baseline'", |
27 | | - "}", |
28 | | - "Move-Item \"$dir\\$target\\bun.exe\" \"$dir\\bun.exe\"", |
29 | | - "Remove-Item \"$dir\\bun-windows-*\" -Recurse" |
30 | 18 | ] |
31 | 19 | }, |
32 | 20 | "arm64": { |
33 | 21 | "url": "https://github.com/oven-sh/bun/releases/download/bun-v1.3.10/bun-windows-aarch64.zip", |
34 | | - "hash": "6822f3aa7bd2be40fb94c194a1185aae1c6fade54ca4fc2efdc722e37f3257d2", |
35 | | - "extract_dir": "bun-windows-aarch64" |
| 22 | + "hash": "6822f3aa7bd2be40fb94c194a1185aae1c6fade54ca4fc2efdc722e37f3257d2" |
36 | 23 | } |
37 | 24 | }, |
| 25 | + "pre_install": [ |
| 26 | + "# Migrate legacy Bun data if it exists and the new persist directory doesn't exist", |
| 27 | + "$legacy_bun = Join-Path -Path $env:USERPROFILE -ChildPath '.bun'", |
| 28 | + "if ((Test-Path $legacy_bun) -and -not (Test-Path $persist_dir)) {", |
| 29 | + " Write-Host \"Migrating legacy Bun data from '$legacy_bun' to '$persist_dir'.\" -ForegroundColor Yellow", |
| 30 | + " Move-Item $legacy_bun $persist_dir -Force", |
| 31 | + "} elseif ((Test-Path $legacy_bun) -and (Test-Path $persist_dir)) {", |
| 32 | + " Write-Host \"Found both '$legacy_bun' and '$persist_dir'. Skipping auto-migration; please migrate manually if needed.\" -ForegroundColor Yellow", |
| 33 | + "}", |
| 34 | + "", |
| 35 | + "# Extract the appropriate binary based on architecture and CPU features", |
| 36 | + "if ($architecture -eq 'arm64') {", |
| 37 | + " $target = 'bun-windows-aarch64'", |
| 38 | + "} else {", |
| 39 | + " $avx2 = Start-Job -ScriptBlock {", |
| 40 | + " Add-Type -MemberDefinition '[DllImport(\"kernel32.dll\")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);' -Name Kernel32 -Namespace Win32", |
| 41 | + " return [Win32.Kernel32]::IsProcessorFeaturePresent(40)", |
| 42 | + " } | Receive-Job -Wait -AutoRemoveJob", |
| 43 | + " $target = 'bun-windows-x64'", |
| 44 | + " if (-not $avx2) {", |
| 45 | + " $target += '-baseline'", |
| 46 | + " }", |
| 47 | + "}", |
| 48 | + "Move-Item \"$dir\\$target\\bun.exe\" \"$dir\\bun.exe\"", |
| 49 | + "Remove-Item \"$dir\\bun-windows-*\" -Recurse" |
| 50 | + ], |
| 51 | + "env_add_path": "bin", |
| 52 | + "env_set": { |
| 53 | + "BUN_INSTALL": "$persist_dir" |
| 54 | + }, |
38 | 55 | "bin": [ |
39 | 56 | "bun.exe", |
40 | 57 | [ |
|
43 | 60 | "x" |
44 | 61 | ] |
45 | 62 | ], |
| 63 | + "persist": [ |
| 64 | + "bin", |
| 65 | + "install" |
| 66 | + ], |
46 | 67 | "checkver": { |
47 | 68 | "github": "https://github.com/oven-sh/bun", |
48 | 69 | "re": "bun-v([\\d.]+)" |
|
0 commit comments