UNPKG

5.91 kBTypeScriptView Raw
1declare module "electron-builder-core" {
2 import { Publish } from "electron-builder-http/out/publishOptions"
3 export enum Arch {
4 ia32 = 0,
5 x64 = 1,
6 armv7l = 2,
7 }
8 export type ArchType = "x64" | "ia32" | "armv7l"
9
10 export function getArchSuffix(arch: Arch): string
11 export type TargetConfigType = Array<string | TargetConfig> | string | TargetConfig | null
12
13 export interface TargetConfig {
14 /**
15 * The target name. e.g. `snap`.
16 */
17 readonly target: string
18 /**
19 * The arch or list of archs.
20 */
21 readonly arch?: Array<"x64" | "ia32" | "armv7l"> | string
22 }
23
24 export function toLinuxArchString(arch: Arch): "armv7l" | "i386" | "amd64"
25
26 export function archFromString(name: string): Arch
27
28 export class Platform {
29 name: string
30 buildConfigurationKey: string
31 nodeName: string
32 static MAC: Platform
33 static LINUX: Platform
34 static WINDOWS: Platform
35 static OSX: Platform
36 constructor(name: string, buildConfigurationKey: string, nodeName: string)
37 toString(): string
38 createTarget(type?: string | Array<string> | null, ...archs: Array<Arch>): Map<Platform, Map<Arch, Array<string>>>
39 static current(): Platform
40 static fromString(name: string): Platform
41 }
42
43 export abstract class Target {
44 readonly name: string
45 readonly isAsyncSupported: boolean
46 readonly abstract outDir: string
47 readonly abstract options: TargetSpecificOptions | null | undefined
48 constructor(name: string, isAsyncSupported?: boolean)
49 abstract build(appOutDir: string, arch: Arch): Promise<any>
50 finishBuild(): Promise<any>
51 }
52
53 export interface TargetSpecificOptions {
54 /**
55 The [artifact file name pattern](https://github.com/electron-userland/electron-builder/wiki/Options#artifact-file-name-pattern).
56 */
57 readonly artifactName?: string | null
58 readonly publish?: Publish
59 }
60
61 export interface PlatformSpecificBuildOptions extends TargetSpecificOptions {
62 readonly files?: Array<string> | string | null
63 readonly extraFiles?: Array<FilePattern | string> | FilePattern | string | null
64 readonly extraResources?: Array<FilePattern | string> | FilePattern | string | null
65 readonly asarUnpack?: Array<string> | string | null
66 readonly asar?: AsarOptions | boolean | null
67 readonly target?: Array<string | TargetConfig> | string | TargetConfig | null
68 readonly icon?: string | null
69 readonly fileAssociations?: Array<FileAssociation> | FileAssociation
70 readonly forceCodeSigning?: boolean
71 }
72 export const DEFAULT_TARGET = "default"
73 export const DIR_TARGET = "dir"
74
75 export interface AuthorMetadata {
76 readonly name: string
77 readonly email?: string
78 }
79 export type CompressionLevel = "store" | "normal" | "maximum"
80
81 export interface RepositoryInfo {
82 readonly url: string
83 }
84
85 export interface FilePattern {
86 from?: string
87 to?: string
88 filter?: Array<string> | string
89 }
90
91 export interface AsarOptions {
92 smartUnpack?: boolean
93 ordering?: string | null
94 }
95
96 export interface BeforeBuildContext {
97 readonly appDir: string
98 readonly electronVersion: string
99 readonly platform: Platform
100 readonly arch: string
101 }
102
103 /**
104 * File associations.
105 *
106 * macOS (corresponds to [CFBundleDocumentTypes](https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-101685)) and NSIS only.
107 *
108 * On Windows works only if [nsis.perMachine](https://github.com/electron-userland/electron-builder/wiki/Options#NsisOptions-perMachine) is set to `true`.
109 */
110 export interface FileAssociation {
111 /**
112 * The extension (minus the leading period). e.g. `png`.
113 */
114 readonly ext: string | Array<string>
115 /**
116 * The name. e.g. `PNG`. Defaults to `ext`.
117 */
118 readonly name?: string | null
119 /**
120 * *windows-only.* The description.
121 */
122 readonly description?: string | null
123 /**
124 * The path to icon (`.icns` for MacOS and `.ico` for Windows), relative to `build` (build resources directory). Defaults to `${firstExt}.icns`/`${firstExt}.ico` (if several extensions specified, first is used) or to application icon.
125 */
126 readonly icon?: string | null
127 /**
128 * *macOS-only* The app’s role with respect to the type. The value can be `Editor`, `Viewer`, `Shell`, or `None`. Corresponds to `CFBundleTypeRole`.
129 * @default Editor
130 */
131 readonly role?: string
132 /**
133 * *macOS-only* Whether the document is distributed as a bundle. If set to true, the bundle directory is treated as a file. Corresponds to `LSTypeIsPackage`.
134 */
135 readonly isPackage?: boolean
136 }
137
138 /**
139 * URL Protocol Schemes. Protocols to associate the app with. macOS only.
140 *
141 * Please note — on macOS [you need to register an `open-url` event handler](http://electron.atom.io/docs/api/app/#event-open-url-macos).
142 */
143 export interface Protocol {
144 /**
145 * The name. e.g. `IRC server URL`.
146 */
147 readonly name: string
148 /**
149 * *macOS-only* The app’s role with respect to the type.
150 * @default Editor
151 */
152 readonly role?: "Editor" | "Viewer" | "Shell" | "None"
153 /**
154 * The schemes. e.g. `["irc", "ircs"]`.
155 */
156 readonly schemes: Array<string>
157 }
158
159 /**
160 * `directories`
161 */
162 export interface MetadataDirectories {
163 /**
164 * The path to build resources.
165 * @default build
166 */
167 readonly buildResources?: string | null
168 /**
169 * The output directory.
170 * @default dist
171 */
172 readonly output?: string | null
173 /**
174 * The application directory (containing the application package.json), defaults to `app`, `www` or working directory.
175 */
176 readonly app?: string | null
177 }
178
179 export interface SourceRepositoryInfo {
180 type: string
181 domain: string
182 user: string
183 project: string
184 }
185}
186