From 619971a8528b053c44eb3cf0a5ab18f345d1b01f Mon Sep 17 00:00:00 2001 From: sidneys Date: Fri, 18 Sep 2020 12:08:59 +0200 Subject: [PATCH] feat(snap): add Snap `title` option --- packages/app-builder-lib/scheme.json | 7 +++++++ packages/app-builder-lib/src/options/SnapOptions.ts | 5 +++++ packages/app-builder-lib/src/targets/snap.ts | 1 + 3 files changed, 13 insertions(+) diff --git a/packages/app-builder-lib/scheme.json b/packages/app-builder-lib/scheme.json index e09e5b8c5cd..b4c4b582986 100644 --- a/packages/app-builder-lib/scheme.json +++ b/packages/app-builder-lib/scheme.json @@ -4647,6 +4647,13 @@ "string" ] }, + "title": { + "description": "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).", + "type": [ + "null", + "string" + ] + }, "useTemplateApp": { "description": "Whether to use template snap. Defaults to `true` if `stagePackages` not specified.", "type": "boolean" diff --git a/packages/app-builder-lib/src/options/SnapOptions.ts b/packages/app-builder-lib/src/options/SnapOptions.ts index 1ee8a35fb2b..a6fa00f353a 100644 --- a/packages/app-builder-lib/src/options/SnapOptions.ts +++ b/packages/app-builder-lib/src/options/SnapOptions.ts @@ -104,6 +104,11 @@ export interface SnapOptions extends CommonLinuxOptions, TargetSpecificOptions { * 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). */ readonly appPartStage?: Array | null + + /** + * 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). + */ + readonly title?: string | null } export interface PlugDescriptor { diff --git a/packages/app-builder-lib/src/targets/snap.ts b/packages/app-builder-lib/src/targets/snap.ts index 6c74e0203a6..44db8597e5f 100644 --- a/packages/app-builder-lib/src/targets/snap.ts +++ b/packages/app-builder-lib/src/targets/snap.ts @@ -85,6 +85,7 @@ export default class SnapTarget extends Target { deepAssign(snap, { name: snapName, version: appInfo.version, + title: options.title || appInfo.productName, summary: options.summary || appInfo.productName, description: this.helper.getDescription(options), architectures: [toLinuxArchString(arch, "snap")],