Skip to content

Commit

Permalink
feat(nsis): add NsisOption to specify selectPerMachineByDefault (#7967)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmeinke committed Jan 9, 2024
1 parent 03c9451 commit 28e5b5d
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/dull-brooms-search.md
@@ -0,0 +1,5 @@
---
"app-builder-lib": minor
---

feat(nsis): add NsisOption to specify selectPerMachineByDefault
3 changes: 3 additions & 0 deletions docs/generated/NsisOptions.md
Expand Up @@ -12,6 +12,9 @@
<p>If <code>oneClick</code> is <code>false</code> and <code>perMachine</code> is <code>false</code> (default): install mode installer page.</p>
</li>
<li>
<p><code id="NsisOptions-selectPerMachineByDefault">selectPerMachineByDefault</code> = <code>false</code> Boolean - Whether to set per-machine or per-user installation as default selection on the install mode installer page.</p>
</li>
<li>
<p><code id="NsisOptions-allowElevation">allowElevation</code> = <code>true</code> Boolean - <em>assisted installer only.</em> Allow requesting for elevation. If false, user will have to restart installer with elevated permissions.</p>
</li>
<li>
Expand Down
10 changes: 10 additions & 0 deletions packages/app-builder-lib/scheme.json
Expand Up @@ -4183,6 +4183,11 @@
"string"
]
},
"selectPerMachineByDefault": {
"default": false,
"description": "Whether to set per-machine or per-user installation as default selection on the install mode installer page.",
"type": "boolean"
},
"shortcutName": {
"description": "The name that will be used for all shortcuts. Defaults to the application name.",
"type": [
Expand Down Expand Up @@ -4506,6 +4511,11 @@
"string"
]
},
"selectPerMachineByDefault": {
"default": false,
"description": "Whether to set per-machine or per-user installation as default selection on the install mode installer page.",
"type": "boolean"
},
"shortcutName": {
"description": "The name that will be used for all shortcuts. Defaults to the application name.",
"type": [
Expand Down
1 change: 1 addition & 0 deletions packages/app-builder-lib/src/targets/nsis/Defines.ts
Expand Up @@ -76,6 +76,7 @@ export type Defines = {
MULTIUSER_INSTALLMODE_ALLOW_ELEVATION?: null

INSTALL_MODE_PER_ALL_USERS?: null
INSTALL_MODE_PER_ALL_USERS_DEFAULT?: null
INSTALL_MODE_PER_ALL_USERS_REQUIRED?: null

allowToChangeInstallationDirectory?: null
Expand Down
4 changes: 4 additions & 0 deletions packages/app-builder-lib/src/targets/nsis/NsisTarget.ts
Expand Up @@ -474,6 +474,10 @@ export class NsisTarget extends Target {
defines.INSTALL_MODE_PER_ALL_USERS = null
}

if (options.selectPerMachineByDefault === true) {
defines.INSTALL_MODE_PER_ALL_USERS_DEFAULT = null
}

if (!oneClick || options.perMachine === true) {
defines.INSTALL_MODE_PER_ALL_USERS_REQUIRED = null
}
Expand Down
7 changes: 7 additions & 0 deletions packages/app-builder-lib/src/targets/nsis/nsisOptions.ts
Expand Up @@ -74,6 +74,13 @@ export interface NsisOptions extends CommonNsisOptions, CommonWindowsInstallerCo
*/
readonly perMachine?: boolean

/**
* Whether to set per-machine or per-user installation as default selection on the install mode installer page.
*
* @default false
*/
readonly selectPerMachineByDefault?: boolean

/**
* *assisted installer only.* Allow requesting for elevation. If false, user will have to restart installer with elevated permissions.
* @default true
Expand Down
Expand Up @@ -143,7 +143,11 @@
!ifdef INSTALL_MODE_PER_ALL_USERS
!insertmacro setInstallModePerAllUsers
!else
!insertmacro setInstallModePerUser
!ifdef INSTALL_MODE_PER_ALL_USERS_DEFAULT
!insertmacro setInstallModePerAllUsers
!else
!insertmacro setInstallModePerUser
!endif
!endif
${endif}
!endif
Expand Down

0 comments on commit 28e5b5d

Please sign in to comment.