-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* electron * github actions * fix publish.yml * more concise * update linux target * gitignore add newline
- Loading branch information
Showing
7 changed files
with
1,774 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Build and publish desktop app | ||
on: | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: 'publish' | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js 18 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Install dependencies | ||
run: yarn | ||
|
||
- name: Build | ||
run: yarn make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,5 @@ dist-ssr | |
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
release/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
const path = require('path'); | ||
|
||
const { app, BrowserWindow } = require('electron'); | ||
const isDev = require('electron-is-dev'); | ||
|
||
if (require('electron-squirrel-startup')) app.quit(); | ||
|
||
function createWindow() { | ||
let iconPath = ''; | ||
if (isDev) { | ||
iconPath = path.join(__dirname, '../public/favicon-516x516.png'); | ||
} else { | ||
iconPath = path.join(__dirname, '../dist/favicon-516x516.png'); | ||
} | ||
|
||
const win = new BrowserWindow({ | ||
show: false, | ||
icon: iconPath, | ||
}); | ||
win.maximize(); | ||
win.show(); | ||
|
||
win.loadURL( | ||
isDev | ||
? 'http://localhost:5173' | ||
: `file://${path.join(__dirname, '../dist/index.html')}` | ||
); | ||
|
||
if (isDev) { | ||
win.webContents.openDevTools({ mode: 'detach' }); | ||
} | ||
} | ||
|
||
app.whenReady().then(createWindow); | ||
|
||
app.on('window-all-closed', () => { | ||
if (process.platform !== 'darwin') { | ||
app.quit(); | ||
} | ||
}); | ||
|
||
app.on('activate', () => { | ||
if (BrowserWindow.getAllWindows().length === 0) { | ||
createWindow(); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,44 @@ | ||
{ | ||
"name": "better-chatgpt", | ||
"private": true, | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"type": "module", | ||
"homepage": "./", | ||
"main": "electron/index.cjs", | ||
"author": "Jing Hua <[email protected]>", | ||
"description": "Play and chat smarter with BetterChatGPT - an amazing open-source web app with a better UI for exploring OpenAI's ChatGPT API!", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"preview": "vite preview" | ||
"preview": "vite preview", | ||
"electron": "concurrently -k \"BROWSER=none yarn dev\" \"wait-on tcp:5173 && electron .\"", | ||
"pack": "yarn build && electron-builder --dir", | ||
"make": "yarn build && electron-builder" | ||
}, | ||
"build": { | ||
"appId": "better-chatgpt", | ||
"productName": "Better ChatGPT", | ||
"directories": { | ||
"output": "release" | ||
}, | ||
"dmg": { | ||
"title": "${productName} ${version}", | ||
"icon": "dist/favicon-516x516.png" | ||
}, | ||
"linux": { | ||
"target": "tar.gz", | ||
"category": "Chat", | ||
"icon": "dist/favicon-516x516.png" | ||
}, | ||
"win": { | ||
"target": "NSIS", | ||
"icon": "dist/favicon-516x516.png" | ||
} | ||
}, | ||
"dependencies": { | ||
"@dqbd/tiktoken": "^1.0.2", | ||
"electron-is-dev": "^2.0.0", | ||
"electron-squirrel-startup": "^1.0.0", | ||
"html2canvas": "^1.4.1", | ||
"i18next": "^22.4.11", | ||
"i18next-browser-languagedetector": "^7.0.1", | ||
|
@@ -36,11 +65,15 @@ | |
"@types/uuid": "^9.0.1", | ||
"@vitejs/plugin-react-swc": "^3.0.0", | ||
"autoprefixer": "^10.4.13", | ||
"concurrently": "^8.0.1", | ||
"electron": "^23.2.0", | ||
"electron-builder": "^23.6.0", | ||
"postcss": "^8.4.21", | ||
"tailwindcss": "^3.2.7", | ||
"typescript": "^4.9.3", | ||
"vite": "^4.1.0", | ||
"vite-plugin-top-level-await": "^1.3.0", | ||
"vite-plugin-wasm": "^3.2.2" | ||
"vite-plugin-wasm": "^3.2.2", | ||
"wait-on": "^7.0.1" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.