Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions .github/workflows/desktop-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Desktop App Build

on:
push:
tags:
- 'desktop-v*'
workflow_dispatch:

jobs:
build:
strategy:
matrix:
include:
- os: macos-latest
platform: mac
arch: universal
- os: windows-latest
platform: win
arch: x64
- os: ubuntu-latest
platform: linux
arch: x64

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.5.2

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build packages
run: pnpm turbo run build --filter=@lightfast/desktop^...

- name: Build Electron app for macOS
if: matrix.platform == 'mac'
run: pnpm dist:desktop:mac
env:
CSC_LINK: ${{ secrets.MAC_CERTS }}
CSC_KEY_PASSWORD: ${{ secrets.MAC_CERTS_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}

- name: Build Electron app for Windows
if: matrix.platform == 'win'
run: pnpm dist:desktop:win
env:
CSC_LINK: ${{ secrets.WIN_CERTS }}
CSC_KEY_PASSWORD: ${{ secrets.WIN_CERTS_PASSWORD }}

- name: Build Electron app for Linux
if: matrix.platform == 'linux'
run: pnpm dist:desktop:linux

- name: Upload artifacts - macOS
if: matrix.platform == 'mac'
uses: actions/upload-artifact@v4
with:
name: lightfast-desktop-mac
path: |
apps/desktop/out/*.dmg
apps/desktop/out/*.zip

- name: Upload artifacts - Windows
if: matrix.platform == 'win'
uses: actions/upload-artifact@v4
with:
name: lightfast-desktop-win
path: apps/desktop/out/*.exe

- name: Upload artifacts - Linux
if: matrix.platform == 'linux'
uses: actions/upload-artifact@v4
with:
name: lightfast-desktop-linux
path: |
apps/desktop/out/*.AppImage
apps/desktop/out/*.deb

release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')

steps:
- name: Download all artifacts
uses: actions/download-artifact@v4

- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
lightfast-desktop-mac/*.dmg
lightfast-desktop-mac/*.zip
lightfast-desktop-win/*.exe
lightfast-desktop-linux/*.AppImage
lightfast-desktop-linux/*.deb
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34 changes: 34 additions & 0 deletions apps/desktop/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Dependencies
node_modules/

# Build outputs
dist/
dist-electron/
out/

# Electron
electron-builder.yml
*.unpacked

# Environment
.env
.env.local

# IDE
.vscode/
.idea/

# OS
.DS_Store
Thumbs.db

# Logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Testing
coverage/
.nyc_output/
69 changes: 69 additions & 0 deletions apps/desktop/electron/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { app, BrowserWindow, shell, ipcMain } from 'electron';
import path from 'node:path';
import { fileURLToPath } from 'node:url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

let mainWindow: BrowserWindow | null = null;

function createWindow(): void {
mainWindow = new BrowserWindow({
width: 1200,
height: 800,
minWidth: 800,
minHeight: 600,
title: 'Lightfast',
webPreferences: {
nodeIntegration: false,
contextIsolation: true,
preload: path.join(__dirname, 'preload.js'),
},
show: false,
backgroundColor: '#000000',
titleBarStyle: process.platform === 'darwin' ? 'hiddenInset' : 'default',
});

mainWindow.once('ready-to-show', () => {
mainWindow?.show();
});

mainWindow.webContents.setWindowOpenHandler(({ url }) => {
shell.openExternal(url);
return { action: 'deny' };
});

if (process.env.NODE_ENV === 'development') {
mainWindow.loadURL('http://localhost:5173');
} else {
mainWindow.loadFile(path.join(__dirname, '../index.html'));
}

mainWindow.on('closed', () => {
mainWindow = null;
});
}

app.whenReady().then(() => {
createWindow();

app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});
});

app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});

ipcMain.handle('app:getVersion', (): string => {
return app.getVersion();
});

ipcMain.handle('app:getName', (): string => {
return app.getName();
});
9 changes: 9 additions & 0 deletions apps/desktop/electron/preload.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { contextBridge, ipcRenderer } from 'electron';

contextBridge.exposeInMainWorld('electron', {
app: {
getVersion: () => ipcRenderer.invoke('app:getVersion'),
getName: () => ipcRenderer.invoke('app:getName'),
},
platform: process.platform,
});
8 changes: 8 additions & 0 deletions apps/desktop/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import baseConfig from "@repo/eslint-config/base.js";

export default [
...baseConfig,
{
ignores: ["dist/**", "out/**", "*.config.ts", "*.config.js"],
},
];
13 changes: 13 additions & 0 deletions apps/desktop/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline';" />
<title>Lightfast Desktop</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/renderer/main.tsx"></script>
</body>
</html>
94 changes: 94 additions & 0 deletions apps/desktop/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"name": "@lightfast/desktop",
"version": "0.1.0",
"private": true,
"description": "Lightfast Desktop Application",
"main": "dist-electron/main.js",
"scripts": {
"dev": "vite",
"build": "vite build",
"dist": "npm run build && electron-builder",
"dist:mac": "npm run build && electron-builder --mac",
"dist:win": "npm run build && electron-builder --win",
"dist:linux": "npm run build && electron-builder --linux",
"lint": "eslint . --max-warnings 0",
"typecheck": "tsc --noEmit",
"clean": "rm -rf dist out"
},
"dependencies": {
"electron-log": "^5.4.2",
"electron-updater": "^6.6.2"
},
"devDependencies": {
"@repo/eslint-config": "workspace:*",
"@repo/prettier-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@types/node": "catalog:",
"@types/react": "catalog:react19",
"@types/react-dom": "catalog:react19",
"@vitejs/plugin-react": "^5.0.0",
"electron": "^37.2.6",
"electron-builder": "^26.0.12",
"eslint": "catalog:",
"npm-run-all": "^4.1.5",
"prettier": "catalog:",
"react": "catalog:react19",
"react-dom": "catalog:react19",
"typescript": "catalog:",
"vite": "^7.1.2",
"vite-plugin-electron": "^0.29.0",
"vite-plugin-electron-renderer": "^0.14.6",
"wait-on": "^8.0.4"
},
"build": {
"appId": "com.lightfast.desktop",
"productName": "Lightfast",
"directories": {
"output": "out"
},
"files": [
"dist",
"dist-electron",
"!node_modules/**/*"
],
"mac": {
"category": "public.app-category.developer-tools",
"target": [
{
"target": "dmg",
"arch": ["x64", "arm64"]
},
{
"target": "zip",
"arch": ["x64", "arm64"]
}
]
},
"win": {
"target": [
{
"target": "nsis",
"arch": ["x64"]
}
]
},
"linux": {
"target": [
{
"target": "AppImage",
"arch": ["x64"]
},
{
"target": "deb",
"arch": ["x64"]
}
],
"category": "Development"
},
"nsis": {
"oneClick": false,
"allowToChangeInstallationDirectory": true
}
},
"prettier": "@repo/prettier-config"
}
2 changes: 2 additions & 0 deletions apps/desktop/public/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading