UNPKG

6.36 kBTypeScriptView Raw
1import { TargetSpecificOptions } from "../core";
2import { CommonLinuxOptions } from "./linuxOptions";
3export interface SnapOptions extends CommonLinuxOptions, TargetSpecificOptions {
4 /**
5 * A snap of type base to be used as the execution environment for this snap. Examples: `core`, `core18`, `core20`, `core22`. Defaults to `core20`
6 */
7 readonly base?: string | null;
8 /**
9 * The type of [confinement](https://snapcraft.io/docs/reference/confinement) supported by the snap.
10 * @default strict
11 */
12 readonly confinement?: "devmode" | "strict" | "classic" | null;
13 /**
14 * The custom environment. Defaults to `{"TMPDIR: "$XDG_RUNTIME_DIR"}`. If you set custom, it will be merged with default.
15 */
16 readonly environment?: {
17 [key: string]: string;
18 } | null;
19 /**
20 * The 78 character long summary. Defaults to [productName](/configuration/configuration#Configuration-productName).
21 */
22 readonly summary?: string | null;
23 /**
24 * The quality grade of the snap. It can be either `devel` (i.e. a development version of the snap, so not to be published to the “stable” or “candidate” channels) or “stable” (i.e. a stable release or release candidate, which can be released to all channels).
25 * @default stable
26 */
27 readonly grade?: "devel" | "stable" | null;
28 /**
29 * The list of features that must be supported by the core in order for this snap to install.
30 */
31 readonly assumes?: Array<string> | string | null;
32 /**
33 * The list of debian packages needs to be installed for building this snap.
34 */
35 readonly buildPackages?: Array<string> | null;
36 /**
37 * The list of Ubuntu packages to use that are needed to support the `app` part creation. Like `depends` for `deb`.
38 * Defaults to `["libnspr4", "libnss3", "libxss1", "libappindicator3-1", "libsecret-1-0"]`.
39 *
40 * If list contains `default`, it will be replaced to default list, so, `["default", "foo"]` can be used to add custom package `foo` in addition to defaults.
41 */
42 readonly stagePackages?: Array<string> | null;
43 /**
44 * The [hooks](https://docs.snapcraft.io/build-snaps/hooks) directory, relative to `build` (build resources directory).
45 * @default build/snap-hooks
46 */
47 readonly hooks?: string | null;
48 /**
49 * The list of [plugs](https://snapcraft.io/docs/reference/interfaces).
50 * Defaults to `["desktop", "desktop-legacy", "home", "x11", "wayland", "unity7", "browser-support", "network", "gsettings", "audio-playback", "pulseaudio", "opengl"]`.
51 *
52 * If list contains `default`, it will be replaced to default list, so, `["default", "foo"]` can be used to add custom plug `foo` in addition to defaults.
53 *
54 * Additional attributes can be specified using object instead of just name of plug:
55 * ```
56 *[
57 * {
58 * "browser-sandbox": {
59 * "interface": "browser-support",
60 * "allow-sandbox": true
61 * },
62 * },
63 * "another-simple-plug-name"
64 *]
65 * ```
66 */
67 readonly plugs?: Array<string | PlugDescriptor> | PlugDescriptor | null;
68 /**
69 * The list of [slots](https://snapcraft.io/docs/reference/interfaces).
70 *
71 * Additional attributes can be specified using object instead of just name of slot:
72 * ```
73 *[
74 * {
75 * "mpris": {
76 * "name": "chromium"
77 * },
78 * }
79 *]
80 *
81 * In case you want your application to be a compliant MPris player, you will need to definie
82 * The mpris slot with "chromium" name.
83 * This electron has it [hardcoded](https://source.chromium.org/chromium/chromium/src/+/master:components/system_media_controls/linux/system_media_controls_linux.cc;l=51;bpv=0;bpt=1),
84 * and we need to pass this name so snap [will allow it](https://forum.snapcraft.io/t/unable-to-use-mpris-interface/15360/7) in strict confinement.
85 *
86 */
87 readonly slots?: Array<string | SlotDescriptor> | PlugDescriptor | null;
88 /**
89 * Specifies any [parts](https://snapcraft.io/docs/reference/parts) that should be built before this part.
90 * Defaults to `["desktop-gtk2""]`.
91 *
92 * If list contains `default`, it will be replaced to default list, so, `["default", "foo"]` can be used to add custom parts `foo` in addition to defaults.
93 */
94 readonly after?: Array<string> | null;
95 /**
96 * Whether to use template snap. Defaults to `true` if `stagePackages` not specified.
97 */
98 readonly useTemplateApp?: boolean;
99 /**
100 * Whether or not the snap should automatically start on login.
101 * @default false
102 */
103 readonly autoStart?: boolean;
104 /**
105 * Specifies any files to make accessible from locations such as `/usr`, `/var`, and `/etc`. See [snap layouts](https://snapcraft.io/docs/snap-layouts) to learn more.
106 */
107 readonly layout?: {
108 [key: string]: {
109 [key: string]: string;
110 };
111 } | null;
112 /**
113 * Specifies which files from the app part to stage and which to exclude. Individual files, directories, wildcards, globstars, and exclusions are accepted. See [Snapcraft filesets](https://snapcraft.io/docs/snapcraft-filesets) to learn more about the format.
114 *
115 * The defaults can be found in [snap.ts](https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/templates/snap/snapcraft.yaml#L29).
116 */
117 readonly appPartStage?: Array<string> | null;
118 /**
119 * An optional title for the snap, may contain uppercase letters and spaces. Defaults to `productName`. See [snap format documentation](https://snapcraft.io/docs/snap-format).
120 */
121 readonly title?: string | null;
122 /**
123 * Sets the compression type for the snap. Can be xz, lzo, or null.
124 */
125 readonly compression?: "xz" | "lzo" | null;
126 /**
127 * Allow running the program with native wayland support with --ozone-platform=wayland.
128 * Disabled by default because of this issue in older Electron/Snap versions: https://github.com/electron-userland/electron-builder/issues/4007
129 */
130 readonly allowNativeWayland?: boolean | null;
131}
132export interface PlugDescriptor {
133 [key: string]: {
134 [key: string]: any;
135 } | null;
136}
137export interface SlotDescriptor {
138 [key: string]: {
139 [key: string]: any;
140 } | null;
141}