Skip to content

Commit

Permalink
feat(nsis): custom uninstall application icon
Browse files Browse the repository at this point in the history
Close #1550
  • Loading branch information
develar committed May 21, 2017
1 parent 5835654 commit eb181b9
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/issue_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
* **Target**:

<!-- Enter your issue details below this comment. -->
<!-- If you want, you can donate to increase issue priority (https://github.com/electron-userland/electron-builder/wiki/Donations) -->
<!-- If you want, you can donate to increase issue priority (https://donorbox.org/electron-builder) -->
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# electron-builder [![npm version](https://img.shields.io/npm/v/electron-builder.svg)](https://npmjs.org/package/electron-builder) [![downloads per month](http://img.shields.io/npm/dm/electron-builder.svg)](https://www.npmjs.org/package/electron-builder) [![donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W6V79R2RGCCHL)
# electron-builder [![npm version](https://img.shields.io/npm/v/electron-builder.svg)](https://npmjs.org/package/electron-builder) [![downloads per month](http://img.shields.io/npm/dm/electron-builder.svg)](https://www.npmjs.org/package/electron-builder) [![donate](https://img.shields.io/badge/Donate-Donorbox-green.svg)](https://donorbox.org/electron-builder)
A complete solution to package and build a ready for distribution Electron app for macOS, Windows and Linux with “auto update” support out of the box.

* NPM packages management:
Expand All @@ -24,7 +24,7 @@ A complete solution to package and build a ready for distribution Electron app f
| “I want to configure electron-builder” | [See options](https://github.com/electron-userland/electron-builder/wiki/Options) |
| “I have a question” | [Open an issue](https://github.com/electron-userland/electron-builder/issues) or [join the chat](http://electron-builder-slack.herokuapp.com) |
| “I found a bug” | [Open an issue](https://github.com/electron-userland/electron-builder/issues/new) |
| “I want to donate” | [Donate with PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W6V79R2RGCCHL) or [Bitcoin](https://cex.io/#/modal/donation/pid/DP100018863) |
| “I want to donate” | [Donate with Donorbox](https://donorbox.org/electron-builder) or [Paypal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W6V79R2RGCCHL) |

Real project example — [onshape-desktop-shell](https://github.com/develar/onshape-desktop-shell).

Expand Down
12 changes: 1 addition & 11 deletions docs/Donations.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
Support us with a donation and help us continue our activities. Donation can be used to increase some issue priority.

## PayPal

[Donate with PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W6V79R2RGCCHL)

## Credit Card

[Donate with Gratipay](https://gratipay.com/electron-builder/)

## Bitcoin

[Donate with Bitcoin](https://cex.io/#/modal/donation/pid/DP100018863)
[Donate with Donorbox](https://donorbox.org/electron-builder), [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W6V79R2RGCCHL) or [Bitcoin](https://cex.io/#/modal/donation/pid/DP100018863).

Bitcoin payment is anonymous — you can send comment to [email protected].
2 changes: 1 addition & 1 deletion docs/_Footer.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![npm version](https://img.shields.io/npm/v/electron-builder.svg)](https://npmjs.org/package/electron-builder) [![donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W6V79R2RGCCHL)
[![npm version](https://img.shields.io/npm/v/electron-builder.svg)](https://npmjs.org/package/electron-builder) [![donate](https://img.shields.io/badge/Donate-Donorbox-green.svg)](https://donorbox.org/electron-builder)

### Want to contribute to this Wiki?

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"///": "all dependencies for all packages (hoisted)",
"dependencies": {
"7zip-bin": "^2.0.4",
"ajv": "^5.1.2",
"ajv": "^5.1.3",
"ajv-keywords": "^2.0.0",
"archiver": "^1.3.0",
"aws-sdk": "^2.54.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"homepage": "https://github.com/electron-userland/electron-builder",
"dependencies": {
"7zip-bin": "^2.0.4",
"ajv": "^5.1.2",
"ajv": "^5.1.3",
"ajv-keywords": "^2.0.0",
"bluebird-lst": "^1.0.2",
"chalk": "^1.1.3",
Expand Down
6 changes: 6 additions & 0 deletions packages/electron-builder/src/options/winOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ export interface NsisOptions extends CommonNsisOptions, TargetSpecificOptions {
*/
readonly installerIcon?: string | null

/**
* The path to uninstaller icon, relative to the the [build resources](https://github.com/electron-userland/electron-builder/wiki/Options#MetadataDirectories-buildResources) or to the project directory.
* Defaults to `build/uninstallerIcon.ico` or application icon.
*/
readonly uninstallerIcon?: string | null

/**
* *boring installer only.* `MUI_HEADERIMAGE`, relative to the the [build resources](https://github.com/electron-userland/electron-builder/wiki/Options#MetadataDirectories-buildResources) or to the project directory.
* @default build/installerHeader.bmp
Expand Down
5 changes: 5 additions & 0 deletions packages/electron-builder/src/targets/nsis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,11 @@ export class NsisTarget extends Target {
if (options.deleteAppDataOnUninstall) {
defines.DELETE_APP_DATA_ON_UNINSTALL = null
}

const uninstallerIcon = await packager.getResource(options.uninstallerIcon, "uninstallerIcon.ico")
if (uninstallerIcon != null) {
defines.UNINSTALLER_ICON = uninstallerIcon
}
}

private configureDefinesForAllTypeOfInstaller(defines: any) {
Expand Down
11 changes: 10 additions & 1 deletion packages/electron-builder/templates/nsis/installSection.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@
WriteRegStr SHCTX "${UNINSTALL_REGISTRY_KEY}" UninstallString '"$2" $0'

WriteRegStr SHCTX "${UNINSTALL_REGISTRY_KEY}" "DisplayVersion" "${VERSION}"
WriteRegStr SHCTX "${UNINSTALL_REGISTRY_KEY}" "DisplayIcon" "$appExe,0"
!ifdef UNINSTALLER_ICON
WriteRegStr SHCTX "${UNINSTALL_REGISTRY_KEY}" "DisplayIcon" "$INSTDIR\uninstallerIcon.ico"
!else
WriteRegStr SHCTX "${UNINSTALL_REGISTRY_KEY}" "DisplayIcon" "$appExe,0"
!endif

WriteRegStr SHCTX "${UNINSTALL_REGISTRY_KEY}" "Publisher" "${COMPANY_NAME}"
WriteRegDWORD SHCTX "${UNINSTALL_REGISTRY_KEY}" NoModify 1
WriteRegDWORD SHCTX "${UNINSTALL_REGISTRY_KEY}" NoRepair 1
Expand Down Expand Up @@ -107,6 +112,10 @@ ${endif}

SetOutPath $INSTDIR

!ifdef UNINSTALLER_ICON
File /oname=uninstallerIcon.ico "${UNINSTALLER_ICON}"
!endif

!ifdef APP_BUILD_DIR
File /r "${APP_BUILD_DIR}/*.*"
!else
Expand Down
2 changes: 1 addition & 1 deletion test/src/windows/oneClickInstallerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ test.ifNotCiMac("installerHeaderIcon", () => {
}, {
projectDirCreated: projectDir => {
headerIconPath = path.join(projectDir, "build", "installerHeaderIcon.ico")
return copyTestAsset("headerIcon.ico", headerIconPath)
return BluebirdPromise.all([copyTestAsset("headerIcon.ico", headerIconPath), copyTestAsset("headerIcon.ico", path.join(projectDir, "build", "uninstallerIcon.ico"))])
}
}
)
Expand Down
12 changes: 8 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ ajv@^4.9.1:
co "^4.6.0"
json-stable-stringify "^1.0.1"

ajv@^5.1.2:
version "5.1.2"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.1.2.tgz#c2be11aff5de51613592913bc820224906da84a1"
ajv@^5.1.3:
version "5.1.3"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.1.3.tgz#423d1c302c61e617081b30ca05f595ec51408e33"
dependencies:
co "^4.6.0"
json-stable-stringify "^1.0.1"
Expand Down Expand Up @@ -2330,14 +2330,18 @@ mimic-fn@^1.0.0:
dependencies:
brace-expansion "^1.1.7"

[email protected], minimist@~0.0.1:
[email protected]:
version "0.0.8"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"

minimist@^1.1.0, minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"

minimist@~0.0.1:
version "0.0.10"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf"

mkdirp2@^1.0.2:
version "1.0.3"
resolved "https://registry.yarnpkg.com/mkdirp2/-/mkdirp2-1.0.3.tgz#cc8dd8265f1f06e2d8f5b10b6e52f4e050bed21b"
Expand Down

0 comments on commit eb181b9

Please sign in to comment.