- https://electronjs.org/--official website
- https://github.com/electron/electron-api-demos/releases--Download Demo
Download the installation:
# Clone the sample project's Warehouse $ git clone https: // Github.com/electron/electron-quick-start # Enter this warehouse $ cd electron-quick-&& npm start
Install package plugins/install and package:
NPM Install Electron-packager-g
The parameters below are the prototypes of the packaged execution command:
Electron-packager <sourcedir> <appname>--platform=<platform>--arch=<arch> [optional flags ...]
执行如下:
Electron-packager. App--win--out presentertool--arch=--version 1.4.14--overwrite--ignore=node_modules
成功运行完成后,生成文件:
Click to view the results as follows:
部分参数解释:
rimraf
A deluxe version rm -rf
that is compatible with window.
cross-env
A deluxe version of the environment variable settings, where there is a NODE_ENV=*
place, you can consider using CROSS-ENV, compatible with window.
./
, which is generally the location of the Package.json. See here for details: https://newsn.net/say/electron-quick-start-modify.html
appname
, this will affect the name (Appname.exe) of the executable file (EXE/DMG) that you have finished packing.
--platform
And --arch
, these two parameters have very much deformation. Here is a detailed explanation: https://newsn.net/say/electron-packager-basic.html
--win32metadata.FileDescription
, file description information. See here: https://newsn.net/say/electron-packager-exe-info.html
--overwrite
, whether to overwrite the original build file. It is related to the following items: --out=out
, --ignore=out
, rimraf out
.
--ignore
, to exclude the non-packaged files, you can overlay the effect. The main reason is to reduce the final file size considerations.
--no-prune
, this parameter should be used with caution, is said not to deal with node_modules inside the dev dependency package, the relevant code is put into the final asar inside. By default, the package inside the dev-related node_modules is removed and then packaged. Note: There are no parameters in the current version of Electron-packager --prune
.
--electron-version
that specifies the version of the electron to be used when packaging. See here: https://newsn.net/say/electron-packager-control-version.html. Note: The latest version electron-packager
has no --version
parameters.
--out
Where to put the executable files that you have finished packing.
--icon
Set the icon when packaging. The key to knocking on the Blackboard , every day someone asked how to change this icon, here to replace. For the issue of icon making, see: Https://newsn.net/say/electron-mac-icns.html and https://newsn.net/say/electron-ico-format.html. Icons are special icons, in vain to make an icon can be a perfect replacement of the idea, are futile. Never mind.
--asar
Package options, if the App.asar file is generated under the resource folder. Otherwise it will be an app folder plus your own code file.
Build cross-platform desktop applications using JavaScript, HTML and CSS