Generate exe, dmg, deb executable files
Preparation
- Build on the corresponding operating system. For example, build xxx.exe on Windows, build xxx.dmg on MacOS.
- If using bytecode encryption, Windows distinguishes between 32-bit and 64-bit, and they cannot run interchangeably. Ignore this if not using bytecode.
Step 1: Build Resources
Build frontend && main process || encryption
For more build commands or details, see the Build section in the Quick Start Tutorial.
# Build frontend & main process, and encrypt
npm run build
# Build frontend only
npm run build-frontend
# Build main process only
npm run build-electron(Optional) Go: See the Build section in Tutorial.
Step 2: Code Encryption (Must Read)
Details: Code Encryption
Step 3: Package Software
Pre-release Mode
Test whether features work normally (current environment variable: prod)
npm run startConfiguration
See builder.json
Note
1: Please make the project name unique (the name property in electron-egg/package.json) to avoid conflicts with other software names.
2: If packaging fails, see FAQ.
Commands
Packaging configuration is in ./cmd/bin.js. Modify the build object properties to customize your common command configurations. The corresponding commands are in the scripts object properties of ./package.json.
Default Commands
# Preparation: set up the domestic mirror
# If the first build takes a long time and gets stuck, try deleting the directory C:\Users\YourUsername\AppData\Local\electron\Cache, clear it completely, and retry
# Package (Windows version)
npm run build-w
# Package (Mac version)
npm run build-m
npm run build-m-arm64 (M1 chip architecture)
# Package (Linux version)
npm run build-lAdding New Commands
# 1. Modify the ./cmd/bin.js file
build: {
win32: {
args: ['--config=./cmd/builder.json', '-w=nsis', '--ia32'],
},
}
# 2. Modify the ./package.json file
"scripts": {
"build-w-32": "ee-bin build --cmds=win32",
}
# Usage (Windows 32-bit version)
npm run build-w-32Note: If you want to learn more about platform packaging features, please refer to: https://www.electron.build/
Step 4: Find the Program
# Program
Directory: electron-egg/out
Windows installer: out/electron-egg-windows-2.0.3.exe
Windows portable (no-install): out/ee-win-3.0.1-ia32.7z
Mac package: out/xxxx.dmg
Linux package: out/xxx.debTips
Windows and MacOS packaging generally has no issues. Due to the many Linux distributions, it is recommended to prioritize building the following packages:
- Ubuntu: build deb package
- UOS (Unity Operating System): build deb package
- Debian: build deb package
- CentOS: build rpm package
- Galaxy Kylin v10 (sp1): build deb package
Other Modifications
- Modify application name
# Modify the property in ./package.json
name: project name (in English)
# Build configuration ./cmd/builder-xxx.json
productName: executable program name (in English)
appId: software id
shortcutName: desktop shortcut name
# Software runtime header name
# Modify ./electron/config/config.default.js
windowsOption.title= 'ee framework'
# The title tag in the frontend HTML also affects this value, and has the highest priority- Logo modification, see documentation
