feat: integrate Electron for desktop app
- Add electron-vite + Electron Forge tooling - Create Electron main process with embedded Express server - Create preload script with native dialog IPC bridge - Refactor server.ts to export createExpressApp() (dual web/electron) - Adapt renderQueue.ts for packaged binaries + pre-built bundle - Add ensureBrowser() for Chrome Headless Shell pre-download - Add scripts/bundle-remotion.js for packaging - Data persists in ~/Library/Application Support/Bradly/ - Web mode preserved via npm run dev:web
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Pre-build Remotion Bundle for Packaging
|
||||
*
|
||||
* This script runs BEFORE electron-forge packages the app.
|
||||
* It pre-bundles the Remotion project so the packaged app
|
||||
* doesn't need to call bundle() at runtime (which requires
|
||||
* webpack and other heavy deps).
|
||||
*
|
||||
* Usage: node scripts/bundle-remotion.js
|
||||
* Output: out/remotion-bundle/
|
||||
*/
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
async function main() {
|
||||
const outDir = path.join(__dirname, '..', 'out', 'remotion-bundle');
|
||||
|
||||
// Clean previous bundle
|
||||
if (fs.existsSync(outDir)) {
|
||||
fs.rmSync(outDir, { recursive: true });
|
||||
}
|
||||
|
||||
console.log('📦 Building Remotion bundle for packaging...');
|
||||
console.log(' Entry: src/Root.tsx');
|
||||
console.log(' Output:', outDir);
|
||||
|
||||
const { bundle } = require('@remotion/bundler');
|
||||
const entryPoint = path.join(__dirname, '..', 'src', 'Root.tsx');
|
||||
|
||||
const bundlePath = await bundle({
|
||||
entryPoint,
|
||||
outDir,
|
||||
webpackOverride: (config) => config,
|
||||
});
|
||||
|
||||
console.log('✅ Remotion bundle ready:', bundlePath);
|
||||
|
||||
// Verify the bundle exists
|
||||
const indexPath = path.join(bundlePath, 'index.html');
|
||||
if (!fs.existsSync(indexPath)) {
|
||||
throw new Error(`Bundle verification failed: ${indexPath} not found`);
|
||||
}
|
||||
|
||||
console.log('✅ Bundle verified (index.html exists)');
|
||||
}
|
||||
|
||||
main().catch((err) => {
|
||||
console.error('❌ Remotion bundle failed:', err);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user