The classic Hello World. Electron flavoured.
Install WinGet.
Install Chocolatey.
choco install -y msys2 --params="'/NoPath'"
choco install -y nodejsExecute the following commands in a MSYS2 bash session.
Install the dependencies:
winget install --exact --id MichalTrojnara.osslsigncodeTo use the updated PATH environment variable, which will now include the
newly installed applications, exit the shell session, and open a new one.
Build and package:
make distNB This also creates an example code signing certification authority and uses it to sign the binaries.
List the dist app contents, and confirm it has the expected files:
npx asar list dist/win-unpacked/resources/app.asarVerify the code signature:
osslsigncode verify \
-in dist/win-unpacked/hello-world-electron.exe \
-CAfile example-code-signing-ca-crt.pem
osslsigncode verify \
-in dist/hello-world-electron-setup-1.3.0.exe \
-CAfile example-code-signing-ca-crt.pem
osslsigncode verify \
-in dist/hello-world-electron-1.3.0.msi \
-CAfile example-code-signing-ca-crt.pemShow the code signature:
NB The signature verification will fail when your host does not trust the
example-code-signing CA.
pwsh -Command 'Import-Certificate example-code-signing-ca-crt.pem -CertStoreLocation Cert:/LocalMachine/Root'
pwsh -Command 'Get-AuthenticodeSignature dist/win-unpacked/hello-world-electron.exe | Format-List'
pwsh -Command 'Get-AuthenticodeSignature dist/hello-world-electron-setup-1.3.0.exe | Format-List'
pwsh -Command 'Get-AuthenticodeSignature dist/hello-world-electron-1.3.0.msi | Format-List'- WiX: Errors running validation
electron-builder, to build themsi, uses WiX, which requires administrator-level privileges. For more information see:- To disable the validation, edit
package.json, and modify thebuild.msi.additionalLightArgsproperty to use the-sval(aka skip validation) argument, e.g.:{ "build": { "msi": { "additionalLightArgs": ["-sval"] } } }
- electron.svg
- osslsigncode