release: bump version to 0.80.2
This commit is contained in:
1 parent
4b2004b7d8
commit
2c439b7235
26 files changed
+1329
-172
No files matched your search
@@ -2,6 +2,7 @@ import { spawnSync } from 'node:child_process'
|
||||
import {
|
||||
chmodSync,
|
||||
existsSync,
|
||||
mkdirSync,
|
||||
mkdtempSync,
|
||||
readdirSync,
|
||||
readFileSync,
|
||||
@@ -129,43 +130,87 @@ function resolveLinuxTargets() {
|
||||
return targets
|
||||
}
|
||||
|
||||
function runWinViaWindowsHost() {
|
||||
if (!isWsl()) return false
|
||||
const winProbeScript = [
|
||||
'$candidates = @(',
|
||||
' (Get-Command bun.exe -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Source),',
|
||||
' (Join-Path $env:USERPROFILE ".bun\\bin\\bun.exe"),',
|
||||
' (Join-Path $env:USERPROFILE "scoop\\shims\\bun.exe"),',
|
||||
' (Join-Path $env:LOCALAPPDATA "bun\\bin\\bun.exe")',
|
||||
') | Where-Object { $_ -and (Test-Path -LiteralPath $_) }',
|
||||
'$candidates | Select-Object -First 1',
|
||||
].join('; ')
|
||||
const winBunCheck = spawnSync('powershell.exe', ['-NoProfile', '-Command', winProbeScript], { encoding: 'utf8' })
|
||||
const winBunPath = (winBunCheck.stdout || '').trim().split(/\r?\n/)[0]?.trim() || ''
|
||||
const winPathRes = spawnSync('wslpath', ['-w', desktopRoot], { encoding: 'utf8' })
|
||||
const winDesktopRoot = (winPathRes.stdout || '').trim()
|
||||
if (winBunCheck.status !== 0 || !winBunPath || !winDesktopRoot) return false
|
||||
|
||||
console.log(`WSL2 detected; building Windows NSIS + portable installers via Windows host Bun (${winBunPath})...`)
|
||||
const psScript = [
|
||||
"$ErrorActionPreference = 'Stop'",
|
||||
`$env:ELECTRON_MIRROR = '${env.ELECTRON_MIRROR}'`,
|
||||
`$env:ELECTRON_BUILDER_BINARIES_MIRROR = '${env.ELECTRON_BUILDER_BINARIES_MIRROR}'`,
|
||||
`Set-Location -LiteralPath '${winDesktopRoot.replace(/'/g, "''")}'`,
|
||||
`& '${winBunPath.replace(/'/g, "''")}' x electron-builder --win nsis portable --publish never`,
|
||||
].join('; ')
|
||||
const winRun = spawnSync('powershell.exe', ['-NoProfile', '-Command', psScript], { stdio: 'inherit' })
|
||||
return (winRun.status ?? 1) === 0
|
||||
}
|
||||
|
||||
function runWinViaDockerWine() {
|
||||
if (!hasCommand('docker')) return false
|
||||
const image = process.env.PLANET_ELECTRON_BUILDER_IMAGE || 'electronuserland/builder:wine'
|
||||
const home = homedir()
|
||||
const electronCache = join(home, '.cache', 'electron')
|
||||
const builderCache = join(home, '.cache', 'electron-builder')
|
||||
mkdirSync(electronCache, { recursive: true })
|
||||
mkdirSync(builderCache, { recursive: true })
|
||||
const uid = typeof process.getuid === 'function' ? process.getuid() : 0
|
||||
const gid = typeof process.getgid === 'function' ? process.getgid() : 0
|
||||
|
||||
console.log(`Building Windows NSIS + portable installers via Docker Wine (${image})...`)
|
||||
const dockerCmd = [
|
||||
'run', '--rm',
|
||||
'-v', `${desktopRoot}:/project`,
|
||||
'-v', `${electronCache}:/root/.cache/electron`,
|
||||
'-v', `${builderCache}:/root/.cache/electron-builder`,
|
||||
'-e', `ELECTRON_MIRROR=${env.ELECTRON_MIRROR}`,
|
||||
'-e', `ELECTRON_BUILDER_BINARIES_MIRROR=${env.ELECTRON_BUILDER_BINARIES_MIRROR}`,
|
||||
'-w', '/project',
|
||||
image,
|
||||
'bash', '-lc',
|
||||
`./node_modules/.bin/electron-builder --win nsis portable --publish never; status=$?; chown -R ${uid}:${gid} /project/release 2>/dev/null || true; exit $status`,
|
||||
]
|
||||
const res = spawnSync('docker', dockerCmd, { stdio: 'inherit' })
|
||||
return (res.status ?? 1) === 0
|
||||
}
|
||||
|
||||
function runWinBuild() {
|
||||
if (process.platform === 'win32' || hasCommand('wine') || hasCommand('wine64')) {
|
||||
runBuilder(['--win', 'nsis', 'portable'])
|
||||
return
|
||||
}
|
||||
|
||||
if (isWsl()) {
|
||||
const winBunCheck = spawnSync(
|
||||
'powershell.exe',
|
||||
['-NoProfile', '-Command', 'Get-Command bun.exe -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Source'],
|
||||
{ encoding: 'utf8' },
|
||||
)
|
||||
const winBunPath = (winBunCheck.stdout || '').trim()
|
||||
const winPathRes = spawnSync('wslpath', ['-w', desktopRoot], { encoding: 'utf8' })
|
||||
const winDesktopRoot = (winPathRes.stdout || '').trim()
|
||||
if (winBunCheck.status === 0 && winBunPath && winDesktopRoot) {
|
||||
console.log('WSL2 detected without Wine; building Windows installers via Windows host toolchain...')
|
||||
const psScript = [
|
||||
"$ErrorActionPreference = 'Stop'",
|
||||
`$env:ELECTRON_MIRROR = '${env.ELECTRON_MIRROR}'`,
|
||||
`$env:ELECTRON_BUILDER_BINARIES_MIRROR = '${env.ELECTRON_BUILDER_BINARIES_MIRROR}'`,
|
||||
`Set-Location -LiteralPath '${winDesktopRoot.replace(/'/g, "''")}'`,
|
||||
'bun x electron-builder --win nsis portable --publish never',
|
||||
].join('; ')
|
||||
const winRun = spawnSync('powershell.exe', ['-NoProfile', '-Command', psScript], {
|
||||
stdio: 'inherit',
|
||||
})
|
||||
if ((winRun.status ?? 1) === 0) {
|
||||
return
|
||||
}
|
||||
console.warn('Windows host build fell back to unpacked/zip cross-build without Wine.')
|
||||
}
|
||||
} else {
|
||||
console.warn('Wine not available on Linux host: building standalone Windows zip bundle (win-unpacked + zip).')
|
||||
if (runWinViaWindowsHost()) {
|
||||
return
|
||||
}
|
||||
|
||||
runBuilder(['--win', 'zip', '--config.win.signAndEditExecutable=false'])
|
||||
if (runWinViaDockerWine()) {
|
||||
return
|
||||
}
|
||||
|
||||
if (process.env.PLANET_ALLOW_WIN_ZIP_FALLBACK === '1') {
|
||||
console.warn('PLANET_ALLOW_WIN_ZIP_FALLBACK=1 set without Wine/Docker/Windows Bun: building win zip without NSIS .exe.')
|
||||
runBuilder(['--win', 'zip', '--config.win.signAndEditExecutable=false'])
|
||||
return
|
||||
}
|
||||
|
||||
console.error(
|
||||
'Unable to build Windows NSIS (.exe) installer: install Wine (wine64), enable Docker (electronuserland/builder:wine), or install Windows bun.exe (or set PLANET_ALLOW_WIN_ZIP_FALLBACK=1 for zip-only).',
|
||||
)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
function runMacBuild() {
|
||||
@@ -177,7 +222,14 @@ function runMacBuild() {
|
||||
}
|
||||
}
|
||||
|
||||
if (mode === '--dir') {
|
||||
if (mode === '--hotfix') {
|
||||
const result = spawnSync(process.execPath, [join(__dirname, 'build-earth-bundle.mjs')], {
|
||||
cwd: desktopRoot,
|
||||
env,
|
||||
stdio: 'inherit',
|
||||
})
|
||||
process.exit(result.status ?? 1)
|
||||
} else if (mode === '--dir') {
|
||||
runBuilder(['--dir'])
|
||||
} else if (mode === '--linux') {
|
||||
runBuilder(['--linux', ...resolveLinuxTargets()])
|
||||
|
||||
Reference in new issue
Block a user