In this section, we learn Electron the application deployment of 060bcc6dbd187c. If we want to use Electron deploy our application, we need to package and reshape. You can use the following third-party packaging tools to achieve:

  • electron-forge
  • electron-builder
  • electron-packager

These packaging tools will cover Electron application, such as packaging the application, reorganizing the executable program, setting the icon and configurable creation of the installer.

Manual release

We can choose to manually release our app , in order to use Electron deploy your application, you need to download Electron of prebuilt binaries . Then the folder for storing the application program needs to be called app , and it needs to be placed Electorn the resource folder Resources . Note that the Electron of the pre-made binary file of electron/ represented by 060bcc6dbd1958.

Example:

The directory structure in Linux and Windows

electron/resources/app
├── package.json
├── main.js
└── index.html

The directory structure in macOS is as follows:

electron/Electron.app/Contents/Resources/app/
├── package.json
├── main.js
└── index.html

Then run Electron.app , or Linux in electron , Windows in electron.exe , and then Electron will start as an application. electron folder will be deployed and can be distributed to end users.

Package the application into a file

In addition to distributing the application by copying all resource files, we can also package the application as a asar library file to avoid exposing the source code.

In order to use a asar library file instead app folder, we need to change the name of the library file is app.asar , then place Electron resource file folder, and then Electron tries to read the file and start from the library.

Example:

As shown below, in Windows and Linux :

electron/resources/
└── app.asar

In macOS :

electron/Electron.app/Contents/Resources/
└── app.asar

Re-customize using the downloaded binary file

After Electron , we may need to re-customize Electron before distributing it to users.

Windows

You can change electron.exe to any name you like, and then you can use rcedit edit its icon and other information.

Linux

You can rename electron to any name you like,

macOS

We can rename Electron.app to any name we like, and then we need to CFBundleDisplayName , CFBundleIdentifier and CFBundleName fields in some files.

These files are as follows:

  • Electron.app/Contents/Info.plist
  • Electron.app/Contents/Frameworks/Electron Helper.app/Contents/Info.plist

We can also rename the helper to avoid it being displayed as Electron Helper in the system activity monitor, but please make sure you have modified the name of the executable file of the helper application.

The structure of a renamed application might look like the following:

MyApp.app/Contents
├── Info.plist
├── MacOS/
│   └── MyApp
└── Frameworks/
    └── MyApp Helper.app
        ├── Info.plist
        └── MacOS/
            └── MyApp Helper

知否
221 声望177 粉丝

Skrike while the iron is hot.