Files
cjyyzx/scripts/electronWorkflow/buildElectron.ts
T
xiaohei 428644e286
Revalidate Docs / Revalidate Docs (push) Failing after 2s
E2E CI / Check Duplicate Run (push) Failing after 5s
Test CI / Check Duplicate Run (push) Failing after 6s
E2E CI / Test Web App (push) Has been skipped
Test CI / Test Packages (push) Has been skipped
Test CI / Test App (shard 1/3) (push) Has been skipped
Test CI / Test App (shard 2/3) (push) Has been skipped
Test CI / Test App (shard 3/3) (push) Has been skipped
Test CI / Test Desktop App (push) Has been skipped
🔄 Branch Synchronization / sync-branches (push) Failing after 11s
Test CI / Test Database (push) Has been skipped
Test CI / Merge and Upload App Coverage (push) Has been skipped
Database Schema Visualization CI / build (push) Failing after 4m14s
Enterprise AI Workspace prototype: LobeChat (de-branded) + Enterprise Gateway + Postgres/Redis stack
2026-04-21 12:58:00 +08:00

52 lines
1.4 KiB
TypeScript

import { execSync } from 'node:child_process';
import os from 'node:os';
/**
* Build desktop application based on current operating system platform
*/
const buildElectron = () => {
const platform = os.platform();
const startTime = Date.now();
console.log(`🔨 Starting to build desktop app for ${platform} platform...`);
try {
let buildCommand = '';
// Determine build command based on platform
switch (platform) {
case 'darwin': {
buildCommand = 'npm run package:mac --prefix=./apps/desktop';
console.log('📦 Building macOS desktop application...');
break;
}
case 'win32': {
buildCommand = 'npm run package:win --prefix=./apps/desktop';
console.log('📦 Building Windows desktop application...');
break;
}
case 'linux': {
buildCommand = 'npm run package:linux --prefix=./apps/desktop';
console.log('📦 Building Linux desktop application...');
break;
}
default: {
throw new Error(`Unsupported platform: ${platform}`);
}
}
// Execute build command
execSync(buildCommand, { stdio: 'inherit' });
const endTime = Date.now();
const buildTime = ((endTime - startTime) / 1000).toFixed(2);
console.log(`✅ Desktop application build completed! (${buildTime}s)`);
} catch (error) {
console.error('❌ Build failed:', error);
process.exit(1);
}
};
// Execute build
buildElectron();