-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathindex.d.ts
233 lines (230 loc) · 7.55 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
/**
* The `electron-installer-snap` API uses the Promise pattern to perform asynchronous operations.
*
* Minimal example:
*
* ```javascript
* const snap = require('electron-installer-snap')
*
* const snapPath = await snap(options)
* console.log(`Created snap at ${snapPath}!`)
* ```
*
* Full example with [Electron Packager](https://npm.im/electron-packager):
*
* ```javascript
* const packager = require('electron-packager')
* const snap = require('electron-installer-snap')
*
* const arch = 'x64'
*
* const paths = await packager({dir: '/path/to/app', platform: 'linux', arch: arch})
* const snapPath = await snap({src: paths[0], arch: arch})
* console.log(`Created snap at ${snapPath}!`)
* ```
*
* If you need to use the callback pattern instead of the `async`/`await` pattern, look into the
* [`util.callbackify` function](https://nodejs.org/api/util.html#util_util_callbackify_original).
*/
declare function createSnap(userSupplied: createSnap.SnapcraftOptions & createSnap.CustomSnapcraftConfig): Promise<string>;
declare namespace createSnap {
/**
* Additional Snapcraft configuration that is merged directly into `snapcraft.yaml`. In general,
* this does not override any configuration that is set via {@link Options}.
*/
type CustomSnapcraftConfig = Record<string, unknown>;
/**
* Any options that aren't specified here are passed through to the `snapcraft.yaml` file via {@link SnapcraftConfig}.
*/
interface SnapcraftOptions {
src: string;
/**
* [Additional app-specific Snapcraft configuration](https://docs.snapcraft.io/build-snaps/syntax#app-name)
* for the Electron app. This is different from {@link SnapcraftConfig} in that it is scoped
* under `apps.<app-name>`.
*/
appConfig?: Record<string, unknown>;
/**
* Additional [plugs](https://docs.snapcraft.io/reference/interfaces) for the Electron app,
* which are necessary for the app to be a consumer of a feature in the system. Common features
* can be set via the {@link features} option. To set any attributes for the plugs, set them in
* the {@link plugs} option.
*
* For example, if the app uses a DBus interface:
*
* ```javascript
* {
* appPlugs: ['my-dbus-interface'],
* plugs: {
* 'my-dbus-interface': {
* interface: 'dbus',
* name: 'com.example.my-interface',
* bus: 'session'
* }
* }
* }
* ```
*
* `plugs` will be passed through directly to the generated `snapcraft.yaml`.
*/
appPlugs?: string[];
/**
* Additional [slots](https://docs.snapcraft.io/reference/interfaces) for the Electron app,
* which are necessary for the app to be a producer of a feature in the system. Common features
* can be set via the {@link features} option. To set any attributes for the plugs, set them in
* the {@link slots} option.
*
* For example, if the app creates a DBus interface:
*
* ```javascript
* {
* appSlots: ['my-dbus-interface'],
* slots: {
* 'my-dbus-interface': {
* interface: 'dbus',
* name: 'com.example.my-interface',
* bus: 'session'
* }
* }
* }
* ```
*
* {@link slots} will be passed through directly to the generated `snapcraft.yaml`.
*/
appSlots?: string[];
/**
* Either the Node.js-formatted arch or Snap-formatted arch, used to specify the Snap's target arch.
*
* Default: the host arch, via [`process.arch`](https://nodejs.org/dist/latest-v12.x/docs/api/process.html#process_process_arch).
*/
arch?: string;
/**
* See the [Snapcraft documentation](https://snapcraft.io/docs/reference/confinement).
*
* Default: `devmode`
*/
confinement?: 'strict' | 'devmode' | 'classic';
/**
* The longer description for the snap. Can contain newlines.
*/
description?: string;
/**
* The absolute path to a custom Freedesktop.org desktop file template.
*/
desktopTemplate?: string;
/**
* The directory where the `.snap` file is created.
*
* Default: the current working directory.
*/
dest?: string;
/**
* The executable name of the Electron app, sans file extension. Corresponds
* to the [`executableName` option](https://electron.github.io/electron-packager/master/interfaces/electronpackager.options.html#executablename)
* in Electron Packager.
*
* Default: either `productName` or `name` in `package.json`
*/
executableName?: string;
/**
* Describes what functionality the Electron app needs, in order to work inside the Snap sandbox.
*
* Example:
*
* ```javascript
* {
* features: {
* audio: true,
* mpris: 'com.example.mpris',
* webgl: true
* }
* }
* ```
*
* Setting a feature to a `false`-y value does not disable the feature, only omitting the
* feature from the `Object` does that.
*/
features?: {
/**
* Audio support via PulseAudio.
*/
audio?: true;
/**
* Audio support via ALSA (replaces `audio` support if both are specified)
*/
alsa?: true;
/**
* [Web browser functionality](https://github.com/snapcore/snapd/wiki/Interfaces#browser-support).
* This was originally enabled by default when using Electron ≥ 5.0.0, due to the
* [setuid sandbox support](https://github.com/electron/electron/pull/17269).
* However, Snapcraft allows for use of the snap confined sandbox, particularly within
* strict confinement. We should encourage but not enforce the browser-sandbox plug.
*/
browserSandbox?: false;
/**
* [MPRIS](https://specifications.freedesktop.org/mpris-spec/latest/) support.
*
* If enabled, the interface name must be specified as the feature value.
*/
mpris?: string;
/**
* Access the secret service (e.g., GNOME Keyring)
*/
passwords?: true;
/**
* WebGL support (requires Mesa, etc.)
*/
webgl?: true;
};
/**
* The quality grade of the Snap. See the [Snapcraft documentation](https://docs.snapcraft.io/build-snaps/syntax#grade)
* for valid values.
*
* Default: `devel`
*/
grade?: 'devel' | 'stable';
/**
* One or more [hook scripts](https://docs.snapcraft.io/build-snaps/hooks) to be installed with
* the Snap. The format of the `Object` is `{ hookName: pathToHookScript, […] }`. Hook names
* can be found in the Snapcraft documentation.
*/
hookScripts?: Record<string, string>;
/**
* Modifies the execution environment of a strictly-confined snap.
*/
layouts?: Record<string, Record<string, unknown>>;
/**
* The name of the Snap package.
*
* Default: `name` in `package.json`
*/
name?: string;
/**
* See {@link appPlugs} for details.
*/
plugs?: Record<string, Record<string, unknown>>;
/**
* See {@link appSlots} for details.
*/
slots?: Record<string, Record<string, unknown>>;
/**
* The absolute path to the snapcraft executable.
*
* By default, it searches paths in the `PATH` environment variable.
*/
snapcraft?: string;
/**
* A 78 character long summary for the Snap.
*
* Default: `description` in `package.json`
*/
summary?: string;
/**
* The version of the Snap package.
*
* Default: `version` in `package.json`
*/
version?: string;
}
}
export = createSnap;