UNPKG

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