UNPKG

5.94 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 forceCodeSigning?: boolean
59 readonly publish?: Publish
60 }
61
62 export interface PlatformSpecificBuildOptions extends TargetSpecificOptions {
63 readonly files?: Array<string> | string | null
64 readonly extraFiles?: Array<FilePattern | string> | FilePattern | string | null
65 readonly extraResources?: Array<FilePattern | string> | FilePattern | string | null
66 readonly asarUnpack?: Array<string> | string | null
67 readonly asar?: AsarOptions | boolean | null
68 readonly target?: Array<string | TargetConfig> | string | TargetConfig | null
69 readonly icon?: string | null
70 readonly fileAssociations?: Array<FileAssociation> | FileAssociation
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 extraMetadata?: any | null
95 }
96
97 export interface BeforeBuildContext {
98 readonly appDir: string
99 readonly electronVersion: string
100 readonly platform: Platform
101 readonly arch: string
102 }
103
104 /**
105 * File associations.
106 *
107 * 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.
108 *
109 * On Windows works only if [nsis.perMachine](https://github.com/electron-userland/electron-builder/wiki/Options#NsisOptions-perMachine) is set to `true`.
110 */
111 export interface FileAssociation {
112 /**
113 * The extension (minus the leading period). e.g. `png`.
114 */
115 readonly ext: string | Array<string>
116 /**
117 * The name. e.g. `PNG`. Defaults to `ext`.
118 */
119 readonly name?: string | null
120 /**
121 * *windows-only.* The description.
122 */
123 readonly description?: string | null
124 /**
125 * 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.
126 */
127 readonly icon?: string | null
128 /**
129 * *macOS-only* The app’s role with respect to the type. The value can be `Editor`, `Viewer`, `Shell`, or `None`. Corresponds to `CFBundleTypeRole`.
130 * @default Editor
131 */
132 readonly role?: string
133 /**
134 * *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`.
135 */
136 readonly isPackage?: boolean
137 }
138
139 /**
140 * URL Protocol Schemes. Protocols to associate the app with. macOS only.
141 *
142 * Please note — on macOS [you need to register an `open-url` event handler](http://electron.atom.io/docs/api/app/#event-open-url-macos).
143 */
144 export interface Protocol {
145 /**
146 * The name. e.g. `IRC server URL`.
147 */
148 readonly name: string
149 /**
150 * *macOS-only* The app’s role with respect to the type.
151 * @default Editor
152 */
153 readonly role?: "Editor" | "Viewer" | "Shell" | "None"
154 /**
155 * The schemes. e.g. `["irc", "ircs"]`.
156 */
157 readonly schemes: Array<string>
158 }
159
160 /**
161 * `directories`
162 */
163 export interface MetadataDirectories {
164 /**
165 * The path to build resources.
166 * @default build
167 */
168 readonly buildResources?: string | null
169 /**
170 * The output directory.
171 * @default dist
172 */
173 readonly output?: string | null
174 /**
175 * The application directory (containing the application package.json), defaults to `app`, `www` or working directory.
176 */
177 readonly app?: string | null
178 }
179
180 export interface SourceRepositoryInfo {
181 type: string
182 domain: string
183 user: string
184 project: string
185 }
186}
187