nsisOptions.d.ts 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. import { TargetSpecificOptions } from "../../core";
  2. import { CommonWindowsInstallerConfiguration } from "../..";
  3. interface CustomNsisBinary {
  4. /**
  5. * @default https://github.com/electron-userland/electron-builder-binaries/releases/download
  6. */
  7. readonly url: string | null;
  8. /**
  9. * @default VKMiizYdmNdJOWpRGz4trl4lD++BvYP2irAXpMilheUP0pc93iKlWAoP843Vlraj8YG19CVn0j+dCo/hURz9+Q==
  10. */
  11. readonly checksum?: string | null;
  12. /**
  13. * @default 3.0.4.1
  14. */
  15. readonly version?: string | null;
  16. /**
  17. * Whether or not to enable NSIS logging for debugging.
  18. * Note: Requires a debug-enabled NSIS build.
  19. * electron-builder's included `makensis` does not natively support debug-enabled NSIS installers currently, you must supply your own via `customNsisBinary?: CustomNsisBinary`
  20. * In your custom nsis scripts, you can leverage this functionality via `LogSet` and `LogText`
  21. */
  22. readonly debugLogging?: boolean | null;
  23. }
  24. export interface CommonNsisOptions {
  25. /**
  26. * Whether to create [Unicode installer](http://nsis.sourceforge.net/Docs/Chapter1.html#intro-unicode).
  27. * @default true
  28. */
  29. readonly unicode?: boolean;
  30. /**
  31. * See [GUID vs Application Name](../configuration/nsis#guid-vs-application-name).
  32. */
  33. readonly guid?: string | null;
  34. /**
  35. * If `warningsAsErrors` is `true` (default): NSIS will treat warnings as errors. If `warningsAsErrors` is `false`: NSIS will allow warnings.
  36. * @default true
  37. */
  38. readonly warningsAsErrors?: boolean;
  39. /**
  40. * @private
  41. * @default false
  42. */
  43. readonly useZip?: boolean;
  44. /**
  45. * Allows you to provide your own `makensis`, such as one with support for debug logging via LogSet and LogText. (Logging also requires option `debugLogging = true`)
  46. */
  47. readonly customNsisBinary?: CustomNsisBinary | null;
  48. }
  49. export interface NsisOptions extends CommonNsisOptions, CommonWindowsInstallerConfiguration, TargetSpecificOptions {
  50. /**
  51. * Whether to create one-click installer or assisted.
  52. * @default true
  53. */
  54. readonly oneClick?: boolean;
  55. /**
  56. * 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).
  57. *
  58. * If `oneClick` is `true` (default): Whether to install per all users (per-machine).
  59. *
  60. * If `oneClick` is `false` and `perMachine` is `true`: no install mode installer page, always install per-machine.
  61. *
  62. * If `oneClick` is `false` and `perMachine` is `false` (default): install mode installer page.
  63. * @default false
  64. */
  65. readonly perMachine?: boolean;
  66. /**
  67. * *assisted installer only.* Allow requesting for elevation. If false, user will have to restart installer with elevated permissions.
  68. * @default true
  69. */
  70. readonly allowElevation?: boolean;
  71. /**
  72. * *assisted installer only.* Whether to allow user to change installation directory.
  73. * @default false
  74. */
  75. readonly allowToChangeInstallationDirectory?: boolean;
  76. /**
  77. * *assisted installer only.* remove the default uninstall welcome page.
  78. * @default false
  79. */
  80. readonly removeDefaultUninstallWelcomePage?: boolean;
  81. /**
  82. * The path to installer icon, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.
  83. * Defaults to `build/installerIcon.ico` or application icon.
  84. */
  85. readonly installerIcon?: string | null;
  86. /**
  87. * The path to uninstaller icon, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.
  88. * Defaults to `build/uninstallerIcon.ico` or application icon.
  89. */
  90. readonly uninstallerIcon?: string | null;
  91. /**
  92. * *assisted installer only.* `MUI_HEADERIMAGE`, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.
  93. * @default build/installerHeader.bmp
  94. */
  95. readonly installerHeader?: string | null;
  96. /**
  97. * *one-click installer only.* The path to header icon (above the progress bar), relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.
  98. * Defaults to `build/installerHeaderIcon.ico` or application icon.
  99. */
  100. readonly installerHeaderIcon?: string | null;
  101. /**
  102. * *assisted installer only.* `MUI_WELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.
  103. * Defaults to `build/installerSidebar.bmp` or `${NSISDIR}\\Contrib\\Graphics\\Wizard\\nsis3-metro.bmp`. Image size 164 × 314 pixels.
  104. */
  105. readonly installerSidebar?: string | null;
  106. /**
  107. * *assisted installer only.* `MUI_UNWELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.
  108. * Defaults to `installerSidebar` option or `build/uninstallerSidebar.bmp` or `build/installerSidebar.bmp` or `${NSISDIR}\\Contrib\\Graphics\\Wizard\\nsis3-metro.bmp`
  109. */
  110. readonly uninstallerSidebar?: string | null;
  111. /**
  112. * The uninstaller display name in the control panel.
  113. * @default ${productName} ${version}
  114. */
  115. readonly uninstallDisplayName?: string;
  116. /**
  117. * The path to NSIS include script to customize installer. Defaults to `build/installer.nsh`. See [Custom NSIS script](#custom-nsis-script).
  118. */
  119. readonly include?: string | null;
  120. /**
  121. * The path to NSIS script to customize installer. Defaults to `build/installer.nsi`. See [Custom NSIS script](#custom-nsis-script).
  122. */
  123. readonly script?: string | null;
  124. /**
  125. * The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). In addition to `txt`, `rtf` and `html` supported (don't forget to use `target="_blank"` for links).
  126. *
  127. * Multiple license files in different languages are supported — use lang postfix (e.g. `_de`, `_ru`). For example, create files `license_de.txt` and `license_en.txt` in the build resources.
  128. * If OS language is german, `license_de.txt` will be displayed. See map of [language code to name](https://github.com/meikidd/iso-639-1/blob/master/src/data.js).
  129. *
  130. * Appropriate license file will be selected by user OS language.
  131. */
  132. readonly license?: string | null;
  133. /**
  134. * The [artifact file name template](/configuration/configuration#artifact-file-name-template). Defaults to `${productName} Setup ${version}.${ext}`.
  135. */
  136. readonly artifactName?: string | null;
  137. /**
  138. * *one-click installer only.* Whether to delete app data on uninstall.
  139. * @default false
  140. */
  141. readonly deleteAppDataOnUninstall?: boolean;
  142. /**
  143. * @private
  144. */
  145. differentialPackage?: boolean;
  146. /**
  147. * Whether to display a language selection dialog. Not recommended (by default will be detected using OS language).
  148. * @default false
  149. */
  150. readonly displayLanguageSelector?: boolean;
  151. /**
  152. * The installer languages (e.g. `en_US`, `de_DE`). Change only if you understand what do you do and for what.
  153. */
  154. readonly installerLanguages?: Array<string> | string | null;
  155. /**
  156. * [LCID Dec](https://msdn.microsoft.com/en-au/goglobal/bb964664.aspx), defaults to `1033`(`English - United States`).
  157. */
  158. readonly language?: string | null;
  159. /**
  160. * Whether to create multi-language installer. Defaults to `unicode` option value.
  161. */
  162. readonly multiLanguageInstaller?: boolean;
  163. /**
  164. * Whether to pack the elevate executable (required for electron-updater if per-machine installer used or can be used in the future). Ignored if `perMachine` is set to `true`.
  165. * @default true
  166. */
  167. readonly packElevateHelper?: boolean;
  168. /**
  169. * The file extension of files that will be not compressed. Applicable only for `extraResources` and `extraFiles` files.
  170. * @default [".avi", ".mov", ".m4v", ".mp4", ".m4p", ".qt", ".mkv", ".webm", ".vmdk"]
  171. */
  172. readonly preCompressedFileExtensions?: Array<string> | string | null;
  173. }
  174. /**
  175. * Portable options.
  176. */
  177. export interface PortableOptions extends TargetSpecificOptions, CommonNsisOptions {
  178. /**
  179. * The [requested execution level](http://nsis.sourceforge.net/Reference/RequestExecutionLevel) for Windows.
  180. * @default user
  181. */
  182. readonly requestExecutionLevel?: "user" | "highest" | "admin";
  183. /**
  184. * The unpack directory for the portable app resources.
  185. *
  186. * If set to a string, it will be the name in [TEMP](https://www.askvg.com/where-does-windows-store-temporary-files-and-how-to-change-temp-folder-location/) directory
  187. * If set explicitly to `false`, it will use the Windows temp directory ($PLUGINSDIR) that is unique to each launch of the portable application.
  188. *
  189. * Defaults to [uuid](https://github.com/segmentio/ksuid) of build (changed on each build of portable executable).
  190. */
  191. readonly unpackDirName?: string | boolean;
  192. /**
  193. * The image to show while the portable executable is extracting. This image must be a bitmap (`.bmp`) image.
  194. */
  195. readonly splashImage?: string | null;
  196. }
  197. /**
  198. * Web Installer options.
  199. */
  200. export interface NsisWebOptions extends NsisOptions {
  201. /**
  202. * The application package download URL. Optional — by default computed using publish configuration.
  203. *
  204. * URL like `https://example.com/download/latest` allows web installer to be version independent (installer will download latest application package).
  205. * Please note — it is [full URL](https://github.com/electron-userland/electron-builder/issues/1810#issuecomment-317650878).
  206. *
  207. * Custom `X-Arch` http header is set to `32` or `64`.
  208. */
  209. readonly appPackageUrl?: string | null;
  210. /**
  211. * The [artifact file name template](/configuration/configuration#artifact-file-name-template). Defaults to `${productName} Web Setup ${version}.${ext}`.
  212. */
  213. readonly artifactName?: string | null;
  214. }
  215. export {};