From 44d28c9e910c4e23ce39eb7892b4ffffd169fad2 Mon Sep 17 00:00:00 2001 From: Jerome Meinke Date: Wed, 3 Jan 2024 12:05:51 +0100 Subject: [PATCH 1/2] feat(nsis): add NsisOption to specify selectPerMachineByDefault for the assistedInstaller --- packages/app-builder-lib/scheme.json | 10 ++++++++++ packages/app-builder-lib/src/targets/nsis/Defines.ts | 1 + .../app-builder-lib/src/targets/nsis/NsisTarget.ts | 4 ++++ .../app-builder-lib/src/targets/nsis/nsisOptions.ts | 7 +++++++ .../templates/nsis/assistedInstaller.nsh | 6 +++++- 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/packages/app-builder-lib/scheme.json b/packages/app-builder-lib/scheme.json index fc7cd69be72..d2f745ad10e 100644 --- a/packages/app-builder-lib/scheme.json +++ b/packages/app-builder-lib/scheme.json @@ -3622,6 +3622,11 @@ "description": "Whether to install per all users (per-machine).", "type": "boolean" }, + "selectPerMachineByDefault": { + "default": false, + "description": "Whether to set per-machine or per-user installation as default selection on the install mode installer page.", + "type": "boolean" + }, "publish": { "anyOf": [ { @@ -4070,6 +4075,11 @@ "description": "Whether to show install mode installer page (choice per-machine or per-user) for assisted installer. Or whether installation always per all users (per-machine).\n\nIf `oneClick` is `true` (default): Whether to install per all users (per-machine).\n\nIf `oneClick` is `false` and `perMachine` is `true`: no install mode installer page, always install per-machine.\n\nIf `oneClick` is `false` and `perMachine` is `false` (default): install mode installer page.", "type": "boolean" }, + "selectPerMachineByDefault": { + "default": false, + "description": "Whether to set per-machine or per-user installation as default selection on the install mode installer page.", + "type": "boolean" + }, "preCompressedFileExtensions": { "anyOf": [ { diff --git a/packages/app-builder-lib/src/targets/nsis/Defines.ts b/packages/app-builder-lib/src/targets/nsis/Defines.ts index 5402f35b28e..123649e1e0e 100644 --- a/packages/app-builder-lib/src/targets/nsis/Defines.ts +++ b/packages/app-builder-lib/src/targets/nsis/Defines.ts @@ -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 diff --git a/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts b/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts index 8b4d33cdd26..c676ecf26c1 100644 --- a/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts +++ b/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts @@ -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 } diff --git a/packages/app-builder-lib/src/targets/nsis/nsisOptions.ts b/packages/app-builder-lib/src/targets/nsis/nsisOptions.ts index e8e22ec0419..170e3c9aba3 100644 --- a/packages/app-builder-lib/src/targets/nsis/nsisOptions.ts +++ b/packages/app-builder-lib/src/targets/nsis/nsisOptions.ts @@ -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 diff --git a/packages/app-builder-lib/templates/nsis/assistedInstaller.nsh b/packages/app-builder-lib/templates/nsis/assistedInstaller.nsh index 79401340c16..b7f47526554 100644 --- a/packages/app-builder-lib/templates/nsis/assistedInstaller.nsh +++ b/packages/app-builder-lib/templates/nsis/assistedInstaller.nsh @@ -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 From 92fbee9651aea1535e98cf09145f17c13e302373 Mon Sep 17 00:00:00 2001 From: Mike Maietta Date: Fri, 5 Jan 2024 09:55:08 -0800 Subject: [PATCH 2/2] update docs and add changeset --- .changeset/dull-brooms-search.md | 5 +++++ docs/generated/NsisOptions.md | 3 +++ packages/app-builder-lib/scheme.json | 20 ++++++++++---------- 3 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 .changeset/dull-brooms-search.md diff --git a/.changeset/dull-brooms-search.md b/.changeset/dull-brooms-search.md new file mode 100644 index 00000000000..27a8414155c --- /dev/null +++ b/.changeset/dull-brooms-search.md @@ -0,0 +1,5 @@ +--- +"app-builder-lib": minor +--- + +feat(nsis): add NsisOption to specify selectPerMachineByDefault diff --git a/docs/generated/NsisOptions.md b/docs/generated/NsisOptions.md index ba0cebd857d..6a6d44d1b90 100644 --- a/docs/generated/NsisOptions.md +++ b/docs/generated/NsisOptions.md @@ -12,6 +12,9 @@

If oneClick is false and perMachine is false (default): install mode installer page.

  • +

    selectPerMachineByDefault = false Boolean - Whether to set per-machine or per-user installation as default selection on the install mode installer page.

    +
  • +
  • allowElevation = true Boolean - assisted installer only. Allow requesting for elevation. If false, user will have to restart installer with elevated permissions.

  • diff --git a/packages/app-builder-lib/scheme.json b/packages/app-builder-lib/scheme.json index d2f745ad10e..de502df940e 100644 --- a/packages/app-builder-lib/scheme.json +++ b/packages/app-builder-lib/scheme.json @@ -3622,11 +3622,6 @@ "description": "Whether to install per all users (per-machine).", "type": "boolean" }, - "selectPerMachineByDefault": { - "default": false, - "description": "Whether to set per-machine or per-user installation as default selection on the install mode installer page.", - "type": "boolean" - }, "publish": { "anyOf": [ { @@ -4075,11 +4070,6 @@ "description": "Whether to show install mode installer page (choice per-machine or per-user) for assisted installer. Or whether installation always per all users (per-machine).\n\nIf `oneClick` is `true` (default): Whether to install per all users (per-machine).\n\nIf `oneClick` is `false` and `perMachine` is `true`: no install mode installer page, always install per-machine.\n\nIf `oneClick` is `false` and `perMachine` is `false` (default): install mode installer page.", "type": "boolean" }, - "selectPerMachineByDefault": { - "default": false, - "description": "Whether to set per-machine or per-user installation as default selection on the install mode installer page.", - "type": "boolean" - }, "preCompressedFileExtensions": { "anyOf": [ { @@ -4193,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": [ @@ -4516,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": [