app-builder-lib 26.0.0-alpha.2 → 26.0.0-alpha.4

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.
Files changed (50) hide show
  1. package/out/appInfo.js +1 -1
  2. package/out/appInfo.js.map +1 -1
  3. package/out/asar/asarUtil.js +1 -1
  4. package/out/asar/asarUtil.js.map +1 -1
  5. package/out/codeSign/windowsCodeSign.js +19 -2
  6. package/out/codeSign/windowsCodeSign.js.map +1 -1
  7. package/out/codeSign/windowsSignAzureManager.js +7 -4
  8. package/out/codeSign/windowsSignAzureManager.js.map +1 -1
  9. package/out/index.d.ts +1 -1
  10. package/out/index.js.map +1 -1
  11. package/out/linuxPackager.js +1 -1
  12. package/out/linuxPackager.js.map +1 -1
  13. package/out/options/CommonWindowsInstallerConfiguration.js +1 -1
  14. package/out/options/CommonWindowsInstallerConfiguration.js.map +1 -1
  15. package/out/options/PlatformSpecificBuildOptions.d.ts +3 -0
  16. package/out/options/PlatformSpecificBuildOptions.js.map +1 -1
  17. package/out/options/winOptions.d.ts +17 -1
  18. package/out/options/winOptions.js.map +1 -1
  19. package/out/publish/PublishManager.d.ts +1 -1
  20. package/out/publish/PublishManager.js +10 -16
  21. package/out/publish/PublishManager.js.map +1 -1
  22. package/out/version.d.ts +1 -1
  23. package/out/version.js +1 -1
  24. package/out/version.js.map +1 -1
  25. package/out/winPackager.d.ts +1 -2
  26. package/out/winPackager.js +12 -22
  27. package/out/winPackager.js.map +1 -1
  28. package/package.json +7 -9
  29. package/scheme.json +29 -6
  30. package/out/publish/BitbucketPublisher.d.ts +0 -16
  31. package/out/publish/BitbucketPublisher.js +0 -60
  32. package/out/publish/BitbucketPublisher.js.map +0 -1
  33. package/out/publish/KeygenPublisher.d.ts +0 -101
  34. package/out/publish/KeygenPublisher.js +0 -165
  35. package/out/publish/KeygenPublisher.js.map +0 -1
  36. package/out/publish/SnapStorePublisher.d.ts +0 -9
  37. package/out/publish/SnapStorePublisher.js +0 -35
  38. package/out/publish/SnapStorePublisher.js.map +0 -1
  39. package/out/publish/s3/BaseS3Publisher.d.ts +0 -10
  40. package/out/publish/s3/BaseS3Publisher.js +0 -64
  41. package/out/publish/s3/BaseS3Publisher.js.map +0 -1
  42. package/out/publish/s3/s3Publisher.d.ts +0 -12
  43. package/out/publish/s3/s3Publisher.js +0 -66
  44. package/out/publish/s3/s3Publisher.js.map +0 -1
  45. package/out/publish/s3/spacesPublisher.d.ts +0 -11
  46. package/out/publish/s3/spacesPublisher.js +0 -44
  47. package/out/publish/s3/spacesPublisher.js.map +0 -1
  48. package/out/util/filename.d.ts +0 -2
  49. package/out/util/filename.js +0 -39
  50. package/out/util/filename.js.map +0 -1
package/scheme.json CHANGED
@@ -1965,7 +1965,8 @@
1965
1965
  "string"
1966
1966
  ]
1967
1967
  }
1968
- ]
1968
+ ],
1969
+ "description": "Publisher configuration. See [Auto Update](./publish.md) for more information."
1969
1970
  },
1970
1971
  "releaseInfo": {
1971
1972
  "$ref": "#/definitions/ReleaseInfo",
@@ -2742,7 +2743,8 @@
2742
2743
  "string"
2743
2744
  ]
2744
2745
  }
2745
- ]
2746
+ ],
2747
+ "description": "Publisher configuration. See [Auto Update](./publish.md) for more information."
2746
2748
  },
2747
2749
  "releaseInfo": {
2748
2750
  "$ref": "#/definitions/ReleaseInfo",
@@ -3383,7 +3385,8 @@
3383
3385
  "string"
3384
3386
  ]
3385
3387
  }
3386
- ]
3388
+ ],
3389
+ "description": "Publisher configuration. See [Auto Update](./publish.md) for more information."
3387
3390
  },
3388
3391
  "releaseInfo": {
3389
3392
  "$ref": "#/definitions/ReleaseInfo",
@@ -6090,7 +6093,10 @@
6090
6093
  },
6091
6094
  "WindowsAzureSigningConfiguration": {
6092
6095
  "additionalProperties": {
6093
- "type": "string"
6096
+ "type": [
6097
+ "null",
6098
+ "string"
6099
+ ]
6094
6100
  },
6095
6101
  "properties": {
6096
6102
  "certificateProfileName": {
@@ -6104,6 +6110,21 @@
6104
6110
  "endpoint": {
6105
6111
  "description": "The Trusted Signing Account endpoint. The URI value must have a URI that aligns to the\nregion your Trusted Signing Account and Certificate Profile you are specifying were created\nin during the setup of these resources.\n\nTranslates to field: Endpoint\n\nRequires one of environment variable configurations for authenticating to Microsoft Entra ID per [Microsoft's documentation](https://learn.microsoft.com/en-us/dotnet/api/azure.identity.environmentcredential?view=azure-dotnet#definition)",
6106
6112
  "type": "string"
6113
+ },
6114
+ "fileDigest": {
6115
+ "default": "SHA256",
6116
+ "description": "The File Digest for signing each file. Translates to field: FileDigest",
6117
+ "type": "string"
6118
+ },
6119
+ "timestampDigest": {
6120
+ "default": "SHA256",
6121
+ "description": "The Timestamp Digest. Translates to field: TimestampDigest",
6122
+ "type": "string"
6123
+ },
6124
+ "timestampRfc3161": {
6125
+ "default": "http://timestamp.acs.microsoft.com",
6126
+ "description": "The Timestamp rfc3161 server. Translates to field: TimestampRfc3161",
6127
+ "type": "string"
6107
6128
  }
6108
6129
  },
6109
6130
  "required": [
@@ -6453,7 +6474,8 @@
6453
6474
  "string"
6454
6475
  ]
6455
6476
  }
6456
- ]
6477
+ ],
6478
+ "description": "Publisher configuration. See [Auto Update](./publish.md) for more information."
6457
6479
  },
6458
6480
  "publisherName": {
6459
6481
  "anyOf": [
@@ -7547,7 +7569,8 @@
7547
7569
  "string"
7548
7570
  ]
7549
7571
  }
7550
- ]
7572
+ ],
7573
+ "description": "Publisher configuration. See [Auto Update](./publish.md) for more information."
7551
7574
  },
7552
7575
  "releaseInfo": {
7553
7576
  "$ref": "#/definitions/ReleaseInfo",
@@ -1,16 +0,0 @@
1
- import { Arch } from "builder-util";
2
- import { ClientRequest } from "http";
3
- import { HttpPublisher, PublishContext } from "electron-publish";
4
- import { BitbucketOptions } from "builder-util-runtime/out/publishOptions";
5
- export declare class BitbucketPublisher extends HttpPublisher {
6
- readonly providerName = "bitbucket";
7
- readonly hostname = "api.bitbucket.org";
8
- private readonly info;
9
- private readonly auth;
10
- private readonly basePath;
11
- constructor(context: PublishContext, info: BitbucketOptions);
12
- protected doUpload(fileName: string, _arch: Arch, _dataLength: number, _requestProcessor: (request: ClientRequest, reject: (error: Error) => void) => void, file: string): Promise<any>;
13
- deleteRelease(filename: string): Promise<void>;
14
- toString(): string;
15
- static convertAppPassword(username: string, token: string): string;
16
- }
@@ -1,60 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BitbucketPublisher = void 0;
4
- const builder_util_1 = require("builder-util");
5
- const builder_util_2 = require("builder-util");
6
- const electron_publish_1 = require("electron-publish");
7
- const builder_util_runtime_1 = require("builder-util-runtime");
8
- const FormData = require("form-data");
9
- const fs_extra_1 = require("fs-extra");
10
- class BitbucketPublisher extends electron_publish_1.HttpPublisher {
11
- constructor(context, info) {
12
- super(context);
13
- this.providerName = "bitbucket";
14
- this.hostname = "api.bitbucket.org";
15
- const token = info.token || process.env.BITBUCKET_TOKEN || null;
16
- const username = info.username || process.env.BITBUCKET_USERNAME || null;
17
- if ((0, builder_util_1.isEmptyOrSpaces)(token)) {
18
- throw new builder_util_1.InvalidConfigurationError(`Bitbucket token is not set using env "BITBUCKET_TOKEN" (see https://www.electron.build/publish#BitbucketOptions)`);
19
- }
20
- if ((0, builder_util_1.isEmptyOrSpaces)(username)) {
21
- builder_util_1.log.warn('No Bitbucket username provided via "BITBUCKET_USERNAME". Defaulting to use repo owner.');
22
- }
23
- this.info = info;
24
- this.auth = BitbucketPublisher.convertAppPassword(username !== null && username !== void 0 ? username : this.info.owner, token);
25
- this.basePath = `/2.0/repositories/${this.info.owner}/${this.info.slug}/downloads`;
26
- }
27
- doUpload(fileName, _arch, _dataLength, _requestProcessor, file) {
28
- return builder_util_runtime_1.HttpExecutor.retryOnServerError(async () => {
29
- const fileContent = await (0, fs_extra_1.readFile)(file);
30
- const form = new FormData();
31
- form.append("files", fileContent, fileName);
32
- const upload = {
33
- hostname: this.hostname,
34
- path: this.basePath,
35
- headers: form.getHeaders(),
36
- timeout: this.info.timeout || undefined,
37
- };
38
- await builder_util_2.httpExecutor.doApiRequest((0, builder_util_runtime_1.configureRequestOptions)(upload, this.auth, "POST"), this.context.cancellationToken, it => form.pipe(it));
39
- return fileName;
40
- });
41
- }
42
- async deleteRelease(filename) {
43
- const req = {
44
- hostname: this.hostname,
45
- path: `${this.basePath}/${filename}`,
46
- timeout: this.info.timeout || undefined,
47
- };
48
- await builder_util_2.httpExecutor.request((0, builder_util_runtime_1.configureRequestOptions)(req, this.auth, "DELETE"), this.context.cancellationToken);
49
- }
50
- toString() {
51
- const { owner, slug, channel } = this.info;
52
- return `Bitbucket (owner: ${owner}, slug: ${slug}, channel: ${channel})`;
53
- }
54
- static convertAppPassword(username, token) {
55
- const base64encodedData = Buffer.from(`${username}:${token.trim()}`).toString("base64");
56
- return `Basic ${base64encodedData}`;
57
- }
58
- }
59
- exports.BitbucketPublisher = BitbucketPublisher;
60
- //# sourceMappingURL=BitbucketPublisher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BitbucketPublisher.js","sourceRoot":"","sources":["../../src/publish/BitbucketPublisher.ts"],"names":[],"mappings":";;;AAAA,+CAAoF;AACpF,+CAA2C;AAE3C,uDAAgE;AAEhE,+DAA4E;AAC5E,sCAAqC;AACrC,uCAAmC;AAEnC,MAAa,kBAAmB,SAAQ,gCAAa;IAQnD,YAAY,OAAuB,EAAE,IAAsB;QACzD,KAAK,CAAC,OAAO,CAAC,CAAA;QARP,iBAAY,GAAG,WAAW,CAAA;QAC1B,aAAQ,GAAG,mBAAmB,CAAA;QASrC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,IAAI,CAAA;QAC/D,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,IAAI,CAAA;QAExE,IAAI,IAAA,8BAAe,EAAC,KAAK,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,wCAAyB,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EAAE,CAAC,CAAC,CAAA;YACxI,OAAO,QAAQ,CAAA;QACjB,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,QAAgB;QAClC,MAAM,GAAG,GAAmB;YAC1B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,GAAG,IAAI,CAAC,QAAQ,IAAI,QAAQ,EAAE;YACpC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,SAAS;SACxC,CAAA;QACD,MAAM,2BAAY,CAAC,OAAO,CAAC,IAAA,8CAAuB,EAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAC/G,CAAC;IAED,QAAQ;QACN,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,CAAA;QAC1C,OAAO,qBAAqB,KAAK,WAAW,IAAI,cAAc,OAAO,GAAG,CAAA;IAC1E,CAAC;IAED,MAAM,CAAC,kBAAkB,CAAC,QAAgB,EAAE,KAAa;QACvD,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;QACvF,OAAO,SAAS,iBAAiB,EAAE,CAAA;IACrC,CAAC;CACF;AAnED,gDAmEC","sourcesContent":["import { Arch, InvalidConfigurationError, isEmptyOrSpaces, log } from \"builder-util\"\nimport { httpExecutor } from \"builder-util\"\nimport { ClientRequest, RequestOptions } from \"http\"\nimport { HttpPublisher, PublishContext } from \"electron-publish\"\nimport { BitbucketOptions } from \"builder-util-runtime/out/publishOptions\"\nimport { configureRequestOptions, HttpExecutor } from \"builder-util-runtime\"\nimport * as FormData from \"form-data\"\nimport { readFile } from \"fs-extra\"\n\nexport class BitbucketPublisher extends HttpPublisher {\n readonly providerName = \"bitbucket\"\n readonly hostname = \"api.bitbucket.org\"\n\n private readonly info: BitbucketOptions\n private readonly auth: string\n private readonly basePath: string\n\n constructor(context: PublishContext, info: BitbucketOptions) {\n super(context)\n\n const token = info.token || process.env.BITBUCKET_TOKEN || null\n const username = info.username || process.env.BITBUCKET_USERNAME || null\n\n if (isEmptyOrSpaces(token)) {\n throw new InvalidConfigurationError(`Bitbucket token is not set using env \"BITBUCKET_TOKEN\" (see https://www.electron.build/publish#BitbucketOptions)`)\n }\n\n if (isEmptyOrSpaces(username)) {\n log.warn('No Bitbucket username provided via \"BITBUCKET_USERNAME\". Defaulting to use repo owner.')\n }\n\n this.info = info\n this.auth = BitbucketPublisher.convertAppPassword(username ?? this.info.owner, token)\n this.basePath = `/2.0/repositories/${this.info.owner}/${this.info.slug}/downloads`\n }\n\n protected doUpload(\n fileName: string,\n _arch: Arch,\n _dataLength: number,\n _requestProcessor: (request: ClientRequest, reject: (error: Error) => void) => void,\n file: string\n ): Promise<any> {\n return HttpExecutor.retryOnServerError(async () => {\n const fileContent = await readFile(file)\n const form = new FormData()\n form.append(\"files\", fileContent, fileName)\n const upload: RequestOptions = {\n hostname: this.hostname,\n path: this.basePath,\n headers: form.getHeaders(),\n timeout: this.info.timeout || undefined,\n }\n await httpExecutor.doApiRequest(configureRequestOptions(upload, this.auth, \"POST\"), this.context.cancellationToken, it => form.pipe(it))\n return fileName\n })\n }\n\n async deleteRelease(filename: string): Promise<void> {\n const req: RequestOptions = {\n hostname: this.hostname,\n path: `${this.basePath}/${filename}`,\n timeout: this.info.timeout || undefined,\n }\n await httpExecutor.request(configureRequestOptions(req, this.auth, \"DELETE\"), this.context.cancellationToken)\n }\n\n toString() {\n const { owner, slug, channel } = this.info\n return `Bitbucket (owner: ${owner}, slug: ${slug}, channel: ${channel})`\n }\n\n static convertAppPassword(username: string, token: string) {\n const base64encodedData = Buffer.from(`${username}:${token.trim()}`).toString(\"base64\")\n return `Basic ${base64encodedData}`\n }\n}\n"]}
@@ -1,101 +0,0 @@
1
- import { Arch } from "builder-util";
2
- import { ClientRequest } from "http";
3
- import { HttpPublisher, PublishContext } from "electron-publish";
4
- import { KeygenOptions } from "builder-util-runtime/out/publishOptions";
5
- export interface KeygenError {
6
- title: string;
7
- detail: string;
8
- code: string;
9
- }
10
- export interface KeygenRelease {
11
- id: string;
12
- type: "releases";
13
- attributes: {
14
- name: string | null;
15
- description: string | null;
16
- channel: "stable" | "rc" | "beta" | "alpha" | "dev";
17
- status: "DRAFT" | "PUBLISHED" | "YANKED";
18
- tag: string;
19
- version: string;
20
- semver: {
21
- major: number;
22
- minor: number;
23
- patch: number;
24
- prerelease: string | null;
25
- build: string | null;
26
- };
27
- metadata: {
28
- [s: string]: any;
29
- };
30
- created: string;
31
- updated: string;
32
- yanked: string | null;
33
- };
34
- relationships: {
35
- account: {
36
- data: {
37
- type: "accounts";
38
- id: string;
39
- };
40
- };
41
- product: {
42
- data: {
43
- type: "products";
44
- id: string;
45
- };
46
- };
47
- };
48
- }
49
- export interface KeygenArtifact {
50
- id: string;
51
- type: "artifacts";
52
- attributes: {
53
- filename: string;
54
- filetype: string | null;
55
- filesize: number | null;
56
- platform: string | null;
57
- arch: string | null;
58
- signature: string | null;
59
- checksum: string | null;
60
- status: "WAITING" | "UPLOADED" | "FAILED" | "YANKED";
61
- metadata: {
62
- [s: string]: any;
63
- };
64
- created: string;
65
- updated: string;
66
- };
67
- relationships: {
68
- account: {
69
- data: {
70
- type: "accounts";
71
- id: string;
72
- };
73
- };
74
- release: {
75
- data: {
76
- type: "releases";
77
- id: string;
78
- };
79
- };
80
- };
81
- links: {
82
- redirect: string;
83
- };
84
- }
85
- export declare class KeygenPublisher extends HttpPublisher {
86
- readonly providerName = "keygen";
87
- readonly hostname = "api.keygen.sh";
88
- private readonly info;
89
- private readonly auth;
90
- private readonly version;
91
- private readonly basePath;
92
- constructor(context: PublishContext, info: KeygenOptions, version: string);
93
- protected doUpload(fileName: string, _arch: Arch, dataLength: number, requestProcessor: (request: ClientRequest, reject: (error: Error) => void) => void, _file: string): Promise<string>;
94
- private uploadArtifact;
95
- private createArtifact;
96
- private getOrCreateRelease;
97
- private getRelease;
98
- private createRelease;
99
- deleteRelease(releaseId: string): Promise<void>;
100
- toString(): string;
101
- }
@@ -1,165 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KeygenPublisher = void 0;
4
- const builder_util_1 = require("builder-util");
5
- const builder_util_2 = require("builder-util");
6
- const electron_publish_1 = require("electron-publish");
7
- const builder_util_runtime_1 = require("builder-util-runtime");
8
- const filename_1 = require("../util/filename");
9
- class KeygenPublisher extends electron_publish_1.HttpPublisher {
10
- constructor(context, info, version) {
11
- super(context);
12
- this.providerName = "keygen";
13
- this.hostname = "api.keygen.sh";
14
- const token = process.env.KEYGEN_TOKEN;
15
- if ((0, builder_util_1.isEmptyOrSpaces)(token)) {
16
- throw new builder_util_1.InvalidConfigurationError(`Keygen token is not set using env "KEYGEN_TOKEN" (see https://www.electron.build/publish#KeygenOptions)`);
17
- }
18
- this.info = info;
19
- this.auth = `Bearer ${token.trim()}`;
20
- this.version = version;
21
- this.basePath = `/v1/accounts/${this.info.account}`;
22
- }
23
- doUpload(fileName, _arch, dataLength, requestProcessor, _file) {
24
- return builder_util_runtime_1.HttpExecutor.retryOnServerError(async () => {
25
- const { data, errors } = await this.getOrCreateRelease();
26
- if (errors) {
27
- throw new Error(`Keygen - Creating release returned errors: ${JSON.stringify(errors)}`);
28
- }
29
- await this.uploadArtifact(data.id, fileName, dataLength, requestProcessor);
30
- return data.id;
31
- });
32
- }
33
- async uploadArtifact(releaseId, fileName, dataLength, requestProcessor) {
34
- const { data, errors } = await this.createArtifact(releaseId, fileName, dataLength);
35
- if (errors) {
36
- throw new Error(`Keygen - Creating artifact returned errors: ${JSON.stringify(errors)}`);
37
- }
38
- // Follow the redirect and upload directly to S3-equivalent storage provider
39
- const url = new URL(data.links.redirect);
40
- const upload = {
41
- hostname: url.hostname,
42
- path: url.pathname + url.search,
43
- headers: {
44
- "Content-Length": dataLength,
45
- },
46
- timeout: this.info.timeout || undefined,
47
- };
48
- await builder_util_2.httpExecutor.doApiRequest((0, builder_util_runtime_1.configureRequestOptions)(upload, null, "PUT"), this.context.cancellationToken, requestProcessor);
49
- }
50
- async createArtifact(releaseId, fileName, dataLength) {
51
- const upload = {
52
- hostname: this.hostname,
53
- path: `${this.basePath}/artifacts`,
54
- headers: {
55
- "Content-Type": "application/vnd.api+json",
56
- Accept: "application/vnd.api+json",
57
- "Keygen-Version": "1.1",
58
- Prefer: "no-redirect",
59
- },
60
- timeout: this.info.timeout || undefined,
61
- };
62
- const data = {
63
- type: "artifacts",
64
- attributes: {
65
- filename: fileName,
66
- filetype: (0, filename_1.getCompleteExtname)(fileName),
67
- filesize: dataLength,
68
- platform: this.info.platform,
69
- },
70
- relationships: {
71
- release: {
72
- data: {
73
- type: "releases",
74
- id: releaseId,
75
- },
76
- },
77
- },
78
- };
79
- builder_util_1.log.debug({ data: JSON.stringify(data) }, "Keygen create artifact");
80
- return (0, builder_util_runtime_1.parseJson)(builder_util_2.httpExecutor.request((0, builder_util_runtime_1.configureRequestOptions)(upload, this.auth, "POST"), this.context.cancellationToken, { data }));
81
- }
82
- async getOrCreateRelease() {
83
- try {
84
- // First, we'll attempt to fetch the release.
85
- return await this.getRelease();
86
- }
87
- catch (e) {
88
- if (e.statusCode !== 404) {
89
- throw e;
90
- }
91
- try {
92
- // Next, if the release doesn't exist, we'll attempt to create it.
93
- return await this.createRelease();
94
- }
95
- catch (e) {
96
- if (e.statusCode !== 409 && e.statusCode !== 422) {
97
- throw e;
98
- }
99
- // Lastly, when a conflict occurs (in the case of parallel uploads),
100
- // we'll try to fetch it one last time.
101
- return this.getRelease();
102
- }
103
- }
104
- }
105
- async getRelease() {
106
- const req = {
107
- hostname: this.hostname,
108
- path: `${this.basePath}/releases/${this.version}?product=${this.info.product}`,
109
- headers: {
110
- Accept: "application/vnd.api+json",
111
- "Keygen-Version": "1.1",
112
- },
113
- timeout: this.info.timeout || undefined,
114
- };
115
- return (0, builder_util_runtime_1.parseJson)(builder_util_2.httpExecutor.request((0, builder_util_runtime_1.configureRequestOptions)(req, this.auth, "GET"), this.context.cancellationToken, null));
116
- }
117
- async createRelease() {
118
- const req = {
119
- hostname: this.hostname,
120
- path: `${this.basePath}/releases`,
121
- headers: {
122
- "Content-Type": "application/vnd.api+json",
123
- Accept: "application/vnd.api+json",
124
- "Keygen-Version": "1.1",
125
- },
126
- timeout: this.info.timeout || undefined,
127
- };
128
- const data = {
129
- type: "releases",
130
- attributes: {
131
- version: this.version,
132
- channel: this.info.channel || "stable",
133
- status: "PUBLISHED",
134
- },
135
- relationships: {
136
- product: {
137
- data: {
138
- type: "products",
139
- id: this.info.product,
140
- },
141
- },
142
- },
143
- };
144
- builder_util_1.log.debug({ data: JSON.stringify(data) }, "Keygen create release");
145
- return (0, builder_util_runtime_1.parseJson)(builder_util_2.httpExecutor.request((0, builder_util_runtime_1.configureRequestOptions)(req, this.auth, "POST"), this.context.cancellationToken, { data }));
146
- }
147
- async deleteRelease(releaseId) {
148
- const req = {
149
- hostname: this.hostname,
150
- path: `${this.basePath}/releases/${releaseId}`,
151
- headers: {
152
- Accept: "application/vnd.api+json",
153
- "Keygen-Version": "1.1",
154
- },
155
- timeout: this.info.timeout || undefined,
156
- };
157
- await builder_util_2.httpExecutor.request((0, builder_util_runtime_1.configureRequestOptions)(req, this.auth, "DELETE"), this.context.cancellationToken);
158
- }
159
- toString() {
160
- const { account, product, platform } = this.info;
161
- return `Keygen (account: ${account}, product: ${product}, platform: ${platform}, version: ${this.version})`;
162
- }
163
- }
164
- exports.KeygenPublisher = KeygenPublisher;
165
- //# sourceMappingURL=KeygenPublisher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"KeygenPublisher.js","sourceRoot":"","sources":["../../src/publish/KeygenPublisher.ts"],"names":[],"mappings":";;;AAAA,+CAAoF;AACpF,+CAA2C;AAE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F;aACF;SACF,CAAA;QAED,kBAAG,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,uBAAuB,CAAC,CAAA;QAElE,OAAO,IAAA,gCAAS,EAAC,2BAAY,CAAC,OAAO,CAAC,IAAA,8CAAuB,EAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IACnI,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,SAAiB;QACnC,MAAM,GAAG,GAAmB;YAC1B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,GAAG,IAAI,CAAC,QAAQ,aAAa,SAAS,EAAE;YAC9C,OAAO,EAAE;gBACP,MAAM,EAAE,0BAA0B;gBAClC,gBAAgB,EAAE,KAAK;aACxB;YACD,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,SAAS;SACxC,CAAA;QACD,MAAM,2BAAY,CAAC,OAAO,CAAC,IAAA,8CAAuB,EAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAC/G,CAAC;IAED,QAAQ;QACN,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,IAAI,CAAA;QAChD,OAAO,oBAAoB,OAAO,cAAc,OAAO,eAAe,QAAQ,cAAc,IAAI,CAAC,OAAO,GAAG,CAAA;IAC7G,CAAC;CACF;AAhMD,0CAgMC","sourcesContent":["import { Arch, InvalidConfigurationError, log, isEmptyOrSpaces } from \"builder-util\"\nimport { httpExecutor } from \"builder-util\"\nimport { ClientRequest, RequestOptions } from \"http\"\nimport { HttpPublisher, PublishContext } from \"electron-publish\"\nimport { KeygenOptions } from \"builder-util-runtime/out/publishOptions\"\nimport { configureRequestOptions, HttpExecutor, parseJson } from \"builder-util-runtime\"\nimport { getCompleteExtname } from \"../util/filename\"\n\ntype RecursivePartial<T> = {\n [P in keyof T]?: RecursivePartial<T[P]>\n}\n\nexport interface KeygenError {\n title: string\n detail: string\n code: string\n}\n\nexport interface KeygenRelease {\n id: string\n type: \"releases\"\n attributes: {\n name: string | null\n description: string | null\n channel: \"stable\" | \"rc\" | \"beta\" | \"alpha\" | \"dev\"\n status: \"DRAFT\" | \"PUBLISHED\" | \"YANKED\"\n tag: string\n version: string\n semver: {\n major: number\n minor: number\n patch: number\n prerelease: string | null\n build: string | null\n }\n metadata: { [s: string]: any }\n created: string\n updated: string\n yanked: string | null\n }\n relationships: {\n account: {\n data: { type: \"accounts\"; id: string }\n }\n product: {\n data: { type: \"products\"; id: string }\n }\n }\n}\n\nexport interface KeygenArtifact {\n id: string\n type: \"artifacts\"\n attributes: {\n filename: string\n filetype: string | null\n filesize: number | null\n platform: string | null\n arch: string | null\n signature: string | null\n checksum: string | null\n status: \"WAITING\" | \"UPLOADED\" | \"FAILED\" | \"YANKED\"\n metadata: { [s: string]: any }\n created: string\n updated: string\n }\n relationships: {\n account: {\n data: { type: \"accounts\"; id: string }\n }\n release: {\n data: { type: \"releases\"; id: string }\n }\n }\n links: {\n redirect: string\n }\n}\n\nexport class KeygenPublisher extends HttpPublisher {\n readonly providerName = \"keygen\"\n readonly hostname = \"api.keygen.sh\"\n\n private readonly info: KeygenOptions\n private readonly auth: string\n private readonly version: string\n private readonly basePath: string\n\n constructor(context: PublishContext, info: KeygenOptions, version: string) {\n super(context)\n\n const token = process.env.KEYGEN_TOKEN\n if (isEmptyOrSpaces(token)) {\n throw new InvalidConfigurationError(`Keygen token is not set using env \"KEYGEN_TOKEN\" (see https://www.electron.build/publish#KeygenOptions)`)\n }\n\n this.info = info\n this.auth = `Bearer ${token.trim()}`\n this.version = version\n this.basePath = `/v1/accounts/${this.info.account}`\n }\n\n protected doUpload(\n fileName: string,\n _arch: Arch,\n dataLength: number,\n requestProcessor: (request: ClientRequest, reject: (error: Error) => void) => void,\n _file: string\n ): Promise<string> {\n return HttpExecutor.retryOnServerError(async () => {\n const { data, errors } = await this.getOrCreateRelease()\n if (errors) {\n throw new Error(`Keygen - Creating release returned errors: ${JSON.stringify(errors)}`)\n }\n\n await this.uploadArtifact(data!.id, fileName, dataLength, requestProcessor)\n\n return data!.id\n })\n }\n\n private async uploadArtifact(\n releaseId: any,\n fileName: string,\n dataLength: number,\n requestProcessor: (request: ClientRequest, reject: (error: Error) => void) => void\n ): Promise<void> {\n const { data, errors } = await this.createArtifact(releaseId, fileName, dataLength)\n if (errors) {\n throw new Error(`Keygen - Creating artifact returned errors: ${JSON.stringify(errors)}`)\n }\n\n // Follow the redirect and upload directly to S3-equivalent storage provider\n const url = new URL(data!.links.redirect)\n const upload: RequestOptions = {\n hostname: url.hostname,\n path: url.pathname + url.search,\n headers: {\n \"Content-Length\": dataLength,\n },\n timeout: this.info.timeout || undefined,\n }\n\n await httpExecutor.doApiRequest(configureRequestOptions(upload, null, \"PUT\"), this.context.cancellationToken, requestProcessor)\n }\n\n private async createArtifact(releaseId: any, fileName: string, dataLength: number): Promise<{ data?: KeygenArtifact; errors?: KeygenError[] }> {\n const upload: RequestOptions = {\n hostname: this.hostname,\n path: `${this.basePath}/artifacts`,\n headers: {\n \"Content-Type\": \"application/vnd.api+json\",\n Accept: \"application/vnd.api+json\",\n \"Keygen-Version\": \"1.1\",\n Prefer: \"no-redirect\",\n },\n timeout: this.info.timeout || undefined,\n }\n\n const data: RecursivePartial<KeygenArtifact> = {\n type: \"artifacts\",\n attributes: {\n filename: fileName,\n filetype: getCompleteExtname(fileName),\n filesize: dataLength,\n platform: this.info.platform,\n },\n relationships: {\n release: {\n data: {\n type: \"releases\",\n id: releaseId,\n },\n },\n },\n }\n\n log.debug({ data: JSON.stringify(data) }, \"Keygen create artifact\")\n\n return parseJson(httpExecutor.request(configureRequestOptions(upload, this.auth, \"POST\"), this.context.cancellationToken, { data }))\n }\n\n private async getOrCreateRelease(): Promise<{ data?: KeygenRelease; errors?: KeygenError[] }> {\n try {\n // First, we'll attempt to fetch the release.\n return await this.getRelease()\n } catch (e: any) {\n if (e.statusCode !== 404) {\n throw e\n }\n\n try {\n // Next, if the release doesn't exist, we'll attempt to create it.\n return await this.createRelease()\n } catch (e: any) {\n if (e.statusCode !== 409 && e.statusCode !== 422) {\n throw e\n }\n\n // Lastly, when a conflict occurs (in the case of parallel uploads),\n // we'll try to fetch it one last time.\n return this.getRelease()\n }\n }\n }\n\n private async getRelease(): Promise<{ data?: KeygenRelease; errors?: KeygenError[] }> {\n const req: RequestOptions = {\n hostname: this.hostname,\n path: `${this.basePath}/releases/${this.version}?product=${this.info.product}`,\n headers: {\n Accept: \"application/vnd.api+json\",\n \"Keygen-Version\": \"1.1\",\n },\n timeout: this.info.timeout || undefined,\n }\n\n return parseJson(httpExecutor.request(configureRequestOptions(req, this.auth, \"GET\"), this.context.cancellationToken, null))\n }\n\n private async createRelease(): Promise<{ data?: KeygenRelease; errors?: KeygenError[] }> {\n const req: RequestOptions = {\n hostname: this.hostname,\n path: `${this.basePath}/releases`,\n headers: {\n \"Content-Type\": \"application/vnd.api+json\",\n Accept: \"application/vnd.api+json\",\n \"Keygen-Version\": \"1.1\",\n },\n timeout: this.info.timeout || undefined,\n }\n\n const data: RecursivePartial<KeygenRelease> = {\n type: \"releases\",\n attributes: {\n version: this.version,\n channel: this.info.channel || \"stable\",\n status: \"PUBLISHED\",\n },\n relationships: {\n product: {\n data: {\n type: \"products\",\n id: this.info.product,\n },\n },\n },\n }\n\n log.debug({ data: JSON.stringify(data) }, \"Keygen create release\")\n\n return parseJson(httpExecutor.request(configureRequestOptions(req, this.auth, \"POST\"), this.context.cancellationToken, { data }))\n }\n\n async deleteRelease(releaseId: string): Promise<void> {\n const req: RequestOptions = {\n hostname: this.hostname,\n path: `${this.basePath}/releases/${releaseId}`,\n headers: {\n Accept: \"application/vnd.api+json\",\n \"Keygen-Version\": \"1.1\",\n },\n timeout: this.info.timeout || undefined,\n }\n await httpExecutor.request(configureRequestOptions(req, this.auth, \"DELETE\"), this.context.cancellationToken)\n }\n\n toString() {\n const { account, product, platform } = this.info\n return `Keygen (account: ${account}, product: ${product}, platform: ${platform}, version: ${this.version})`\n }\n}\n"]}
@@ -1,9 +0,0 @@
1
- import { Publisher, UploadTask, PublishContext } from "electron-publish";
2
- import { SnapStoreOptions } from "builder-util-runtime/out/publishOptions";
3
- export declare class SnapStorePublisher extends Publisher {
4
- private options;
5
- readonly providerName = "snapStore";
6
- constructor(context: PublishContext, options: SnapStoreOptions);
7
- upload(task: UploadTask): Promise<any>;
8
- toString(): string;
9
- }
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SnapStorePublisher = void 0;
4
- const electron_publish_1 = require("electron-publish");
5
- const builder_util_1 = require("builder-util");
6
- const path = require("path");
7
- class SnapStorePublisher extends electron_publish_1.Publisher {
8
- constructor(context, options) {
9
- super(context);
10
- this.options = options;
11
- this.providerName = "snapStore";
12
- }
13
- upload(task) {
14
- this.createProgressBar(path.basename(task.file), -1);
15
- const args = ["publish-snap", "-f", task.file];
16
- let channels = this.options.channels;
17
- if (channels == null) {
18
- channels = ["edge"];
19
- }
20
- else {
21
- if (typeof channels === "string") {
22
- channels = channels.split(",");
23
- }
24
- }
25
- for (const channel of channels) {
26
- args.push("-c", channel);
27
- }
28
- return (0, builder_util_1.executeAppBuilder)(args);
29
- }
30
- toString() {
31
- return "Snap Store";
32
- }
33
- }
34
- exports.SnapStorePublisher = SnapStorePublisher;
35
- //# sourceMappingURL=SnapStorePublisher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SnapStorePublisher.js","sourceRoot":"","sources":["../../src/publish/SnapStorePublisher.ts"],"names":[],"mappings":";;;AAAA,uDAAwE;AACxE,+CAAgD;AAChD,6BAA4B;AAG5B,MAAa,kBAAmB,SAAQ,4BAAS;IAG/C,YACE,OAAuB,EACf,OAAyB;QAEjC,KAAK,CAAC,OAAO,CAAC,CAAA;QAFN,YAAO,GAAP,OAAO,CAAkB;QAJ1B,iBAAY,GAAG,WAAW,CAAA;IAOnC,CAAC;IAED,MAAM,CAAC,IAAgB;QACrB,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;QAEpD,MAAM,IAAI,GAAG,CAAC,cAAc,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;QAE9C,IAAI,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAA;QACpC,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;YACrB,QAAQ,GAAG,CAAC,MAAM,CAAC,CAAA;QACrB,CAAC;aAAM,CAAC;YACN,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;gBACjC,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAChC,CAAC;QACH,CAAC;QAED,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAC1B,CAAC;QAED,OAAO,IAAA,gCAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED,QAAQ;QACN,OAAO,YAAY,CAAA;IACrB,CAAC;CACF;AAlCD,gDAkCC","sourcesContent":["import { Publisher, UploadTask, PublishContext } from \"electron-publish\"\nimport { executeAppBuilder } from \"builder-util\"\nimport * as path from \"path\"\nimport { SnapStoreOptions } from \"builder-util-runtime/out/publishOptions\"\n\nexport class SnapStorePublisher extends Publisher {\n readonly providerName = \"snapStore\"\n\n constructor(\n context: PublishContext,\n private options: SnapStoreOptions\n ) {\n super(context)\n }\n\n upload(task: UploadTask): Promise<any> {\n this.createProgressBar(path.basename(task.file), -1)\n\n const args = [\"publish-snap\", \"-f\", task.file]\n\n let channels = this.options.channels\n if (channels == null) {\n channels = [\"edge\"]\n } else {\n if (typeof channels === \"string\") {\n channels = channels.split(\",\")\n }\n }\n\n for (const channel of channels) {\n args.push(\"-c\", channel)\n }\n\n return executeAppBuilder(args)\n }\n\n toString(): string {\n return \"Snap Store\"\n }\n}\n"]}
@@ -1,10 +0,0 @@
1
- import { BaseS3Options } from "builder-util-runtime";
2
- import { PublishContext, Publisher, UploadTask } from "electron-publish";
3
- export declare abstract class BaseS3Publisher extends Publisher {
4
- private options;
5
- protected constructor(context: PublishContext, options: BaseS3Options);
6
- protected abstract getBucketName(): string;
7
- protected configureS3Options(args: Array<string>): void;
8
- upload(task: UploadTask): Promise<any>;
9
- toString(): string;
10
- }
@@ -1,64 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseS3Publisher = void 0;
4
- const builder_util_1 = require("builder-util");
5
- const electron_publish_1 = require("electron-publish");
6
- const promises_1 = require("fs/promises");
7
- const path = require("path");
8
- class BaseS3Publisher extends electron_publish_1.Publisher {
9
- constructor(context, options) {
10
- super(context);
11
- this.options = options;
12
- }
13
- configureS3Options(args) {
14
- // if explicitly set to null, do not add
15
- if (this.options.acl !== null) {
16
- args.push("--acl", this.options.acl || "public-read");
17
- }
18
- }
19
- // http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/s3-example-creating-buckets.html
20
- async upload(task) {
21
- const fileName = path.basename(task.file);
22
- const cancellationToken = this.context.cancellationToken;
23
- const target = (this.options.path == null ? "" : `${this.options.path}/`) + fileName;
24
- const args = ["publish-s3", "--bucket", this.getBucketName(), "--key", target, "--file", task.file];
25
- this.configureS3Options(args);
26
- if (process.env.__TEST_S3_PUBLISHER__ != null) {
27
- const testFile = path.join(process.env.__TEST_S3_PUBLISHER__, target);
28
- await (0, promises_1.mkdir)(path.dirname(testFile), { recursive: true });
29
- await (0, promises_1.symlink)(task.file, testFile);
30
- return;
31
- }
32
- // https://github.com/aws/aws-sdk-go/issues/279
33
- this.createProgressBar(fileName, -1);
34
- // if (progressBar != null) {
35
- // const callback = new ProgressCallback(progressBar)
36
- // uploader.on("progress", () => {
37
- // if (!cancellationToken.cancelled) {
38
- // callback.update(uploader.loaded, uploader.contentLength)
39
- // }
40
- // })
41
- // }
42
- return await cancellationToken.createPromise((resolve, reject, onCancel) => {
43
- (0, builder_util_1.executeAppBuilder)(args, process => {
44
- onCancel(() => {
45
- process.kill("SIGINT");
46
- });
47
- })
48
- .then(() => {
49
- try {
50
- builder_util_1.log.debug({ provider: this.providerName, file: fileName, bucket: this.getBucketName() }, "uploaded");
51
- }
52
- finally {
53
- resolve(undefined);
54
- }
55
- })
56
- .catch(reject);
57
- });
58
- }
59
- toString() {
60
- return `${this.providerName} (bucket: ${this.getBucketName()})`;
61
- }
62
- }
63
- exports.BaseS3Publisher = BaseS3Publisher;
64
- //# sourceMappingURL=BaseS3Publisher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BaseS3Publisher.js","sourceRoot":"","sources":["../../../src/publish/s3/BaseS3Publisher.ts"],"names":[],"mappings":";;;AAAA,+CAAqD;AAErD,uDAAwE;AACxE,0CAA4C;AAC5C,6BAA4B;AAE5B,MAAsB,eAAgB,SAAQ,4BAAS;IACrD,YACE,OAAuB,EACf,OAAsB;QAE9B,KAAK,CAAC,OAAO,CAAC,CAAA;QAFN,YAAO,GAAP,OAAO,CAAe;IAGhC,CAAC;IAIS,kBAAkB,CAAC,IAAmB;QAC9C,wCAAwC;QACxC,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;YAC9B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,aAAa,CAAC,CAAA;QACvD,CAAC;IACH,CAAC;IAED,oGAAoG;IACpG,KAAK,CAAC,MAAM,CAAC,IAAgB;QAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,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AQ,CAAC,GAAG,EAAE;oBACZ,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;gBACxB,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC;iBACC,IAAI,CAAC,GAAG,EAAE;gBACT,IAAI,CAAC;oBACH,kBAAG,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,EAAE,UAAU,CAAC,CAAA;gBACtG,CAAC;wBAAS,CAAC;oBACT,OAAO,CAAC,SAAS,CAAC,CAAA;gBACpB,CAAC;YACH,CAAC,CAAC;iBACD,KAAK,CAAC,MAAM,CAAC,CAAA;QAClB,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ;QACN,OAAO,GAAG,IAAI,CAAC,YAAY,aAAa,IAAI,CAAC,aAAa,EAAE,GAAG,CAAA;IACjE,CAAC;CACF;AAjED,0CAiEC","sourcesContent":["import { log, executeAppBuilder } from \"builder-util\"\nimport { BaseS3Options } from \"builder-util-runtime\"\nimport { PublishContext, Publisher, UploadTask } from \"electron-publish\"\nimport { mkdir, symlink } from \"fs/promises\"\nimport * as path from \"path\"\n\nexport abstract class BaseS3Publisher extends Publisher {\n protected constructor(\n context: PublishContext,\n private options: BaseS3Options\n ) {\n super(context)\n }\n\n protected abstract getBucketName(): string\n\n protected configureS3Options(args: Array<string>) {\n // if explicitly set to null, do not add\n if (this.options.acl !== null) {\n args.push(\"--acl\", this.options.acl || \"public-read\")\n }\n }\n\n // http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/s3-example-creating-buckets.html\n async upload(task: UploadTask): Promise<any> {\n const fileName = path.basename(task.file)\n const cancellationToken = this.context.cancellationToken\n\n const target = (this.options.path == null ? \"\" : `${this.options.path}/`) + fileName\n\n const args = [\"publish-s3\", \"--bucket\", this.getBucketName(), \"--key\", target, \"--file\", task.file]\n this.configureS3Options(args)\n\n if (process.env.__TEST_S3_PUBLISHER__ != null) {\n const testFile = path.join(process.env.__TEST_S3_PUBLISHER__, target)\n await mkdir(path.dirname(testFile), { recursive: true })\n await symlink(task.file, testFile)\n return\n }\n\n // https://github.com/aws/aws-sdk-go/issues/279\n this.createProgressBar(fileName, -1)\n // if (progressBar != null) {\n // const callback = new ProgressCallback(progressBar)\n // uploader.on(\"progress\", () => {\n // if (!cancellationToken.cancelled) {\n // callback.update(uploader.loaded, uploader.contentLength)\n // }\n // })\n // }\n\n return await cancellationToken.createPromise((resolve, reject, onCancel) => {\n executeAppBuilder(args, process => {\n onCancel(() => {\n process.kill(\"SIGINT\")\n })\n })\n .then(() => {\n try {\n log.debug({ provider: this.providerName, file: fileName, bucket: this.getBucketName() }, \"uploaded\")\n } finally {\n resolve(undefined)\n }\n })\n .catch(reject)\n })\n }\n\n toString() {\n return `${this.providerName} (bucket: ${this.getBucketName()})`\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- import { S3Options } from "builder-util-runtime";
2
- import { PublishContext } from "electron-publish";
3
- import { BaseS3Publisher } from "./BaseS3Publisher";
4
- export default class S3Publisher extends BaseS3Publisher {
5
- private readonly info;
6
- readonly providerName = "s3";
7
- constructor(context: PublishContext, info: S3Options);
8
- static checkAndResolveOptions(options: S3Options, channelFromAppVersion: string | null, errorIfCannot: boolean): Promise<void>;
9
- protected getBucketName(): string;
10
- protected configureS3Options(args: Array<string>): void;
11
- toString(): string;
12
- }