Skip to content

Commit

Permalink
fix(electron): compatible with windows (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexzhang1030 authored Jan 5, 2024
1 parent fa24276 commit 54de0e5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"execa": "^8.0.1",
"h3": "^1.9.0",
"ip": "^1.1.8",
"pathe": "^1.1.1",
"socket.io": "^4.7.2",
"socket.io-client": "^4.7.2"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/electron/scripts/build.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { resolve as _resolve } from 'node:path'
import { resolve as _resolve } from 'pathe'
import type { Options } from 'tsup'
import { build } from 'tsup'
import { build as unbuild } from 'unbuild'
Expand Down
1 change: 1 addition & 0 deletions packages/electron/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function createWindow() {
})
const appEntryPath = path.join(__dirname, '../app.html')
const url = new URL(`file://${appEntryPath}`).toString()
mainWindow.setMenu(null)
mainWindow.loadURL(new URL(url).toString())

mainWindow.on('closed', () => {
Expand Down
4 changes: 3 additions & 1 deletion packages/electron/src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { execaSync } from 'execa'
import electron from 'electron'
import { resolve } from 'pathe'

const appPath = new URL('../dist/app.cjs', import.meta.url).pathname
const appPath = resolve(new URL('../dist/app.cjs', import.meta.url).pathname)
const argv = process.argv.slice(2)

const result = execaSync(electron as unknown as string, [appPath].concat(argv), {
stdio: 'ignore',
windowsHide: false,
})

process.exit(result.exitCode)
13 changes: 8 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 54de0e5

Please sign in to comment.