diff --git a/apps/desktop/electron-builder.yml b/apps/desktop/electron-builder.yml index 88170c7..bc7e91d 100644 --- a/apps/desktop/electron-builder.yml +++ b/apps/desktop/electron-builder.yml @@ -21,7 +21,7 @@ mac: - dmg category: public.app-category.productivity extraResources: - - from: ../server/out/server-darwin-arm64 + - from: ../server/out/server-darwin-${arch} to: server dmg: artifactName: ${productName}-${version}-${os}-${arch}.${ext} @@ -31,7 +31,7 @@ win: target: - portable extraResources: - - from: ../server/out/server-windows-x64.exe + - from: ../server/out/server-windows-${arch}.exe to: server.exe portable: artifactName: ${productName}-${version}-${os}-${arch}-Portable.${ext} @@ -42,7 +42,7 @@ linux: - AppImage category: Utility extraResources: - - from: ../server/out/server-linux-x64 + - from: ../server/out/server-linux-${arch} to: server appImage: artifactName: ${productName}-${version}-${os}-${arch}.${ext} diff --git a/apps/desktop/package.json b/apps/desktop/package.json index ebb9993..f4cb061 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -8,9 +8,13 @@ "build": "electron-vite build", "dev": "electron-vite dev --watch", "dist": "electron-builder", - "dist:linux": "electron-builder --linux", - "dist:mac": "electron-builder --mac", - "dist:win": "electron-builder --win", + "dist:linux": "bun run dist:linux:x64 && bun run dist:linux:arm64", + "dist:linux:arm64": "electron-builder --linux --arm64", + "dist:linux:x64": "electron-builder --linux --x64", + "dist:mac": "bun run dist:mac:arm64 && bun run dist:mac:x64", + "dist:mac:arm64": "electron-builder --mac --arm64", + "dist:mac:x64": "electron-builder --mac --x64", + "dist:win": "electron-builder --win --x64", "fix": "biome check --write", "typecheck": "tsc --noEmit" }, diff --git a/apps/desktop/turbo.json b/apps/desktop/turbo.json index 40e1d50..dd3958b 100644 --- a/apps/desktop/turbo.json +++ b/apps/desktop/turbo.json @@ -10,15 +10,39 @@ "outputs": ["dist/**"] }, "dist:linux": { - "dependsOn": ["build", "@furtherverse/server#compile:linux"], + "dependsOn": [ + "build", + "@furtherverse/server#compile:linux:arm64", + "@furtherverse/server#compile:linux:x64" + ], + "outputs": ["dist/**"] + }, + "dist:linux:arm64": { + "dependsOn": ["build", "@furtherverse/server#compile:linux:arm64"], + "outputs": ["dist/**"] + }, + "dist:linux:x64": { + "dependsOn": ["build", "@furtherverse/server#compile:linux:x64"], "outputs": ["dist/**"] }, "dist:mac": { - "dependsOn": ["build", "@furtherverse/server#compile:darwin"], + "dependsOn": [ + "build", + "@furtherverse/server#compile:darwin:arm64", + "@furtherverse/server#compile:darwin:x64" + ], + "outputs": ["dist/**"] + }, + "dist:mac:arm64": { + "dependsOn": ["build", "@furtherverse/server#compile:darwin:arm64"], + "outputs": ["dist/**"] + }, + "dist:mac:x64": { + "dependsOn": ["build", "@furtherverse/server#compile:darwin:x64"], "outputs": ["dist/**"] }, "dist:win": { - "dependsOn": ["build", "@furtherverse/server#compile:windows"], + "dependsOn": ["build", "@furtherverse/server#compile:windows:x64"], "outputs": ["dist/**"] } } diff --git a/apps/server/compile.ts b/apps/server/compile.ts index f81d48a..c86dc0f 100644 --- a/apps/server/compile.ts +++ b/apps/server/compile.ts @@ -1,4 +1,4 @@ -import { rm } from 'node:fs/promises' +import { mkdir, rm } from 'node:fs/promises' import { parseArgs } from 'node:util' const ENTRYPOINT = '.output/server/index.mjs' @@ -7,6 +7,7 @@ const OUTDIR = 'out' const SUPPORTED_TARGETS: readonly Bun.Build.CompileTarget[] = [ 'bun-windows-x64', 'bun-darwin-arm64', + 'bun-darwin-x64', 'bun-linux-x64', 'bun-linux-arm64', ] @@ -43,7 +44,11 @@ const main = async () => { const suffix = target.replace('bun-', '') const outfile = `server-${suffix}` - await rm(OUTDIR, { recursive: true, force: true }) + await mkdir(OUTDIR, { recursive: true }) + await Promise.all([ + rm(`${OUTDIR}/${outfile}`, { force: true }), + rm(`${OUTDIR}/${outfile}.exe`, { force: true }), + ]) const result = await Bun.build({ entrypoints: [ENTRYPOINT], diff --git a/apps/server/package.json b/apps/server/package.json index 15abcac..c70e17e 100644 --- a/apps/server/package.json +++ b/apps/server/package.json @@ -6,9 +6,14 @@ "scripts": { "build": "vite build", "compile": "bun compile.ts", - "compile:darwin": "bun compile.ts --target bun-darwin-arm64", - "compile:linux": "bun compile.ts --target bun-linux-x64", - "compile:windows": "bun compile.ts --target bun-windows-x64", + "compile:darwin": "bun run compile:darwin:arm64", + "compile:darwin:arm64": "bun compile.ts --target bun-darwin-arm64", + "compile:darwin:x64": "bun compile.ts --target bun-darwin-x64", + "compile:linux": "bun run compile:linux:x64", + "compile:linux:arm64": "bun compile.ts --target bun-linux-arm64", + "compile:linux:x64": "bun compile.ts --target bun-linux-x64", + "compile:windows": "bun run compile:windows:x64", + "compile:windows:x64": "bun compile.ts --target bun-windows-x64", "db:generate": "drizzle-kit generate", "db:migrate": "drizzle-kit migrate", "db:push": "drizzle-kit push", diff --git a/apps/server/turbo.json b/apps/server/turbo.json index c49c3ce..10677c7 100644 --- a/apps/server/turbo.json +++ b/apps/server/turbo.json @@ -14,13 +14,33 @@ "dependsOn": ["build"], "outputs": ["out/**"] }, + "compile:darwin:arm64": { + "dependsOn": ["build"], + "outputs": ["out/**"] + }, + "compile:darwin:x64": { + "dependsOn": ["build"], + "outputs": ["out/**"] + }, "compile:linux": { "dependsOn": ["build"], "outputs": ["out/**"] }, + "compile:linux:arm64": { + "dependsOn": ["build"], + "outputs": ["out/**"] + }, + "compile:linux:x64": { + "dependsOn": ["build"], + "outputs": ["out/**"] + }, "compile:windows": { "dependsOn": ["build"], "outputs": ["out/**"] + }, + "compile:windows:x64": { + "dependsOn": ["build"], + "outputs": ["out/**"] } } }