Skip to content

Commit

Permalink
Merge pull request #228 from electron-vite/v0.28.5
Browse files Browse the repository at this point in the history
V0.28.5
  • Loading branch information
caoxiemeihao authored Apr 19, 2024
2 parents 06d8144 + 34423e7 commit a9dbd69
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## 0.28.5 (2024-04-19)

- f325403 chore: update comments
- 5ebd3a6 Merge pull request #229 from ThatKawaiiSam/feat/custom-electron-fork
- dbc85dc feat: allow custom electron forks in `startup` call
- 8b076be chore: update deprecated API

**Contributors:**

- [#229](https://github.com/electron-vite/vite-plugin-electron/pull/229)@[ThatKawaiiSam](https://github.com/ThatKawaiiSam)

## 0.28.4 (2024-03-17)

- 4f7748c chore: restore `vite-plugin-electron-renderer` in `peerDependencies`
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ export interface ElectronOptions {
* Electron App startup function.
* It will mount the Electron App child-process to `process.electronApp`.
* @param argv default value `['.', '--no-sandbox']`
* @param options options for `child_process.spawn`
* @param customElectronPkg custom electron package name (default: 'electron')
*/
startup: (argv?: string[], options?: import('node:child_process').SpawnOptions) => Promise<void>
/** Reload Electron-Renderer */
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vite-plugin-electron",
"version": "0.28.4",
"version": "0.28.5",
"description": "Electron 🔗 Vite",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
9 changes: 7 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export interface ElectronOptions {
* Electron App startup function.
* It will mount the Electron App child-process to `process.electronApp`.
* @param argv default value `['.', '--no-sandbox']`
* @param options options for `child_process.spawn`
* @param customElectronPkg custom electron package name (default: 'electron')
*/
startup: (argv?: string[], options?: import('node:child_process').SpawnOptions) => Promise<void>
/** Reload Electron-Renderer */
Expand Down Expand Up @@ -78,7 +80,7 @@ export default function electron(options: ElectronOptions | ElectronOptions[]):
startup,
reload() {
if (process.electronApp) {
server.ws.send({ type: 'full-reload' })
server.hot.send({ type: 'full-reload' })
} else {
startup()
}
Expand Down Expand Up @@ -118,14 +120,17 @@ export default function electron(options: ElectronOptions | ElectronOptions[]):
* Electron App startup function.
* It will mount the Electron App child-process to `process.electronApp`.
* @param argv default value `['.', '--no-sandbox']`
* @param options options for `child_process.spawn`
* @param customElectronPkg custom electron package name (default: 'electron')
*/
export async function startup(
argv = ['.', '--no-sandbox'],
options?: import('node:child_process').SpawnOptions,
customElectronPkg?: string,
) {
const { spawn } = await import('node:child_process')
// @ts-ignore
const electron = await import('electron')
const electron = await import(customElectronPkg ?? 'electron')
const electronPath = <any>(electron.default ?? electron)

await startup.exit()
Expand Down

0 comments on commit a9dbd69

Please sign in to comment.