feat: electron packaging, build scripts, gitignore and docs update

This commit is contained in:
2026-06-09 23:53:32 +08:00
parent 48fb89449a
commit 25d73f5443
7 changed files with 260 additions and 94 deletions

13
electron/main.js Normal file
View File

@@ -0,0 +1,13 @@
const { app, BrowserWindow } = require('electron')
const path = require('path')
app.whenReady().then(() => {
const win = new BrowserWindow({
fullscreen: true,
autoHideMenuBar: true,
webPreferences: { nodeIntegration: false }
})
win.loadFile(path.join(__dirname, '..', 'dist', 'index.html'))
})
app.on('window-all-closed', () => app.quit())

14
electron/package.json Normal file
View File

@@ -0,0 +1,14 @@
{
"name": "mygame-electron",
"version": "1.0.0",
"private": true,
"main": "main.js",
"scripts": {
"pack:mac": "npx @electron/packager . MyGame --platform=mas --arch=arm64,x64 --out=../release --overwrite",
"pack:win": "npx @electron/packager . MyGame --platform=win32 --arch=x64 --out=../release --overwrite"
},
"devDependencies": {
"electron": "^30.0.0",
"@electron/packager": "^18.0.0"
}
}