@loongdotjs/electron-winstaller 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +95 -0
- package/.editorconfig +9 -0
- package/.eslintrc.json +30 -0
- package/.github/CODEOWNERS +1 -0
- package/.github/dependabot.yml +6 -0
- package/.github/workflows/add-to-project.yml +29 -0
- package/.github/workflows/semantic.yml +26 -0
- package/.gitignore +18 -0
- package/.releaserc.json +9 -0
- package/LICENSE +20 -0
- package/README.md +189 -0
- package/lib/index.d.ts +20 -0
- package/lib/index.js +350 -0
- package/lib/index.js.map +1 -0
- package/lib/options.d.ts +219 -0
- package/lib/options.js +6 -0
- package/lib/options.js.map +1 -0
- package/lib/sign.d.ts +15 -0
- package/lib/sign.js +189 -0
- package/lib/sign.js.map +1 -0
- package/lib/spawn-promise.d.ts +3 -0
- package/lib/spawn-promise.js +54 -0
- package/lib/spawn-promise.js.map +1 -0
- package/lib/temp-utils.d.ts +3 -0
- package/lib/temp-utils.js +32 -0
- package/lib/temp-utils.js.map +1 -0
- package/package.json +69 -0
- package/resources/install-spinner.gif +0 -0
- package/script/select-7z-arch.js +33 -0
- package/spec/convert-version-spec.ts +14 -0
- package/spec/fixtures/app/LICENSE +0 -0
- package/spec/fixtures/app/chromiumcontent.dll +0 -0
- package/spec/fixtures/app/d3dcompiler_47.dll +0 -0
- package/spec/fixtures/app/ffmpegsumo.dll +0 -0
- package/spec/fixtures/app/icudtl.dat +0 -0
- package/spec/fixtures/app/locales/en.pak +0 -0
- package/spec/fixtures/app/msvcp120.dll +0 -0
- package/spec/fixtures/app/msvcr120.dll +0 -0
- package/spec/fixtures/app/myapp.exe +0 -0
- package/spec/fixtures/app/natives_blob.bin +0 -0
- package/spec/fixtures/app/resources/app/package.json +7 -0
- package/spec/fixtures/app/snapshot_blob.bin +0 -0
- package/spec/fixtures/app/swiftshader/libEGL.dll +0 -0
- package/spec/fixtures/app/swiftshader/libGLESv2.dll +0 -0
- package/spec/fixtures/app/vccorlib120.dll +0 -0
- package/spec/fixtures/app/vk_swiftshader.dll +0 -0
- package/spec/fixtures/app/vk_swiftshader_icd.json +0 -0
- package/spec/fixtures/app/xinput1_3.dll +0 -0
- package/spec/helpers/helpers.ts +12 -0
- package/spec/helpers/windowsSignHook.js +8 -0
- package/spec/installer-spec.ts +70 -0
- package/spec/sign-spec.ts +48 -0
- package/src/index.ts +271 -0
- package/src/options.ts +228 -0
- package/src/sign.ts +89 -0
- package/src/spawn-promise.ts +55 -0
- package/src/temp-utils.ts +9 -0
- package/template.nuspectemplate +30 -0
- package/tsconfig.json +21 -0
- package/typedoc.json +4 -0
- package/vendor/7z-arm64.dll +0 -0
- package/vendor/7z-arm64.exe +0 -0
- package/vendor/7z-x64.dll +0 -0
- package/vendor/7z-x64.exe +0 -0
- package/vendor/Microsoft.Deployment.Resources.dll +0 -0
- package/vendor/Microsoft.Deployment.WindowsInstaller.dll +0 -0
- package/vendor/Setup.exe +0 -0
- package/vendor/Setup.pdb +0 -0
- package/vendor/Squirrel-Mono.exe +0 -0
- package/vendor/Squirrel-Mono.pdb +0 -0
- package/vendor/Squirrel.com +0 -0
- package/vendor/Squirrel.exe +0 -0
- package/vendor/Squirrel.pdb +0 -0
- package/vendor/StubExecutable.exe +0 -0
- package/vendor/SyncReleases.exe +0 -0
- package/vendor/SyncReleases.pdb +0 -0
- package/vendor/WixNetFxExtension.dll +0 -0
- package/vendor/WriteZipToSetup.exe +0 -0
- package/vendor/WriteZipToSetup.pdb +0 -0
- package/vendor/candle.exe +0 -0
- package/vendor/candle.exe.config +18 -0
- package/vendor/darice.cub +0 -0
- package/vendor/light.exe +0 -0
- package/vendor/light.exe.config +18 -0
- package/vendor/nuget.exe +0 -0
- package/vendor/rcedit.exe +0 -0
- package/vendor/signtool.exe +0 -0
- package/vendor/template.wxs +39 -0
- package/vendor/wconsole.dll +0 -0
- package/vendor/winterop.dll +0 -0
- package/vendor/wix.dll +0 -0
- package/yarn.lock +2008 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
version: 2.1
|
|
2
|
+
|
|
3
|
+
orbs:
|
|
4
|
+
cfa: continuousauth/npm@2.1.0
|
|
5
|
+
node: electronjs/node@2.3.0
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
test:
|
|
9
|
+
environment:
|
|
10
|
+
# prevent Wine popup dialogs about installing additional packages
|
|
11
|
+
WINEDLLOVERRIDES: mscoree,mshtml=
|
|
12
|
+
WINEDEBUG: -all
|
|
13
|
+
executor: <<parameters.executor>>
|
|
14
|
+
parameters:
|
|
15
|
+
executor:
|
|
16
|
+
description: The executor to use for the job.
|
|
17
|
+
type: string
|
|
18
|
+
node-version:
|
|
19
|
+
description: Specify the Node.js version to install.
|
|
20
|
+
type: string
|
|
21
|
+
steps:
|
|
22
|
+
- node/test:
|
|
23
|
+
override-ci-command: |
|
|
24
|
+
if [ << parameters.node-version >> = '14.21' ]; then
|
|
25
|
+
yarn install --frozen-lockfile --ignore-engines
|
|
26
|
+
else
|
|
27
|
+
yarn install --frozen-lockfile
|
|
28
|
+
fi
|
|
29
|
+
checkout-steps:
|
|
30
|
+
- when:
|
|
31
|
+
condition:
|
|
32
|
+
equal: [ node/macos, << parameters.executor >> ]
|
|
33
|
+
steps:
|
|
34
|
+
- restore_cache:
|
|
35
|
+
name: Restoring Homebrew cache
|
|
36
|
+
paths:
|
|
37
|
+
- /usr/local/Homebrew
|
|
38
|
+
keys:
|
|
39
|
+
- v1-brew-cache-{{ arch }}
|
|
40
|
+
- run:
|
|
41
|
+
name: Install OS Dependencies
|
|
42
|
+
command: |
|
|
43
|
+
case "$(uname)" in
|
|
44
|
+
Linux)
|
|
45
|
+
sudo dpkg --add-architecture i386
|
|
46
|
+
sudo apt-get -qq update
|
|
47
|
+
sudo apt-get install --no-install-recommends -y wine64 wine32 wine mono-devel
|
|
48
|
+
wine64 hostname
|
|
49
|
+
;;
|
|
50
|
+
Darwin)
|
|
51
|
+
brew install --cask xquartz
|
|
52
|
+
brew tap homebrew/cask-versions
|
|
53
|
+
brew install --cask --no-quarantine wine-stable
|
|
54
|
+
brew install mono
|
|
55
|
+
wine64 hostname
|
|
56
|
+
;;
|
|
57
|
+
esac
|
|
58
|
+
- when:
|
|
59
|
+
condition:
|
|
60
|
+
equal: [ node/macos, << parameters.executor >> ]
|
|
61
|
+
steps:
|
|
62
|
+
- save_cache:
|
|
63
|
+
name: Persisting Homebrew cache
|
|
64
|
+
paths:
|
|
65
|
+
- /usr/local/Homebrew
|
|
66
|
+
key: v1-brew-cache-{{ arch }}
|
|
67
|
+
- checkout
|
|
68
|
+
node-version: << parameters.node-version >>
|
|
69
|
+
|
|
70
|
+
workflows:
|
|
71
|
+
test_and_release:
|
|
72
|
+
# Run the test jobs first, then the release only when all the test jobs are successful
|
|
73
|
+
jobs:
|
|
74
|
+
- test:
|
|
75
|
+
name: test-<< matrix.executor >>-<< matrix.node-version >>
|
|
76
|
+
matrix:
|
|
77
|
+
alias: test
|
|
78
|
+
parameters:
|
|
79
|
+
executor:
|
|
80
|
+
- node/linux
|
|
81
|
+
# - node/macos
|
|
82
|
+
- node/windows
|
|
83
|
+
node-version:
|
|
84
|
+
- '20.10'
|
|
85
|
+
- '18.18'
|
|
86
|
+
- '16.20'
|
|
87
|
+
- '14.21'
|
|
88
|
+
- cfa/release:
|
|
89
|
+
requires:
|
|
90
|
+
- test
|
|
91
|
+
filters:
|
|
92
|
+
branches:
|
|
93
|
+
only:
|
|
94
|
+
- main
|
|
95
|
+
context: cfa-release
|
package/.editorconfig
ADDED
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"parser": "@typescript-eslint/parser",
|
|
3
|
+
"plugins": [
|
|
4
|
+
"@typescript-eslint",
|
|
5
|
+
"ava"
|
|
6
|
+
],
|
|
7
|
+
"extends": [
|
|
8
|
+
"plugin:@typescript-eslint/recommended",
|
|
9
|
+
"plugin:ava/recommended",
|
|
10
|
+
"eslint:recommended"
|
|
11
|
+
],
|
|
12
|
+
"rules": {
|
|
13
|
+
"strict": 0,
|
|
14
|
+
"@typescript-eslint/indent": [
|
|
15
|
+
2,
|
|
16
|
+
2
|
|
17
|
+
],
|
|
18
|
+
"@typescript-eslint/no-var-requires": "off",
|
|
19
|
+
"semi": [
|
|
20
|
+
2,
|
|
21
|
+
"always"
|
|
22
|
+
],
|
|
23
|
+
"no-console": 0,
|
|
24
|
+
"quotes": [2, "single", "avoid-escape"]
|
|
25
|
+
},
|
|
26
|
+
"env": {
|
|
27
|
+
"es6": true,
|
|
28
|
+
"node": true
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @electron/wg-ecosystem
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Add to Ecosystem WG Project
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issues:
|
|
5
|
+
types:
|
|
6
|
+
- opened
|
|
7
|
+
pull_request_target:
|
|
8
|
+
types:
|
|
9
|
+
- opened
|
|
10
|
+
|
|
11
|
+
permissions: {}
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
add-to-project:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- name: Generate GitHub App token
|
|
18
|
+
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
|
|
19
|
+
id: generate-token
|
|
20
|
+
with:
|
|
21
|
+
creds: ${{ secrets.ECOSYSTEM_ISSUE_TRIAGE_GH_APP_CREDS }}
|
|
22
|
+
org: electron
|
|
23
|
+
- name: Add to Project
|
|
24
|
+
uses: dsanders11/project-actions/add-item@eb760c48894b5702398529cbb8f6e98378e315d0 # v1.3.0
|
|
25
|
+
with:
|
|
26
|
+
field: Opened
|
|
27
|
+
field-value: ${{ github.event.pull_request.created_at || github.event.issue.created_at }}
|
|
28
|
+
project-number: 89
|
|
29
|
+
token: ${{ steps.generate-token.outputs.token }}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: "Check Semantic Commit"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types:
|
|
6
|
+
- opened
|
|
7
|
+
- edited
|
|
8
|
+
- synchronize
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
main:
|
|
15
|
+
permissions:
|
|
16
|
+
pull-requests: read # for amannn/action-semantic-pull-request to analyze PRs
|
|
17
|
+
statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR
|
|
18
|
+
name: Validate PR Title
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- name: semantic-pull-request
|
|
22
|
+
uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3
|
|
23
|
+
env:
|
|
24
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
25
|
+
with:
|
|
26
|
+
validateSingleCommit: false
|
package/.gitignore
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
node_modules/
|
|
2
|
+
build/
|
|
3
|
+
tasks/
|
|
4
|
+
lib/
|
|
5
|
+
.idea/
|
|
6
|
+
npm-debug.log
|
|
7
|
+
SquirrelSetup.log
|
|
8
|
+
electron-windows-sign.log
|
|
9
|
+
receiver.mjs
|
|
10
|
+
signtool-original.exe
|
|
11
|
+
Squirrel-Releasify.log
|
|
12
|
+
.node-version
|
|
13
|
+
.DS_Store
|
|
14
|
+
spec/fixtures/app/Update.exe
|
|
15
|
+
vendor/7z.dll
|
|
16
|
+
vendor/7z.exe
|
|
17
|
+
hook.log
|
|
18
|
+
docs
|
package/.releaserc.json
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2015 GitHub Inc.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# Electron Installer
|
|
2
|
+
|
|
3
|
+
[](https://circleci.com/gh/electron/windows-installer)
|
|
4
|
+
[](https://npm.im/electron-winstaller)
|
|
5
|
+
|
|
6
|
+
NPM module that builds Windows installers for
|
|
7
|
+
[Electron](https://github.com/electron/electron) apps using
|
|
8
|
+
[Squirrel](https://github.com/Squirrel/Squirrel.Windows).
|
|
9
|
+
|
|
10
|
+
## Installing
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install --save-dev electron-winstaller
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
Require the package:
|
|
19
|
+
|
|
20
|
+
```javascript
|
|
21
|
+
const electronInstaller = require('electron-winstaller');
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Then do a build like so..
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
try {
|
|
28
|
+
await electronInstaller.createWindowsInstaller({
|
|
29
|
+
appDirectory: '/tmp/build/my-app-64',
|
|
30
|
+
outputDirectory: '/tmp/build/installer64',
|
|
31
|
+
authors: 'My App Inc.',
|
|
32
|
+
exe: 'myapp.exe'
|
|
33
|
+
});
|
|
34
|
+
console.log('It worked!');
|
|
35
|
+
} catch (e) {
|
|
36
|
+
console.log(`No dice: ${e.message}`);
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
After running you will have an `.nupkg`, a
|
|
41
|
+
`RELEASES` file, and a `.exe` installer file in the `outputDirectory` folder
|
|
42
|
+
for each multi task target given under the config entry.
|
|
43
|
+
|
|
44
|
+
There are several configuration settings supported:
|
|
45
|
+
|
|
46
|
+
| Config Name | Required | Description |
|
|
47
|
+
| --------------------- | -------- | ----------- |
|
|
48
|
+
| `appDirectory` | Yes | The folder path of your Electron app |
|
|
49
|
+
| `outputDirectory` | No | The folder path to create the `.exe` installer in. Defaults to the `installer` folder at the project root. |
|
|
50
|
+
| `loadingGif` | No | The local path to a `.gif` file to display during install. |
|
|
51
|
+
| `authors` | Yes | The authors value for the nuget package metadata. Defaults to the `author` field from your app's package.json file when unspecified. |
|
|
52
|
+
| `owners` | No | The owners value for the nuget package metadata. Defaults to the `authors` field when unspecified. |
|
|
53
|
+
| `exe` | No | The name of your app's main `.exe` file. This uses the `name` field in your app's package.json file with an added `.exe` extension when unspecified. |
|
|
54
|
+
| `description` | No | The description value for the nuget package metadata. Defaults to the `description` field from your app's package.json file when unspecified. |
|
|
55
|
+
| `version` | No | The version value for the nuget package metadata. Defaults to the `version` field from your app's package.json file when unspecified. |
|
|
56
|
+
| `title` | No | The title value for the nuget package metadata. Defaults to the `productName` field and then the `name` field from your app's package.json file when unspecified. |
|
|
57
|
+
| `name` | No | Windows Application Model ID (appId). Defaults to the `name` field in your app's package.json file. |
|
|
58
|
+
| `certificateFile` | No | The path to an Authenticode Code Signing Certificate |
|
|
59
|
+
| `certificatePassword` | No | The password to decrypt the certificate given in `certificateFile` |
|
|
60
|
+
| `signWithParams` | No | Params to pass to signtool. Overrides `certificateFile` and `certificatePassword`. |
|
|
61
|
+
| `iconUrl` | No | A URL to an ICO file to use as the application icon (displayed in Control Panel > Programs and Features). Defaults to the Atom icon. |
|
|
62
|
+
| `setupIcon` | No | The ICO file to use as the icon for the generated Setup.exe |
|
|
63
|
+
| `skipUpdateIcon` | No | Disables setting the icon of `Update.exe`. This can solve installation errors with the following message: "This application could not be started", when the setup is built on a non-Windows system. |
|
|
64
|
+
| `setupExe` | No | The name to use for the generated Setup.exe file |
|
|
65
|
+
| `setupMsi` | No | The name to use for the generated Setup.msi file |
|
|
66
|
+
| `noMsi` | No | Should Squirrel.Windows create an MSI installer? |
|
|
67
|
+
| `noDelta` | No | Should Squirrel.Windows delta packages? (disable only if necessary, they are a Good Thing) |
|
|
68
|
+
| `remoteReleases` | No | A URL to your existing updates. If given, these will be downloaded to create delta updates |
|
|
69
|
+
| `remoteToken` | No | Authentication token for remote updates |
|
|
70
|
+
| `frameworkVersion` | No | Set the required .NET framework version, e.g. `net461` |
|
|
71
|
+
| `windowsSign` | No | Use [@electron/windows-sign][@electron/windows-sign] for advanced codesigning. See [documentation](#advanced-codesigning-with-electronwindows-sign) for details. |
|
|
72
|
+
|
|
73
|
+
## Sign your installer or else bad things will happen
|
|
74
|
+
|
|
75
|
+
For development / internal use, creating installers without a signature is okay, but for a production app you need to sign your application. Internet Explorer's SmartScreen filter will block your app from being downloaded, and many anti-virus vendors will consider your app as malware unless you obtain a valid cert.
|
|
76
|
+
|
|
77
|
+
Any certificate valid for "Authenticode Code Signing" will work here, but if you get the right kind of code certificate, you can also opt-in to [Windows Error Reporting](http://en.wikipedia.org/wiki/Windows_Error_Reporting). [This MSDN page](http://msdn.microsoft.com/en-us/library/windows/hardware/hh801887.aspx) has the latest links on where to get a WER-compatible certificate. The "Standard Code Signing" certificate is sufficient for this purpose.
|
|
78
|
+
|
|
79
|
+
## Handling Squirrel Events
|
|
80
|
+
|
|
81
|
+
Squirrel will spawn your app with command line flags on first run, updates,
|
|
82
|
+
and uninstalls. it is **very** important that your app handle these events as _early_
|
|
83
|
+
as possible, and quit **immediately** after handling them. Squirrel will give your
|
|
84
|
+
app a short amount of time (~15sec) to apply these operations and quit.
|
|
85
|
+
|
|
86
|
+
The [electron-squirrel-startup](https://github.com/mongodb-js/electron-squirrel-startup) module will handle
|
|
87
|
+
the most common events for you, such as managing desktop shortcuts. Add the following to the top
|
|
88
|
+
of your `main.js` and you're good to go:
|
|
89
|
+
|
|
90
|
+
```javascript
|
|
91
|
+
if (require('electron-squirrel-startup')) return;
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
You should handle these events in your app's `main` entry point with something
|
|
95
|
+
such as:
|
|
96
|
+
|
|
97
|
+
```javascript
|
|
98
|
+
const app = require('app');
|
|
99
|
+
|
|
100
|
+
// this should be placed at top of main.js to handle setup events quickly
|
|
101
|
+
if (handleSquirrelEvent()) {
|
|
102
|
+
// squirrel event handled and app will exit in 1000ms, so don't do anything else
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function handleSquirrelEvent() {
|
|
107
|
+
if (process.argv.length === 1) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const ChildProcess = require('child_process');
|
|
112
|
+
const path = require('path');
|
|
113
|
+
|
|
114
|
+
const appFolder = path.resolve(process.execPath, '..');
|
|
115
|
+
const rootAtomFolder = path.resolve(appFolder, '..');
|
|
116
|
+
const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe'));
|
|
117
|
+
const exeName = path.basename(process.execPath);
|
|
118
|
+
|
|
119
|
+
const spawn = function(command, args) {
|
|
120
|
+
let spawnedProcess, error;
|
|
121
|
+
|
|
122
|
+
try {
|
|
123
|
+
spawnedProcess = ChildProcess.spawn(command, args, {detached: true});
|
|
124
|
+
} catch (error) {}
|
|
125
|
+
|
|
126
|
+
return spawnedProcess;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const spawnUpdate = function(args) {
|
|
130
|
+
return spawn(updateDotExe, args);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const squirrelEvent = process.argv[1];
|
|
134
|
+
switch (squirrelEvent) {
|
|
135
|
+
case '--squirrel-install':
|
|
136
|
+
case '--squirrel-updated':
|
|
137
|
+
// Optionally do things such as:
|
|
138
|
+
// - Add your .exe to the PATH
|
|
139
|
+
// - Write to the registry for things like file associations and
|
|
140
|
+
// explorer context menus
|
|
141
|
+
|
|
142
|
+
// Install desktop and start menu shortcuts
|
|
143
|
+
spawnUpdate(['--createShortcut', exeName]);
|
|
144
|
+
|
|
145
|
+
setTimeout(app.quit, 1000);
|
|
146
|
+
return true;
|
|
147
|
+
|
|
148
|
+
case '--squirrel-uninstall':
|
|
149
|
+
// Undo anything you did in the --squirrel-install and
|
|
150
|
+
// --squirrel-updated handlers
|
|
151
|
+
|
|
152
|
+
// Remove desktop and start menu shortcuts
|
|
153
|
+
spawnUpdate(['--removeShortcut', exeName]);
|
|
154
|
+
|
|
155
|
+
setTimeout(app.quit, 1000);
|
|
156
|
+
return true;
|
|
157
|
+
|
|
158
|
+
case '--squirrel-obsolete':
|
|
159
|
+
// This is called on the outgoing version of your app before
|
|
160
|
+
// we update to the new version - it's the opposite of
|
|
161
|
+
// --squirrel-updated
|
|
162
|
+
|
|
163
|
+
app.quit();
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Notice that the first time the installer launches your app, your app will see a `--squirrel-firstrun` flag. This allows you to do things like showing up a splash screen or presenting a settings UI. Another thing to be aware of is that, since the app is spawned by squirrel and squirrel acquires a file lock during installation, you won't be able to successfully check for app updates till a few seconds later when squirrel releases the lock.
|
|
170
|
+
|
|
171
|
+
## Advanced codesigning with [@electron/windows-sign][@electron/windows-sign]
|
|
172
|
+
|
|
173
|
+
This package supports two different ways to codesign your application and the installer:
|
|
174
|
+
|
|
175
|
+
1) Modern: By passing a `windowsSign` option, which will be passed to [@electron/windows-sign]. This method allows full customization of the code-signing process - and supports more complicated scenarios like cloud-hosted EV certificates, custom sign pipelines, and per-file overrides. It also supports all existing "simple" codesigning scenarios, including just passing a certificate file and password. Please see https://github.com/@electron/windows-sign for all possible configuration options.
|
|
176
|
+
|
|
177
|
+
When passing `windowsSign`, do not pass any other available parameters at the top level (like `certificateFile`, `certificatePassword`, or `signWithParams`).
|
|
178
|
+
|
|
179
|
+
2) Legacy: By passing the top-level settings (`certificateFile`, `certificatePassword`, and `signWithParams`). For simple codesigning scenarios, there's no reason not to use this method - it'll work just as fine as the modern method.
|
|
180
|
+
|
|
181
|
+
## Debugging this package
|
|
182
|
+
|
|
183
|
+
You can get debug messages from this package by running with the environment variable `DEBUG=electron-windows-installer:main` e.g.
|
|
184
|
+
|
|
185
|
+
```shell
|
|
186
|
+
DEBUG=electron-windows-installer:main node tasks/electron-winstaller.js
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
[@electron/windows-sign]: https://github.com/electron/windows-sign/
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SquirrelWindowsOptions } from './options';
|
|
2
|
+
export { SquirrelWindowsOptions } from './options';
|
|
3
|
+
export { SquirrelWindowsOptions as Options } from './options';
|
|
4
|
+
/**
|
|
5
|
+
* A utility function to convert SemVer version strings into NuGet-compatible
|
|
6
|
+
* version strings.
|
|
7
|
+
* @param version A SemVer version string
|
|
8
|
+
* @returns A NuGet-compatible version string
|
|
9
|
+
* @see {@link https://semver.org/ | Semantic Versioning specification}
|
|
10
|
+
* @see {@link https://learn.microsoft.com/en-us/nuget/concepts/package-versioning?tabs=semver20sort | NuGet versioning specification}
|
|
11
|
+
*/
|
|
12
|
+
export declare function convertVersion(version: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* This package's main function, which creates a Squirrel.Windows executable
|
|
15
|
+
* installer and optionally code-signs the output.
|
|
16
|
+
*
|
|
17
|
+
* @param options Options for installer generation and signing
|
|
18
|
+
* @see {@link https://github.com/Squirrel/Squirrel.Windows | Squirrel.Windows}
|
|
19
|
+
*/
|
|
20
|
+
export declare function createWindowsInstaller(options: SquirrelWindowsOptions): Promise<void>;
|