fix(tauri): prune Bun from Linux app bundle

This commit is contained in:
Shantur Rathore
2026-04-20 23:14:16 +01:00
parent 4af8cc08b9
commit ca880451e7

View File

@@ -131,15 +131,30 @@ function ensureServerDevDependencies() {
} }
function ensureServerDependencies() { function ensureServerDependencies() {
if (fs.existsSync(braceExpansionPath)) { console.log("[prebuild] pruning server to production dependencies...")
return execSync("npm prune --omit=dev --ignore-scripts --workspaces=false --fund=false --audit=false", {
}
console.log("[prebuild] ensuring server production dependencies...")
execSync(serverInstallCommand, {
cwd: serverRoot, cwd: serverRoot,
stdio: "inherit", stdio: "inherit",
}) })
if (!fs.existsSync(braceExpansionPath)) {
console.log("[prebuild] restoring missing server production dependencies...")
execSync(serverInstallCommand, {
cwd: serverRoot,
stdio: "inherit",
})
}
}
function removeStaleStandaloneServerBuild() {
const staleNames = ["codenomad-server", "codenomad-server.exe"]
for (const name of staleNames) {
const stalePath = path.join(serverRoot, "dist", name)
if (fs.existsSync(stalePath)) {
fs.rmSync(stalePath, { force: true })
console.log(`[prebuild] removed stale standalone server artifact ${stalePath}`)
}
}
} }
function ensureUiDevDependencies() { function ensureUiDevDependencies() {
@@ -349,13 +364,14 @@ function copyUiLoadingAssets() {
await ensureMonacoAssets() await ensureMonacoAssets()
ensureRollupPlatformBinary() ensureRollupPlatformBinary()
ensureEsbuildPlatformBinary() ensureEsbuildPlatformBinary()
ensureServerDependencies()
ensureServerBuild() ensureServerBuild()
if (shouldBuildStandaloneServer()) { if (shouldBuildStandaloneServer()) {
ensureStandaloneServerBuild() ensureStandaloneServerBuild()
} else { } else {
removeStaleStandaloneServerBuild()
console.log("[prebuild] skipping standalone server executable for Linux packaging; linuxdeploy fails on the bundled ELF") console.log("[prebuild] skipping standalone server executable for Linux packaging; linuxdeploy fails on the bundled ELF")
} }
ensureServerDependencies()
ensureUiBuild() ensureUiBuild()
syncServerUiBundle() syncServerUiBundle()
copyServerArtifacts() copyServerArtifacts()