@todesktop/shared 7.74.0 → 7.77.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/base.d.ts CHANGED
@@ -1,8 +1,135 @@
1
+ import { ExtraFileReference, FilePath, IAppBuilderLib } from "./desktopify";
1
2
  export interface Schemable {
2
3
  schemaVersion?: number;
3
4
  }
5
+ export declare type ProgressTypes = "progress" | "done" | "error";
6
+ export interface IChecklistItem {
7
+ [id: string]: boolean;
8
+ }
9
+ export interface IDownloadButtonOptions {
10
+ buttonSize: "small" | "medium" | "large";
11
+ fontFamily: "serif" | "sans-serif";
12
+ bgColor: string;
13
+ fgColor: string;
14
+ borderRadius: number;
15
+ showAppIcon: {
16
+ enabled: boolean;
17
+ alignment: "right" | "left";
18
+ };
19
+ showDownloadIcon: {
20
+ enabled: boolean;
21
+ alignment: "right" | "left";
22
+ };
23
+ btnText: string;
24
+ }
25
+ export declare enum WindowsEVOnboardingSteps {
26
+ "hasChosenProvider" = "hasChosenProvider",
27
+ "hasOrderedCert" = "hasOrderedCert",
28
+ "hasBeenVerified" = "hasBeenVerified",
29
+ "hasGeneratedCert" = "hasGeneratedCert",
30
+ "hasUploadedCert" = "hasUploadedCert"
31
+ }
32
+ export declare enum WindowsEVOnboardingProvider {
33
+ "globalsign" = "globalsign",
34
+ "other" = "other"
35
+ }
36
+ export interface IAppBuildProgress {
37
+ isBuilding: boolean;
38
+ message: string;
39
+ percent: number;
40
+ type: ProgressTypes;
41
+ shouldSkip: boolean;
42
+ }
43
+ export interface IAppMeta {
44
+ appIterations?: number;
45
+ completedChecklistItems?: IChecklistItem;
46
+ currentBuildProgress?: {
47
+ channel?: string;
48
+ id?: string;
49
+ linux?: IAppBuildProgress;
50
+ mac?: IAppBuildProgress;
51
+ projectConfig?: {
52
+ appId?: string;
53
+ appFiles?: string[];
54
+ appPath?: FilePath;
55
+ appProtocolScheme?: string;
56
+ copyright?: string;
57
+ dmg?: {
58
+ background?: FilePath;
59
+ artifactName?: string;
60
+ backgroundColor?: string;
61
+ iconSize?: number;
62
+ iconTextSize?: number;
63
+ title?: string;
64
+ contents?: IAppBuilderLib["config"]["dmg"]["contents"];
65
+ window?: IAppBuilderLib["config"]["dmg"]["window"];
66
+ };
67
+ extraContentFiles?: ExtraFileReference[];
68
+ electronMirror?: string;
69
+ electronVersion?: string;
70
+ extraResources?: ExtraFileReference[];
71
+ fileAssociations?: IAppBuilderLib["config"]["fileAssociations"];
72
+ filesForDistribution?: string[];
73
+ icon: FilePath;
74
+ id: string;
75
+ linux?: {
76
+ category?: string;
77
+ icon?: FilePath;
78
+ };
79
+ mac?: {
80
+ additionalBinariesToSign?: FilePath[];
81
+ category?: string;
82
+ dmgBackground?: FilePath;
83
+ entitlements?: FilePath;
84
+ extendInfo?: IAppBuilderLib["config"]["mac"]["extendInfo"];
85
+ icon?: FilePath;
86
+ };
87
+ productName?: string;
88
+ schemaVersion: number;
89
+ snap?: IAppBuilderLib["config"]["snap"];
90
+ windows?: {
91
+ icon?: FilePath;
92
+ };
93
+ };
94
+ shouldCodeSign?: boolean;
95
+ shouldRelease?: boolean;
96
+ shouldSendCompletionEmail?: boolean;
97
+ sourceArchiveDetails?: {
98
+ bucket: string;
99
+ key: string;
100
+ url: string;
101
+ };
102
+ windows?: IAppBuildProgress;
103
+ };
104
+ downloadButtons?: {
105
+ universal: IDownloadButtonOptions;
106
+ mac: IDownloadButtonOptions;
107
+ windows: IDownloadButtonOptions;
108
+ linux: IDownloadButtonOptions;
109
+ };
110
+ firstSuccessfulBuildEndedAt?: string;
111
+ isAppChanged?: boolean;
112
+ isFrameBlocked?: boolean;
113
+ isHttps?: boolean;
114
+ publishedVersions: {
115
+ desktopify?: string;
116
+ electron?: string;
117
+ version?: string;
118
+ };
119
+ windowsEVOnboarding?: {
120
+ provider: WindowsEVOnboardingProvider;
121
+ tempHSMCertName: string;
122
+ [WindowsEVOnboardingSteps.hasChosenProvider]: boolean;
123
+ [WindowsEVOnboardingSteps.hasOrderedCert]: boolean;
124
+ [WindowsEVOnboardingSteps.hasBeenVerified]: boolean;
125
+ [WindowsEVOnboardingSteps.hasGeneratedCert]: boolean;
126
+ [WindowsEVOnboardingSteps.hasUploadedCert]: boolean;
127
+ };
128
+ forceVersionNumber?: string;
129
+ }
4
130
  export interface BaseApp extends Schemable {
5
131
  id: string;
132
+ meta?: IAppMeta;
6
133
  subscription?: {
7
134
  status: string;
8
135
  subscriptionId: string;
package/lib/base.js CHANGED
@@ -1,2 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ var WindowsEVOnboardingSteps;
4
+ (function (WindowsEVOnboardingSteps) {
5
+ WindowsEVOnboardingSteps["hasChosenProvider"] = "hasChosenProvider";
6
+ WindowsEVOnboardingSteps["hasOrderedCert"] = "hasOrderedCert";
7
+ WindowsEVOnboardingSteps["hasBeenVerified"] = "hasBeenVerified";
8
+ WindowsEVOnboardingSteps["hasGeneratedCert"] = "hasGeneratedCert";
9
+ WindowsEVOnboardingSteps["hasUploadedCert"] = "hasUploadedCert";
10
+ })(WindowsEVOnboardingSteps = exports.WindowsEVOnboardingSteps || (exports.WindowsEVOnboardingSteps = {}));
11
+ var WindowsEVOnboardingProvider;
12
+ (function (WindowsEVOnboardingProvider) {
13
+ WindowsEVOnboardingProvider["globalsign"] = "globalsign";
14
+ WindowsEVOnboardingProvider["other"] = "other";
15
+ })(WindowsEVOnboardingProvider = exports.WindowsEVOnboardingProvider || (exports.WindowsEVOnboardingProvider = {}));
@@ -262,6 +262,11 @@ export interface DesktopifyApp2 {
262
262
  * https://linear.app/todesktop/issue/TD-1428/html-injection-due-to-regular-expression-bypass
263
263
  */
264
264
  useSafeInternalUrlMatcher?: boolean;
265
+ /**
266
+ * Sets whether the window menu bar should hide itself automatically.
267
+ * Once set the menu bar will only show when users press the single Alt key.
268
+ */
269
+ autoHideMenuBar?: boolean;
265
270
  }
266
271
  export interface IApp2 extends BaseApp {
267
272
  desktopApp: DesktopifyApp2;
package/lib/index.js CHANGED
@@ -8,6 +8,7 @@ __export(require("./toDesktop"));
8
8
  __export(require("./desktopify"));
9
9
  __export(require("./validations"));
10
10
  __export(require("./plans"));
11
+ __export(require("./base"));
11
12
  __export(require("./desktopify2"));
12
13
  const schemaVersion = package_json_1.version;
13
14
  exports.schemaVersion = schemaVersion;
@@ -1,5 +1,5 @@
1
1
  import { BaseApp, Schemable } from "./base";
2
- import { ExtraFileReference, FilePath, IAppBuilderLib, URL } from "./desktopify";
2
+ import { IAppBuilderLib, URL } from "./desktopify";
3
3
  export declare type IUploadFileStatus = "error" | "success" | "done" | "uploading" | "removed";
4
4
  export interface IUploadFile {
5
5
  uid: string;
@@ -46,7 +46,6 @@ export interface IAppWindowOptions {
46
46
  transparentInsetTitlebar: boolean;
47
47
  autoHideMenuBar: boolean;
48
48
  }
49
- export declare type ProgressTypes = "progress" | "done" | "error";
50
49
  export interface IWindowOptions {
51
50
  isAlwaysOnTop?: boolean;
52
51
  isAutoHideMenuBar?: boolean;
@@ -63,130 +62,6 @@ export interface IWindowOptions {
63
62
  maxWidth?: ISwitchableValue<number>;
64
63
  minWidth?: ISwitchableValue<number>;
65
64
  }
66
- export interface IChecklistItem {
67
- [id: string]: boolean;
68
- }
69
- export interface IAppBuildProgress {
70
- isBuilding: boolean;
71
- message: string;
72
- percent: number;
73
- type: ProgressTypes;
74
- shouldSkip: boolean;
75
- }
76
- export interface IDownloadButtonOptions {
77
- buttonSize: "small" | "medium" | "large";
78
- fontFamily: "serif" | "sans-serif";
79
- bgColor: string;
80
- fgColor: string;
81
- borderRadius: number;
82
- showAppIcon: {
83
- enabled: boolean;
84
- alignment: "right" | "left";
85
- };
86
- showDownloadIcon: {
87
- enabled: boolean;
88
- alignment: "right" | "left";
89
- };
90
- btnText: string;
91
- }
92
- export declare enum WindowsEVOnboardingSteps {
93
- "hasChosenProvider" = "hasChosenProvider",
94
- "hasOrderedCert" = "hasOrderedCert",
95
- "hasBeenVerified" = "hasBeenVerified",
96
- "hasGeneratedCert" = "hasGeneratedCert",
97
- "hasUploadedCert" = "hasUploadedCert"
98
- }
99
- export declare enum WindowsEVOnboardingProvider {
100
- "globalsign" = "globalsign",
101
- "other" = "other"
102
- }
103
- export interface IAppMeta {
104
- appIterations?: number;
105
- completedChecklistItems?: IChecklistItem;
106
- currentBuildProgress?: {
107
- channel?: string;
108
- id?: string;
109
- linux?: IAppBuildProgress;
110
- mac?: IAppBuildProgress;
111
- projectConfig?: {
112
- appId?: string;
113
- appFiles?: string[];
114
- appPath?: FilePath;
115
- appProtocolScheme?: string;
116
- copyright?: string;
117
- dmg?: {
118
- background?: FilePath;
119
- artifactName?: string;
120
- backgroundColor?: string;
121
- iconSize?: number;
122
- iconTextSize?: number;
123
- title?: string;
124
- contents?: IAppBuilderLib["config"]["dmg"]["contents"];
125
- window?: IAppBuilderLib["config"]["dmg"]["window"];
126
- };
127
- extraContentFiles?: ExtraFileReference[];
128
- electronMirror?: string;
129
- electronVersion?: string;
130
- extraResources?: ExtraFileReference[];
131
- fileAssociations?: IAppBuilderLib["config"]["fileAssociations"];
132
- filesForDistribution?: string[];
133
- icon: FilePath;
134
- id: string;
135
- linux?: {
136
- category?: string;
137
- icon?: FilePath;
138
- };
139
- mac?: {
140
- additionalBinariesToSign?: FilePath[];
141
- category?: string;
142
- dmgBackground?: FilePath;
143
- entitlements?: FilePath;
144
- extendInfo?: IAppBuilderLib["config"]["mac"]["extendInfo"];
145
- icon?: FilePath;
146
- };
147
- productName?: string;
148
- schemaVersion: number;
149
- snap?: IAppBuilderLib["config"]["snap"];
150
- windows?: {
151
- icon?: FilePath;
152
- };
153
- };
154
- shouldCodeSign?: boolean;
155
- shouldRelease?: boolean;
156
- shouldSendCompletionEmail?: boolean;
157
- sourceArchiveDetails?: {
158
- bucket: string;
159
- key: string;
160
- url: string;
161
- };
162
- windows?: IAppBuildProgress;
163
- };
164
- downloadButtons?: {
165
- universal: IDownloadButtonOptions;
166
- mac: IDownloadButtonOptions;
167
- windows: IDownloadButtonOptions;
168
- linux: IDownloadButtonOptions;
169
- };
170
- firstSuccessfulBuildEndedAt?: string;
171
- isAppChanged?: boolean;
172
- isFrameBlocked?: boolean;
173
- isHttps?: boolean;
174
- publishedVersions: {
175
- desktopify?: string;
176
- electron?: string;
177
- version?: string;
178
- };
179
- windowsEVOnboarding?: {
180
- provider: WindowsEVOnboardingProvider;
181
- tempHSMCertName: string;
182
- [WindowsEVOnboardingSteps.hasChosenProvider]: boolean;
183
- [WindowsEVOnboardingSteps.hasOrderedCert]: boolean;
184
- [WindowsEVOnboardingSteps.hasBeenVerified]: boolean;
185
- [WindowsEVOnboardingSteps.hasGeneratedCert]: boolean;
186
- [WindowsEVOnboardingSteps.hasUploadedCert]: boolean;
187
- };
188
- forceVersionNumber?: string;
189
- }
190
65
  export interface IAppPublishedVersions {
191
66
  electron?: string;
192
67
  desktopify?: string;
@@ -267,7 +142,6 @@ export interface IApp extends BaseApp {
267
142
  isTransitioningFromSquirrelWindows?: boolean;
268
143
  jsToInject?: string;
269
144
  menubarIcon?: string;
270
- meta?: IAppMeta;
271
145
  name: string;
272
146
  runtimeEnvs?: string;
273
147
  secret?: string;
package/lib/toDesktop.js CHANGED
@@ -1,18 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var WindowsEVOnboardingSteps;
4
- (function (WindowsEVOnboardingSteps) {
5
- WindowsEVOnboardingSteps["hasChosenProvider"] = "hasChosenProvider";
6
- WindowsEVOnboardingSteps["hasOrderedCert"] = "hasOrderedCert";
7
- WindowsEVOnboardingSteps["hasBeenVerified"] = "hasBeenVerified";
8
- WindowsEVOnboardingSteps["hasGeneratedCert"] = "hasGeneratedCert";
9
- WindowsEVOnboardingSteps["hasUploadedCert"] = "hasUploadedCert";
10
- })(WindowsEVOnboardingSteps = exports.WindowsEVOnboardingSteps || (exports.WindowsEVOnboardingSteps = {}));
11
- var WindowsEVOnboardingProvider;
12
- (function (WindowsEVOnboardingProvider) {
13
- WindowsEVOnboardingProvider["globalsign"] = "globalsign";
14
- WindowsEVOnboardingProvider["other"] = "other";
15
- })(WindowsEVOnboardingProvider = exports.WindowsEVOnboardingProvider || (exports.WindowsEVOnboardingProvider = {}));
16
3
  var WindowsHSMCertType;
17
4
  (function (WindowsHSMCertType) {
18
5
  WindowsHSMCertType["ev"] = "ev";
@@ -1,5 +1,6 @@
1
1
  import * as yup from "yup";
2
2
  export declare const appTitleValidation: yup.StringSchema;
3
+ export declare const forceVersionValidation: yup.StringSchema;
3
4
  export declare const iconValidation: yup.StringSchema;
4
5
  export declare const urlValidation: yup.StringSchema;
5
6
  export declare const urlValidationForm: yup.ObjectSchema<yup.Shape<object, {
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const yup = require("yup");
4
+ const semver = require("semver");
4
5
  const isRegex = require("is-regex");
5
6
  exports.appTitleValidation = yup
6
7
  .string()
@@ -9,6 +10,29 @@ exports.appTitleValidation = yup
9
10
  .matches(/^[\w\-\s]+$/, "App title may contain letters, numbers, spaces and dashes only")
10
11
  .matches(/^[^\s]+(\s+[^\s]+)*$/, "App title may not begin or end with space")
11
12
  .required();
13
+ function isNumeric(str) {
14
+ if (typeof str != "string")
15
+ return false;
16
+ return !isNaN(str) && !isNaN(parseFloat(str));
17
+ }
18
+ function isNumericSemver(value) {
19
+ // check if valid semver
20
+ if (!semver.valid(value))
21
+ return false;
22
+ // ensure that all values are numbers
23
+ if (!value.split(".").every((num) => isNumeric(num)))
24
+ return false;
25
+ return true;
26
+ }
27
+ exports.forceVersionValidation = yup
28
+ .string()
29
+ .label("App version")
30
+ .min(5)
31
+ .required()
32
+ .when("$currentVersion", (currentVersion, schema) => schema.test("semantic-version", "Specified app version must follow a numeric SemVer versioning scheme (e.g. 1.0.0)", (forceVersion) => {
33
+ return (isNumericSemver(forceVersion) &&
34
+ semver.gt(forceVersion, currentVersion));
35
+ }));
12
36
  exports.iconValidation = yup
13
37
  .string()
14
38
  .label("Icon")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@todesktop/shared",
3
- "version": "7.74.0",
3
+ "version": "7.77.0",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -19,9 +19,11 @@
19
19
  "@types/node": "^16.4.12",
20
20
  "@types/yup": "^0.26.9",
21
21
  "is-regex": "^1.0.4",
22
+ "semver": "^7.3.5",
22
23
  "yup": "^0.26.10"
23
24
  },
24
25
  "devDependencies": {
26
+ "@types/semver": "^7.3.9",
25
27
  "app-builder-lib": "^22.10.4",
26
28
  "tslint": "^5.12.1",
27
29
  "tslint-config-prettier": "1.18.0",
package/src/base.ts CHANGED
@@ -1,9 +1,143 @@
1
+ import { ExtraFileReference, FilePath, IAppBuilderLib } from "./desktopify";
1
2
  export interface Schemable {
2
3
  schemaVersion?: number;
3
4
  }
4
5
 
6
+ export type ProgressTypes = "progress" | "done" | "error";
7
+
8
+ export interface IChecklistItem {
9
+ [id: string]: boolean;
10
+ }
11
+
12
+ export interface IDownloadButtonOptions {
13
+ buttonSize: "small" | "medium" | "large";
14
+ fontFamily: "serif" | "sans-serif";
15
+ bgColor: string;
16
+ fgColor: string;
17
+ borderRadius: number;
18
+ showAppIcon: {
19
+ enabled: boolean;
20
+ alignment: "right" | "left";
21
+ };
22
+ showDownloadIcon: {
23
+ enabled: boolean;
24
+ alignment: "right" | "left";
25
+ };
26
+ btnText: string;
27
+ }
28
+
29
+ export enum WindowsEVOnboardingSteps {
30
+ "hasChosenProvider" = "hasChosenProvider",
31
+ "hasOrderedCert" = "hasOrderedCert",
32
+ "hasBeenVerified" = "hasBeenVerified",
33
+ "hasGeneratedCert" = "hasGeneratedCert",
34
+ "hasUploadedCert" = "hasUploadedCert",
35
+ }
36
+
37
+ export enum WindowsEVOnboardingProvider {
38
+ "globalsign" = "globalsign",
39
+ "other" = "other",
40
+ }
41
+
42
+ export interface IAppBuildProgress {
43
+ isBuilding: boolean;
44
+ message: string;
45
+ percent: number;
46
+ type: ProgressTypes;
47
+ shouldSkip: boolean;
48
+ }
49
+
50
+ export interface IAppMeta {
51
+ appIterations?: number;
52
+ completedChecklistItems?: IChecklistItem;
53
+ currentBuildProgress?: {
54
+ channel?: string;
55
+ id?: string;
56
+ linux?: IAppBuildProgress;
57
+ mac?: IAppBuildProgress;
58
+ projectConfig?: {
59
+ appId?: string;
60
+ appFiles?: string[];
61
+ appPath?: FilePath;
62
+ appProtocolScheme?: string;
63
+ copyright?: string;
64
+ dmg?: {
65
+ background?: FilePath;
66
+ artifactName?: string;
67
+ backgroundColor?: string;
68
+ iconSize?: number;
69
+ iconTextSize?: number;
70
+ title?: string;
71
+ contents?: IAppBuilderLib["config"]["dmg"]["contents"];
72
+ window?: IAppBuilderLib["config"]["dmg"]["window"];
73
+ };
74
+ extraContentFiles?: ExtraFileReference[];
75
+ electronMirror?: string;
76
+ electronVersion?: string;
77
+ extraResources?: ExtraFileReference[];
78
+ fileAssociations?: IAppBuilderLib["config"]["fileAssociations"];
79
+ filesForDistribution?: string[];
80
+ icon: FilePath;
81
+ id: string;
82
+ linux?: {
83
+ category?: string;
84
+ icon?: FilePath;
85
+ };
86
+ mac?: {
87
+ additionalBinariesToSign?: FilePath[];
88
+ category?: string;
89
+ dmgBackground?: FilePath;
90
+ entitlements?: FilePath;
91
+ extendInfo?: IAppBuilderLib["config"]["mac"]["extendInfo"];
92
+ icon?: FilePath;
93
+ };
94
+ productName?: string;
95
+ schemaVersion: number;
96
+ snap?: IAppBuilderLib["config"]["snap"];
97
+ windows?: {
98
+ icon?: FilePath;
99
+ };
100
+ };
101
+ shouldCodeSign?: boolean;
102
+ shouldRelease?: boolean;
103
+ shouldSendCompletionEmail?: boolean;
104
+ sourceArchiveDetails?: {
105
+ bucket: string;
106
+ key: string;
107
+ url: string;
108
+ };
109
+ windows?: IAppBuildProgress;
110
+ };
111
+ downloadButtons?: {
112
+ universal: IDownloadButtonOptions;
113
+ mac: IDownloadButtonOptions;
114
+ windows: IDownloadButtonOptions;
115
+ linux: IDownloadButtonOptions;
116
+ };
117
+ firstSuccessfulBuildEndedAt?: string;
118
+ isAppChanged?: boolean;
119
+ isFrameBlocked?: boolean;
120
+ isHttps?: boolean;
121
+ publishedVersions: {
122
+ desktopify?: string;
123
+ electron?: string;
124
+ version?: string;
125
+ };
126
+ windowsEVOnboarding?: {
127
+ provider: WindowsEVOnboardingProvider;
128
+ tempHSMCertName: string;
129
+ [WindowsEVOnboardingSteps.hasChosenProvider]: boolean;
130
+ [WindowsEVOnboardingSteps.hasOrderedCert]: boolean;
131
+ [WindowsEVOnboardingSteps.hasBeenVerified]: boolean;
132
+ [WindowsEVOnboardingSteps.hasGeneratedCert]: boolean;
133
+ [WindowsEVOnboardingSteps.hasUploadedCert]: boolean;
134
+ };
135
+ forceVersionNumber?: string;
136
+ }
137
+
5
138
  export interface BaseApp extends Schemable {
6
139
  id: string;
140
+ meta?: IAppMeta;
7
141
  subscription?: {
8
142
  status: string;
9
143
  subscriptionId: string;
@@ -369,6 +369,11 @@ export interface DesktopifyApp2 {
369
369
  * https://linear.app/todesktop/issue/TD-1428/html-injection-due-to-regular-expression-bypass
370
370
  */
371
371
  useSafeInternalUrlMatcher?: boolean;
372
+ /**
373
+ * Sets whether the window menu bar should hide itself automatically.
374
+ * Once set the menu bar will only show when users press the single Alt key.
375
+ */
376
+ autoHideMenuBar?: boolean;
372
377
  }
373
378
 
374
379
  export interface IApp2 extends BaseApp {
package/src/toDesktop.ts CHANGED
@@ -1,10 +1,5 @@
1
1
  import { BaseApp, Schemable } from "./base";
2
- import {
3
- ExtraFileReference,
4
- FilePath,
5
- IAppBuilderLib,
6
- URL,
7
- } from "./desktopify";
2
+ import { IAppBuilderLib, URL } from "./desktopify";
8
3
 
9
4
  export type IUploadFileStatus =
10
5
  | "error"
@@ -63,8 +58,6 @@ export interface IAppWindowOptions {
63
58
  autoHideMenuBar: boolean;
64
59
  }
65
60
 
66
- export type ProgressTypes = "progress" | "done" | "error";
67
-
68
61
  export interface IWindowOptions {
69
62
  isAlwaysOnTop?: boolean;
70
63
  isAutoHideMenuBar?: boolean;
@@ -81,135 +74,6 @@ export interface IWindowOptions {
81
74
  maxWidth?: ISwitchableValue<number>;
82
75
  minWidth?: ISwitchableValue<number>;
83
76
  }
84
- export interface IChecklistItem {
85
- [id: string]: boolean;
86
- }
87
-
88
- export interface IAppBuildProgress {
89
- isBuilding: boolean;
90
- message: string;
91
- percent: number;
92
- type: ProgressTypes;
93
- shouldSkip: boolean;
94
- }
95
-
96
- export interface IDownloadButtonOptions {
97
- buttonSize: "small" | "medium" | "large";
98
- fontFamily: "serif" | "sans-serif";
99
- bgColor: string;
100
- fgColor: string;
101
- borderRadius: number;
102
- showAppIcon: {
103
- enabled: boolean;
104
- alignment: "right" | "left";
105
- };
106
- showDownloadIcon: {
107
- enabled: boolean;
108
- alignment: "right" | "left";
109
- };
110
- btnText: string;
111
- }
112
-
113
- export enum WindowsEVOnboardingSteps {
114
- "hasChosenProvider" = "hasChosenProvider",
115
- "hasOrderedCert" = "hasOrderedCert",
116
- "hasBeenVerified" = "hasBeenVerified",
117
- "hasGeneratedCert" = "hasGeneratedCert",
118
- "hasUploadedCert" = "hasUploadedCert",
119
- }
120
-
121
- export enum WindowsEVOnboardingProvider {
122
- "globalsign" = "globalsign",
123
- "other" = "other",
124
- }
125
-
126
- export interface IAppMeta {
127
- appIterations?: number;
128
- completedChecklistItems?: IChecklistItem;
129
- currentBuildProgress?: {
130
- channel?: string;
131
- id?: string;
132
- linux?: IAppBuildProgress;
133
- mac?: IAppBuildProgress;
134
- projectConfig?: {
135
- appId?: string;
136
- appFiles?: string[];
137
- appPath?: FilePath;
138
- appProtocolScheme?: string;
139
- copyright?: string;
140
- dmg?: {
141
- background?: FilePath;
142
- artifactName?: string;
143
- backgroundColor?: string;
144
- iconSize?: number;
145
- iconTextSize?: number;
146
- title?: string;
147
- contents?: IAppBuilderLib["config"]["dmg"]["contents"];
148
- window?: IAppBuilderLib["config"]["dmg"]["window"];
149
- };
150
- extraContentFiles?: ExtraFileReference[];
151
- electronMirror?: string;
152
- electronVersion?: string;
153
- extraResources?: ExtraFileReference[];
154
- fileAssociations?: IAppBuilderLib["config"]["fileAssociations"];
155
- filesForDistribution?: string[];
156
- icon: FilePath;
157
- id: string;
158
- linux?: {
159
- category?: string;
160
- icon?: FilePath;
161
- };
162
- mac?: {
163
- additionalBinariesToSign?: FilePath[];
164
- category?: string;
165
- dmgBackground?: FilePath;
166
- entitlements?: FilePath;
167
- extendInfo?: IAppBuilderLib["config"]["mac"]["extendInfo"];
168
- icon?: FilePath;
169
- };
170
- productName?: string;
171
- schemaVersion: number;
172
- snap?: IAppBuilderLib["config"]["snap"];
173
- windows?: {
174
- icon?: FilePath;
175
- };
176
- };
177
- shouldCodeSign?: boolean;
178
- shouldRelease?: boolean;
179
- shouldSendCompletionEmail?: boolean;
180
- sourceArchiveDetails?: {
181
- bucket: string;
182
- key: string;
183
- url: string;
184
- };
185
- windows?: IAppBuildProgress;
186
- };
187
- downloadButtons?: {
188
- universal: IDownloadButtonOptions;
189
- mac: IDownloadButtonOptions;
190
- windows: IDownloadButtonOptions;
191
- linux: IDownloadButtonOptions;
192
- };
193
- firstSuccessfulBuildEndedAt?: string;
194
- isAppChanged?: boolean;
195
- isFrameBlocked?: boolean;
196
- isHttps?: boolean;
197
- publishedVersions: {
198
- desktopify?: string;
199
- electron?: string;
200
- version?: string;
201
- };
202
- windowsEVOnboarding?: {
203
- provider: WindowsEVOnboardingProvider;
204
- tempHSMCertName: string;
205
- [WindowsEVOnboardingSteps.hasChosenProvider]: boolean;
206
- [WindowsEVOnboardingSteps.hasOrderedCert]: boolean;
207
- [WindowsEVOnboardingSteps.hasBeenVerified]: boolean;
208
- [WindowsEVOnboardingSteps.hasGeneratedCert]: boolean;
209
- [WindowsEVOnboardingSteps.hasUploadedCert]: boolean;
210
- };
211
- forceVersionNumber?: string;
212
- }
213
77
 
214
78
  export interface IAppPublishedVersions {
215
79
  electron?: string;
@@ -298,7 +162,6 @@ export interface IApp extends BaseApp {
298
162
  isTransitioningFromSquirrelWindows?: boolean;
299
163
  jsToInject?: string;
300
164
  menubarIcon?: string;
301
- meta?: IAppMeta;
302
165
  name: string;
303
166
  runtimeEnvs?: string;
304
167
  secret?: string; // support old schema versions
@@ -1,4 +1,5 @@
1
1
  import * as yup from "yup";
2
+ import * as semver from "semver";
2
3
  import * as isRegex from "is-regex";
3
4
  export const appTitleValidation = yup
4
5
  .string()
@@ -11,6 +12,39 @@ export const appTitleValidation = yup
11
12
  .matches(/^[^\s]+(\s+[^\s]+)*$/, "App title may not begin or end with space")
12
13
  .required();
13
14
 
15
+ function isNumeric(str: string) {
16
+ if (typeof str != "string") return false;
17
+ return !isNaN(str as any) && !isNaN(parseFloat(str));
18
+ }
19
+
20
+ function isNumericSemver(value: string) {
21
+ // check if valid semver
22
+ if (!semver.valid(value)) return false;
23
+
24
+ // ensure that all values are numbers
25
+ if (!value.split(".").every((num) => isNumeric(num))) return false;
26
+
27
+ return true;
28
+ }
29
+
30
+ export const forceVersionValidation = yup
31
+ .string()
32
+ .label("App version")
33
+ .min(5)
34
+ .required()
35
+ .when("$currentVersion", (currentVersion, schema) =>
36
+ schema.test(
37
+ "semantic-version",
38
+ "Specified app version must follow a numeric SemVer versioning scheme (e.g. 1.0.0)",
39
+ (forceVersion: string) => {
40
+ return (
41
+ isNumericSemver(forceVersion) &&
42
+ semver.gt(forceVersion, currentVersion)
43
+ );
44
+ }
45
+ )
46
+ );
47
+
14
48
  export const iconValidation = yup
15
49
  .string()
16
50
  .label("Icon")