Electronic (3) – package and update automatically

Time:2020-10-25

The company has an internal desktop software based on electronic Vue. A few days ago, the person responsible for developing this client left, and I became a temporary file connection optimization person. As a Vue writer, but the first contact with electronic, spent a few days browsing the electronic, electronic Vue official documents, the overall architecture of the client code. Even so, there are still a lot of problems in the optimization process. After the end of the project, I hereby make a summary.
Electronic (3) - package and update automatically

After the functional test is passed, it starts to package and release, and it starts the long road of filling the hole.

Electronic packaging can be implemented in two ways: electronic packer or electronic builder. I have chosen the electronic builder package, which indicates in the official document that electronic Builder:

A complete solution to package and build a ready for distribution Electron, Proton Native app for macOS, Windows and Linux with “auto update” support out of the box.
(packaged build is suitable for multiple platforms and supports automatic updates)

Here are some of my configurations:

"scripts": {
    "build": "node .electron-vue/build.js && electron-builder build",
    "build:win": "node .electron-vue/build.js && electron-builder build --windows nsis:x64"
}
"mac": {
    "icon": "build/icons/icon.icns",
    "target": [
        "dmg"
    ]
},    
"win": {
    "icon": "build/icons/icon.ico",
    "target": [
        {
            "target": "nsis",
            "arch": [
                "x64"
            ]
        }
     ]
},

(1) After the MAC system environment is packaged by NPM run build, an error is reported
Electronic (3) - package and update automatically
Then I modified the MAC configuration:

"mac": {        
    "icon": "build/icons/icon.icns",
    "target": [
        "dmg",
        "zip"
    ]
},

Then pack the DMG, zip and latest- mac.yml If the file is placed under the release path, the error will not be reported. Although I don’t quite understand why the MAC system needs the zip file, the error is not reported when packaging the windows system environment and publishing the file.

(2)Could not get code signature for running application:
After the installation package of the new version is placed under the release path, the old version of the software will pop up a pop-up box saying “if the new version is found, do you need to update it?” when I click Update, another error is reported
Electronic (3) - package and update automatically

There is a method on how to package and write code signature on the Internet
sudo vim ~/.bash_profile
Where to write the certificate
export CSC_LINK=~/work/development.p12 
Refresh env
source ~/.bash_profile
You can env to see whether the write is successful

Of course, the key to the success of this operation is that you have a developer certificate in your keychain. I will not elaborate on how to associate the certificate in the Apple ID account with the keychain.

When packing without code signature:
Electronic (3) - package and update automatically
When packing with code signature:
Electronic (3) - package and update automatically

Recommended Today

Layout of angular material (2): layout container

Layout container Layout and container Using thelayoutDirective to specify the layout direction for its child elements: arrange horizontally(layout=”row”)Or vertically(layout=”column”)。 Note that if thelayoutInstruction has no value, thenrowIs the default layout direction. row: items arranged horizontally.max-height = 100%andmax-widthIs the width of the item in the container. column: items arranged vertically.max-width = 100%andmax-heightIs the height of the […]