Skip to content

Commit 6fe8395

Browse files
authoredSep 12, 2024··
chore: update docs to include more interfaces and change changset-cli release configuration (#8467)
1 parent c081df8 commit 6fe8395

File tree

9 files changed

+60
-18
lines changed

9 files changed

+60
-18
lines changed
 

‎.changeset/config.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,8 @@
1717
"access": "public",
1818
"baseBranch": "master",
1919
"updateInternalDependencies": "patch",
20-
"ignore": ["@electron-builder/test"]
20+
"ignore": ["@electron-builder/test"],
21+
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
22+
"onlyUpdatePeerDependentsWhenOutOfRange": true
23+
}
2124
}

‎.changeset/sharp-sloths-teach.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"app-builder-lib": patch
3+
---
4+
5+
chore: update docs to include more interfaces and release configuration

‎docs/api/electron-builder.md

+11
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ Developer API only. See [Configuration](../configuration/configuration.md) for u
106106
<li><a href="#BeforeBuildContext"><code>.BeforeBuildContext</code></a></li>
107107
<li><a href="#BuildResult"><code>.BuildResult</code></a></li>
108108
<li><a href="#CertificateFromStoreInfo"><code>.CertificateFromStoreInfo</code></a></li>
109+
<li><a href="#CustomNsisBinary"><code>.CustomNsisBinary</code></a></li>
109110
<li><a href="#FileCodeSigningInfo"><code>.FileCodeSigningInfo</code></a></li>
110111
<li><a href="#Framework"><code>.Framework</code></a>
111112
<ul>
@@ -314,6 +315,16 @@ Developer API only. See [Configuration](../configuration/configuration.md) for u
314315
<li><strong><code id="CertificateFromStoreInfo-store">store</code></strong> String</li>
315316
<li><strong><code id="CertificateFromStoreInfo-isLocalMachineStore">isLocalMachineStore</code></strong> Boolean</li>
316317
</ul>
318+
<p><a name="CustomNsisBinary"></a></p>
319+
<h2 id="customnsisbinary"><code>CustomNsisBinary</code></h2>
320+
<p><strong>Kind</strong>: interface of <a href="#module_app-builder-lib"><code>app-builder-lib</code></a><br/>
321+
<strong>Properties</strong></p>
322+
<ul>
323+
<li><strong><code id="CustomNsisBinary-url">url</code></strong> = <code>https://github.com/electron-userland/electron-builder-binaries/releases/download</code> String | “undefined”</li>
324+
<li><code id="CustomNsisBinary-checksum">checksum</code> = <code>VKMiizYdmNdJOWpRGz4trl4lD++BvYP2irAXpMilheUP0pc93iKlWAoP843Vlraj8YG19CVn0j+dCo/hURz9+Q==</code> String | “undefined”</li>
325+
<li><code id="CustomNsisBinary-version">version</code> = <code>3.0.4.1</code> String | “undefined”</li>
326+
<li><code id="CustomNsisBinary-debugLogging">debugLogging</code> Boolean | “undefined” - Whether or not to enable NSIS logging for debugging. Note: Requires a debug-enabled NSIS build. electron-builder’s included <code>makensis</code> does not natively support debug-enabled NSIS installers currently, you must supply your own via <code>customNsisBinary?: CustomNsisBinary</code> In your custom nsis scripts, you can leverage this functionality via <code>LogSet</code> and <code>LogText</code></li>
327+
</ul>
317328
<p><a name="FileCodeSigningInfo"></a></p>
318329
<h2 id="filecodesigninginfo"><code>FileCodeSigningInfo</code></h2>
319330
<p><strong>Kind</strong>: interface of <a href="#module_app-builder-lib"><code>app-builder-lib</code></a><br/>

‎docs/generated/NsisOptions.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<li><code id="NsisOptions-unicode">unicode</code> = <code>true</code> Boolean - Whether to create <a href="http://nsis.sourceforge.net/Docs/Chapter1.html#intro-unicode">Unicode installer</a>.</li>
6666
<li><code id="NsisOptions-guid">guid</code> String | “undefined” - See <a href="../configuration/nsis#guid-vs-application-name">GUID vs Application Name</a>.</li>
6767
<li><code id="NsisOptions-warningsAsErrors">warningsAsErrors</code> = <code>true</code> Boolean - If <code>warningsAsErrors</code> is <code>true</code> (default): NSIS will treat warnings as errors. If <code>warningsAsErrors</code> is <code>false</code>: NSIS will allow warnings.</li>
68-
<li><code id="NsisOptions-customNsisBinary">customNsisBinary</code> module:app-builder-lib/out/targets/nsis/nsisOptions.CustomNsisBinary | “undefined” - Allows you to provide your own <code>makensis</code>, such as one with support for debug logging via LogSet and LogText. (Logging also requires option <code>debugLogging = true</code>)</li>
68+
<li><code id="NsisOptions-customNsisBinary">customNsisBinary</code> <a href="#CustomNsisBinary">CustomNsisBinary</a> | “undefined” - Allows you to provide your own <code>makensis</code>, such as one with support for debug logging via LogSet and LogText. (Logging also requires option <code>debugLogging = true</code>)</li>
6969
<li><code id="NsisOptions-runAfterFinish">runAfterFinish</code> = <code>true</code> Boolean - Whether to run the installed application after finish. For assisted installer corresponding checkbox will be removed.</li>
7070
</ul>
7171
<hr>
@@ -75,5 +75,13 @@
7575
<li><code id="NsisOptions-menuCategory">menuCategory</code> = <code>false</code> Boolean | String - Whether to create submenu for start menu shortcut and program files directory. If <code>true</code>, company name will be used. Or string value.</li>
7676
<li><code id="NsisOptions-shortcutName">shortcutName</code> String | “undefined” - The name that will be used for all shortcuts. Defaults to the application name.</li>
7777
</ul>
78+
<h2 id="customnsisbinary">CustomNsisBinary</h2>
79+
<p>undefined</p>
80+
<ul>
81+
<li><strong><code id="CustomNsisBinary-url">url</code></strong> = <code>https://github.com/electron-userland/electron-builder-binaries/releases/download</code> String | “undefined”</li>
82+
<li><code id="CustomNsisBinary-checksum">checksum</code> = <code>VKMiizYdmNdJOWpRGz4trl4lD++BvYP2irAXpMilheUP0pc93iKlWAoP843Vlraj8YG19CVn0j+dCo/hURz9+Q==</code> String | “undefined”</li>
83+
<li><code id="CustomNsisBinary-version">version</code> = <code>3.0.4.1</code> String | “undefined”</li>
84+
<li><code id="CustomNsisBinary-debugLogging">debugLogging</code> Boolean | “undefined” - Whether or not to enable NSIS logging for debugging. Note: Requires a debug-enabled NSIS build. electron-builder’s included <code>makensis</code> does not natively support debug-enabled NSIS installers currently, you must supply your own via <code>customNsisBinary?: CustomNsisBinary</code> In your custom nsis scripts, you can leverage this functionality via <code>LogSet</code> and <code>LogText</code></li>
85+
</ul>
7886

7987
<!-- end of generated block -->

‎packages/app-builder-lib/src/configuration.ts

+17-12
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export interface Configuration extends PlatformSpecificBuildOptions {
162162
/**
163163
* Returns the path to custom Electron build (e.g. `~/electron/out/R`). Zip files must follow the pattern `electron-v${version}-${platformName}-${arch}.zip`, otherwise it will be assumed to be an unpacked Electron app directory
164164
*/
165-
readonly electronDist?: string | ((options: PrepareApplicationStageDirectoryOptions) => string)
165+
readonly electronDist?: string | CustomElectronDistributable
166166

167167
/**
168168
* The [electron-download](https://github.com/electron-userland/electron-download#usage) options.
@@ -218,52 +218,53 @@ export interface Configuration extends PlatformSpecificBuildOptions {
218218
/**
219219
* The function (or path to file or module id) to be [run before pack](#beforepack)
220220
*/
221-
readonly beforePack?: ((context: BeforePackContext) => Promise<any> | any) | string | null
221+
readonly beforePack?: Hook<BeforePackContext, any> | string | null
222222

223223
/**
224224
* The function (or path to file or module id) to be [run after the prebuilt Electron binary has been extracted to the output directory](#afterextract)
225225
*/
226-
readonly afterExtract?: ((context: AfterExtractContext) => Promise<any> | any) | string | null
226+
readonly afterExtract?: Hook<AfterExtractContext, any> | string | null
227227

228228
/**
229229
* The function (or path to file or module id) to be [run after pack](#afterpack) (but before pack into distributable format and sign).
230230
*/
231-
readonly afterPack?: ((context: AfterPackContext) => Promise<any> | any) | string | null
231+
readonly afterPack?: Hook<AfterPackContext, any> | string | null
232+
232233
/**
233234
* The function (or path to file or module id) to be [run after pack and sign](#aftersign) (but before pack into distributable format).
234235
*/
235-
readonly afterSign?: ((context: AfterPackContext) => Promise<any> | any) | string | null
236+
readonly afterSign?: Hook<AfterPackContext, any> | string | null
236237

237238
/**
238239
* The function (or path to file or module id) to be run on artifact build start.
239240
*/
240-
readonly artifactBuildStarted?: ((context: ArtifactBuildStarted) => Promise<any> | any) | string | null
241+
readonly artifactBuildStarted?: Hook<ArtifactBuildStarted, any> | string | null
241242
/**
242243
* The function (or path to file or module id) to be run on artifact build completed.
243244
*/
244-
readonly artifactBuildCompleted?: ((context: ArtifactCreated) => Promise<any> | any) | string | null
245+
readonly artifactBuildCompleted?: Hook<ArtifactCreated, any> | string | null
245246
/**
246247
* The function (or path to file or module id) to be [run after all artifacts are build](#afterAllArtifactBuild).
247248
*/
248-
readonly afterAllArtifactBuild?: ((context: BuildResult) => Promise<Array<string>> | Array<string>) | string | null
249+
readonly afterAllArtifactBuild?: Hook<BuildResult, Array<string>> | string | null
249250
/**
250251
* MSI project created on disk - not packed into .msi package yet.
251252
*/
252-
readonly msiProjectCreated?: ((path: string) => Promise<any> | any) | string | null
253+
readonly msiProjectCreated?: Hook<string, any> | string | null
253254
/**
254255
* Appx manifest created on disk - not packed into .appx package yet.
255256
*/
256-
readonly appxManifestCreated?: ((path: string) => Promise<any> | any) | string | null
257+
readonly appxManifestCreated?: Hook<string, any> | string | null
257258
/**
258259
* The function (or path to file or module id) to be [run on each node module](#onnodemodulefile) file. Returning `true`/`false` will determine whether to force include or to use the default copier logic
259260
*/
260-
readonly onNodeModuleFile?: ((path: string) => void | boolean) | string | null
261+
readonly onNodeModuleFile?: Hook<string, void | boolean> | string | null
261262
/**
262263
* The function (or path to file or module id) to be run before dependencies are installed or rebuilt. Works when `npmRebuild` is set to `true`. Resolving to `false` will skip dependencies install or rebuild.
263264
*
264265
* If provided and `node_modules` are missing, it will not invoke production dependencies check.
265266
*/
266-
readonly beforeBuild?: ((context: BeforeBuildContext) => Promise<any>) | string | null
267+
readonly beforeBuild?: Hook<BeforeBuildContext, boolean | void> | string | null
267268

268269
/**
269270
* Whether to include PDB files.
@@ -324,3 +325,7 @@ export interface MetadataDirectories {
324325
*/
325326
readonly app?: string | null
326327
}
328+
329+
export type CustomElectronDistributable = (options: PrepareApplicationStageDirectoryOptions) => string
330+
331+
export type Hook<T, V> = (contextOrPath: T) => Promise<V> | V

‎packages/app-builder-lib/src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export {
2121
CompressionLevel,
2222
} from "./core"
2323
export { getArchSuffix, Arch, archFromString } from "builder-util"
24-
export { Configuration, AfterPackContext, MetadataDirectories } from "./configuration"
24+
export { Configuration, AfterPackContext, MetadataDirectories, BeforePackContext, AfterExtractContext, CustomElectronDistributable, Hook } from "./configuration"
2525
export { ElectronBrandingOptions, ElectronDownloadOptions, ElectronPlatformName } from "./electron/ElectronFramework"
2626
export { PlatformSpecificBuildOptions, AsarOptions, FileSet, Protocol, ReleaseInfo } from "./options/PlatformSpecificBuildOptions"
2727
export { FileAssociation } from "./options/FileAssociation"
@@ -32,7 +32,7 @@ export { AppXOptions } from "./options/AppXOptions"
3232
export { MsiOptions } from "./options/MsiOptions"
3333
export { MsiWrappedOptions } from "./options/MsiWrappedOptions"
3434
export { CommonWindowsInstallerConfiguration } from "./options/CommonWindowsInstallerConfiguration"
35-
export { NsisOptions, NsisWebOptions, PortableOptions, CommonNsisOptions } from "./targets/nsis/nsisOptions"
35+
export { NsisOptions, NsisWebOptions, PortableOptions, CommonNsisOptions, CustomNsisBinary } from "./targets/nsis/nsisOptions"
3636
export { LinuxConfiguration, DebOptions, CommonLinuxOptions, LinuxTargetSpecificOptions, AppImageOptions, FlatpakOptions } from "./options/linuxOptions"
3737
export { SnapOptions, PlugDescriptor, SlotDescriptor } from "./options/SnapOptions"
3838
export { Metadata, AuthorMetadata, RepositoryInfo } from "./options/metadata"

‎packages/app-builder-lib/src/targets/nsis/nsisOptions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { TargetSpecificOptions } from "../../core"
22
import { CommonWindowsInstallerConfiguration } from "../.."
33

4-
interface CustomNsisBinary {
4+
export interface CustomNsisBinary {
55
/**
66
* @default https://github.com/electron-userland/electron-builder-binaries/releases/download
77
*/

‎scripts/jsdoc2md2html.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,9 @@ async function render2(files, jsdoc2MdOptions) {
242242
new Page("generated/LinuxTargetSpecificOptions.md", "LinuxTargetSpecificOptions"),
243243
new Page("generated/PlatformSpecificBuildOptions.md", "PlatformSpecificBuildOptions"),
244244
new Page("generated/Metadata.md", "Metadata"),
245-
new Page("generated/NsisOptions.md", "NsisOptions"),
245+
new Page("generated/NsisOptions.md", "NsisOptions", {
246+
"CustomNsisBinary": ""
247+
}),
246248
new Page("generated/TargetSpecificOptions.md", "TargetSpecificOptions"),
247249
]
248250

‎test/snapshots/globTest.js.snap

+8
Original file line numberDiff line numberDiff line change
@@ -9715,6 +9715,14 @@ Object {
97159715
"package.json": Object {
97169716
"size": "<size>",
97179717
},
9718+
"script": Object {
9719+
"files": Object {
9720+
"cli.js": Object {
9721+
"executable": true,
9722+
"size": "<size>",
9723+
},
9724+
},
9725+
},
97189726
"src": Object {
97199727
"files": Object {
97209728
"ua-parser.js": Object {

0 commit comments

Comments
 (0)
Please sign in to comment.