UNPKG

10.2 kBTypeScriptView Raw
1import { TargetSpecificOptions } from "../../core";
2import { CommonWindowsInstallerConfiguration } from "../..";
3export 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}
24export 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](./nsis.md#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}
49export 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 * Whether to set per-machine or per-user installation as default selection on the install mode installer page.
68 *
69 * @default false
70 */
71 readonly selectPerMachineByDefault?: boolean;
72 /**
73 * *assisted installer only.* Allow requesting for elevation. If false, user will have to restart installer with elevated permissions.
74 * @default true
75 */
76 readonly allowElevation?: boolean;
77 /**
78 * *assisted installer only.* Whether to allow user to change installation directory.
79 * @default false
80 */
81 readonly allowToChangeInstallationDirectory?: boolean;
82 /**
83 * *assisted installer only.* remove the default uninstall welcome page.
84 * @default false
85 */
86 readonly removeDefaultUninstallWelcomePage?: boolean;
87 /**
88 * The path to installer icon, relative to the [build resources](./contents.md#extraresources) or to the project directory.
89 * Defaults to `build/installerIcon.ico` or application icon.
90 */
91 readonly installerIcon?: string | null;
92 /**
93 * The path to uninstaller icon, relative to the [build resources](./contents.md#extraresources) or to the project directory.
94 * Defaults to `build/uninstallerIcon.ico` or application icon.
95 */
96 readonly uninstallerIcon?: string | null;
97 /**
98 * *assisted installer only.* `MUI_HEADERIMAGE`, relative to the [build resources](./contents.md#extraresources) or to the project directory.
99 * @default build/installerHeader.bmp
100 */
101 readonly installerHeader?: string | null;
102 /**
103 * *one-click installer only.* The path to header icon (above the progress bar), relative to the [build resources](./contents.md#extraresources) or to the project directory.
104 * Defaults to `build/installerHeaderIcon.ico` or application icon.
105 */
106 readonly installerHeaderIcon?: string | null;
107 /**
108 * *assisted installer only.* `MUI_WELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](./contents.md#extraresources) or to the project directory.
109 * Defaults to `build/installerSidebar.bmp` or `${NSISDIR}\\Contrib\\Graphics\\Wizard\\nsis3-metro.bmp`. Image size 164 × 314 pixels.
110 */
111 readonly installerSidebar?: string | null;
112 /**
113 * *assisted installer only.* `MUI_UNWELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](./contents.md#extraresources) or to the project directory.
114 * Defaults to `installerSidebar` option or `build/uninstallerSidebar.bmp` or `build/installerSidebar.bmp` or `${NSISDIR}\\Contrib\\Graphics\\Wizard\\nsis3-metro.bmp`
115 */
116 readonly uninstallerSidebar?: string | null;
117 /**
118 * The uninstaller display name in the control panel.
119 * @default ${productName} ${version}
120 */
121 readonly uninstallDisplayName?: string;
122 /**
123 * The path to NSIS include script to customize installer. Defaults to `build/installer.nsh`. See [Custom NSIS script](#custom-nsis-script).
124 */
125 readonly include?: string | null;
126 /**
127 * The path to NSIS script to customize installer. Defaults to `build/installer.nsi`. See [Custom NSIS script](#custom-nsis-script).
128 */
129 readonly script?: string | null;
130 /**
131 * 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).
132 *
133 * 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.
134 * 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).
135 *
136 * Appropriate license file will be selected by user OS language.
137 */
138 readonly license?: string | null;
139 /**
140 * The [artifact file name template](./configuration.md#artifact-file-name-template). Defaults to `${productName} Setup ${version}.${ext}`.
141 */
142 readonly artifactName?: string | null;
143 /**
144 * *one-click installer only.* Whether to delete app data on uninstall.
145 * @default false
146 */
147 readonly deleteAppDataOnUninstall?: boolean;
148 /**
149 * @private
150 */
151 differentialPackage?: boolean;
152 /**
153 * Whether to display a language selection dialog. Not recommended (by default will be detected using OS language).
154 * @default false
155 */
156 readonly displayLanguageSelector?: boolean;
157 /**
158 * The installer languages (e.g. `en_US`, `de_DE`). Change only if you understand what do you do and for what.
159 */
160 readonly installerLanguages?: Array<string> | string | null;
161 /**
162 * [LCID Dec](https://msdn.microsoft.com/en-au/goglobal/bb964664.aspx), defaults to `1033`(`English - United States`).
163 */
164 readonly language?: string | null;
165 /**
166 * Whether to create multi-language installer. Defaults to `unicode` option value.
167 */
168 readonly multiLanguageInstaller?: boolean;
169 /**
170 * 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`.
171 * @default true
172 */
173 readonly packElevateHelper?: boolean;
174 /**
175 * The file extension of files that will be not compressed. Applicable only for `extraResources` and `extraFiles` files.
176 * @default [".avi", ".mov", ".m4v", ".mp4", ".m4p", ".qt", ".mkv", ".webm", ".vmdk"]
177 */
178 readonly preCompressedFileExtensions?: Array<string> | string | null;
179}
180/**
181 * Portable options.
182 */
183export interface PortableOptions extends TargetSpecificOptions, CommonNsisOptions {
184 /**
185 * The [requested execution level](http://nsis.sourceforge.net/Reference/RequestExecutionLevel) for Windows.
186 * @default user
187 */
188 readonly requestExecutionLevel?: "user" | "highest" | "admin";
189 /**
190 * The unpack directory for the portable app resources.
191 *
192 * 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
193 * If set explicitly to `false`, it will use the Windows temp directory ($PLUGINSDIR) that is unique to each launch of the portable application.
194 *
195 * Defaults to [uuid](https://github.com/segmentio/ksuid) of build (changed on each build of portable executable).
196 */
197 readonly unpackDirName?: string | boolean;
198 /**
199 * The image to show while the portable executable is extracting. This image must be a bitmap (`.bmp`) image.
200 */
201 readonly splashImage?: string | null;
202}
203/**
204 * Web Installer options.
205 */
206export interface NsisWebOptions extends NsisOptions {
207 /**
208 * The application package download URL. Optional — by default computed using publish configuration.
209 *
210 * URL like `https://example.com/download/latest` allows web installer to be version independent (installer will download latest application package).
211 * Please note — it is [full URL](https://github.com/electron-userland/electron-builder/issues/1810#issuecomment-317650878).
212 *
213 * Custom `X-Arch` http header is set to `32` or `64`.
214 */
215 readonly appPackageUrl?: string | null;
216 /**
217 * The [artifact file name template](./configuration.md#artifact-file-name-template). Defaults to `${productName} Web Setup ${version}.${ext}`.
218 */
219 readonly artifactName?: string | null;
220}