Skip to content

Commit

Permalink
pack: add build for current os only
Browse files Browse the repository at this point in the history
  • Loading branch information
jooy2 committed Oct 12, 2023
1 parent 8d4375f commit 2aae312
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
10 changes: 5 additions & 5 deletions docs/src/Electron How To/preload-script.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ For compatibility and security with the latest version of Electron, we do not re

Vutron's preload script is located in the `src/preload` folder. To create a new IPC communication channel, add the channel name to the following variable to whitelist it for communication.

* `mainAvailChannels`: Send an event from main to renderer. (`window.mainApi.send('channelName'')`)
* `rendererAvailChannels`: Send an event from renderer to main. (`mainWindow.webContents.send('channelName')`)
- `mainAvailChannels`: Send an event from main to renderer. (`window.mainApi.send('channelName'')`)
- `rendererAvailChannels`: Send an event from renderer to main. (`mainWindow.webContents.send('channelName')`)

When sending events from renderer to main, you access the `window.mainApi` object instead of `ipcRenderer.send`. The `mainApi` is the name you set in your Vutron template and can be changed.

Here are the supported functions for mainApi: (To change and modify this, you need to modify `exposeInMainWorld` in `src/preload/index.ts`).

* `send`: Send an event to main.
* `receive`: A listener to receive events sent by main.
* `invoke`: Functions that can send events to main and receive data asynchronously.
- `send`: Send an event to main.
- `receive`: A listener to receive events sent by main.
- `invoke`: Functions that can send events to main and receive data asynchronously.
33 changes: 17 additions & 16 deletions docs/src/Installation and Build/npm-scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,23 @@ order: 3
## General

| Script Name | Description |
| --- | --- |
| `dev` | Start Electron as a development environment |
| `dev:debug` | Start Electron as a development environment (with vite debug) |
| `dev:debug:force` | Start Electron as a development environment (with vite debug + clean vite cache) |
| `build` | Build a specified package for the entire operating system (Requires cross-platform build configuration) |
| `build:pre` | Commands commonly run at build time. This script does not need to be run separately. |
| `build:dir` | `electron-builder` directory build |
| `build:mac` | Build preconfigured packages for macOS |
| `build:linux` | Build preconfigured packages for Linux |
| `build:win` | Build preconfigured packages for Windows |
| `lint` | ESLint code inspection. It does not modify the code. |
| `lint:fix` | ESLint code inspection. Use auto-fix to fix your code. |
| `format` | Prettier code inspection. It does not modify the code. |
| `format:fix` | Prettier code inspection. Use auto-fix to fix your code. |
| `test` | Build a package for testing and run tests against the test specification file. |
| Script Name | Description |
|-------------------|---------------------------------------------------------------------------------------------------------|
| `dev` | Start Electron as a development environment |
| `dev:debug` | Start Electron as a development environment (with vite debug) |
| `dev:debug:force` | Start Electron as a development environment (with vite debug + clean vite cache) |
| `build:pre` | Commands commonly run at build time. This script does not need to be run separately. |
| `build` | Build the package for the current operating system. |
| `build:all` | Build a specified package for the entire operating system (Requires cross-platform build configuration) |
| `build:dir` | `electron-builder` directory build |
| `build:mac` | Build preconfigured packages for macOS |
| `build:linux` | Build preconfigured packages for Linux |
| `build:win` | Build preconfigured packages for Windows |
| `lint` | ESLint code inspection. It does not modify the code. |
| `lint:fix` | ESLint code inspection. Use auto-fix to fix your code. |
| `format` | Prettier code inspection. It does not modify the code. |
| `format:fix` | Prettier code inspection. Use auto-fix to fix your code. |
| `test` | Build a package for testing and run tests against the test specification file. |

## For Documentation

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"dev": "cross-env ELECTRON_ENABLE_LOGGING=true vite",
"dev:debug": "vite -d",
"dev:debug:force": "vite -d --force",
"build": "npm run build:pre && electron-builder --config=buildAssets/builder/config.ts",
"build:pre": "npm run format:fix && vue-tsc --noEmit && vite build",
"build:all": "npm run build:pre && electron-builder --config=buildAssets/builder/config.ts -wml",
"build:dir": "npm run build:pre && electron-builder --config=buildAssets/builder/config.ts --dir",
Expand Down

0 comments on commit 2aae312

Please sign in to comment.