@electron-forge/publisher-base 6.0.0 → 6.0.2

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/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ The MIT License (MIT)
2
+ Copyright (c) 2016 Samuel Attard
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ this software and associated documentation files (the "Software"), to deal in
6
+ the Software without restriction, including without limitation the rights to
7
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ the Software, and to permit persons to whom the Software is furnished to do so,
9
+ subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electron-forge/publisher-base",
3
- "version": "6.0.0",
3
+ "version": "6.0.2",
4
4
  "description": "Base publisher for Electron Forge",
5
5
  "repository": "https://github.com/electron/forge",
6
6
  "author": "Samuel Attard",
@@ -12,7 +12,7 @@
12
12
  "test:base": "cross-env TS_NODE_FILES=1 mocha --config ../../../.mocharc.js"
13
13
  },
14
14
  "dependencies": {
15
- "@electron-forge/shared-types": "6.0.0"
15
+ "@electron-forge/shared-types": "^6.0.2"
16
16
  },
17
17
  "devDependencies": {
18
18
  "chai": "^4.3.3",
@@ -20,5 +20,9 @@
20
20
  },
21
21
  "engines": {
22
22
  "node": ">= 14.17.5"
23
- }
23
+ },
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "gitHead": "11cf4b58359c9881c05c06e0d62be575a0ed70d1"
24
28
  }
@@ -0,0 +1,70 @@
1
+ import { ForgeListrTaskDefinition, ForgeMakeResult, ForgePlatform, IForgePublisher, ResolvedForgeConfig } from '@electron-forge/shared-types';
2
+
3
+ export interface PublisherOptions {
4
+ /**
5
+ * The base directory of the apps source code
6
+ */
7
+ dir: string;
8
+ /**
9
+ * The results from running the make command
10
+ */
11
+ makeResults: ForgeMakeResult[];
12
+ /**
13
+ * The raw forgeConfig this app is using.
14
+ *
15
+ * You probably shouldn't use this
16
+ */
17
+ forgeConfig: ResolvedForgeConfig;
18
+ /**
19
+ * A method that allows the publisher to provide status / progress updates
20
+ * to the user. This method currently maps to setting the "output" line
21
+ * in the publisher listr task.
22
+ */
23
+ setStatusLine: (statusLine: string) => void;
24
+ }
25
+
26
+ export default abstract class Publisher<C> implements IForgePublisher {
27
+ public abstract name: string;
28
+
29
+ public defaultPlatforms?: ForgePlatform[];
30
+
31
+ /** @internal */
32
+ __isElectronForgePublisher!: true;
33
+
34
+ /**
35
+ * @param config - A configuration object for this publisher
36
+ * @param platformsToPublishOn - If you want this maker to run on platforms different from `defaultPlatforms` you can provide those platforms here
37
+ */
38
+ constructor(public config: C, protected platformsToPublishOn?: ForgePlatform[]) {
39
+ this.config = config;
40
+ Object.defineProperty(this, '__isElectronForgePublisher', {
41
+ value: true,
42
+ enumerable: false,
43
+ configurable: false,
44
+ });
45
+ }
46
+
47
+ get platforms(): ForgePlatform[] {
48
+ if (this.platformsToPublishOn) return this.platformsToPublishOn;
49
+ if (this.defaultPlatforms) return this.defaultPlatforms;
50
+ return ['win32', 'linux', 'darwin', 'mas'];
51
+ }
52
+
53
+ /**
54
+ * Publishers must implement this method to publish the artifacts returned from
55
+ * make calls. If any errors occur you must throw them, failing silently or simply
56
+ * logging will not propagate issues up to forge.
57
+ *
58
+ * Please note for a given version publish will be called multiple times, once
59
+ * for each set of "platform" and "arch". This means if you are publishing
60
+ * darwin and win32 artifacts to somewhere like GitHub on the first publish call
61
+ * you will have to create the version on GitHub and the second call will just
62
+ * be appending files to the existing version.
63
+ */
64
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
65
+ async publish(opts: PublisherOptions): Promise<ForgeListrTaskDefinition[] | void> {
66
+ throw new Error(`Publisher ${this.name} did not implement the publish method`);
67
+ }
68
+ }
69
+
70
+ export { Publisher as PublisherBase };
@@ -0,0 +1,35 @@
1
+ import { expect } from 'chai';
2
+
3
+ import Publisher, { PublisherOptions } from '../src/Publisher';
4
+
5
+ class PublisherImpl extends Publisher<null> {
6
+ defaultPlatforms = [];
7
+
8
+ name = 'test';
9
+ }
10
+
11
+ describe('Publisher', () => {
12
+ it('should define __isElectronForgePublisher', () => {
13
+ const publisher = new PublisherImpl(null);
14
+ expect(publisher).to.have.property('__isElectronForgePublisher', true);
15
+ });
16
+
17
+ it('__isElectronForgePublisher should not be settable', () => {
18
+ const publisher = new PublisherImpl(null);
19
+ expect(() => {
20
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
+ (publisher as any).__isElectronForgePublisher = false;
22
+ }).to.throw();
23
+ expect(() => {
24
+ Object.defineProperty(publisher, '__isElectronForgePublisher', {
25
+ value: false,
26
+ });
27
+ }).to.throw();
28
+ expect(publisher).to.have.property('__isElectronForgePublisher', true);
29
+ });
30
+
31
+ it('should throw an error when publish is called is called', async () => {
32
+ const publisher = new PublisherImpl(null);
33
+ await expect(publisher.publish({} as PublisherOptions)).to.eventually.be.rejected;
34
+ });
35
+ });
@@ -1,45 +0,0 @@
1
- import { ForgeMakeResult, ForgePlatform, IForgePublisher, ResolvedForgeConfig } from '@electron-forge/shared-types';
2
- export interface PublisherOptions {
3
- /**
4
- * The base directory of the apps source code
5
- */
6
- dir: string;
7
- /**
8
- * The results from running the make command
9
- */
10
- makeResults: ForgeMakeResult[];
11
- /**
12
- * The raw forgeConfig this app is using.
13
- *
14
- * You probably shouldn't use this
15
- */
16
- forgeConfig: ResolvedForgeConfig;
17
- }
18
- export default abstract class Publisher<C> implements IForgePublisher {
19
- config: C;
20
- protected platformsToPublishOn?: string[] | undefined;
21
- abstract name: string;
22
- defaultPlatforms?: ForgePlatform[];
23
- /** @internal */
24
- __isElectronForgePublisher: true;
25
- /**
26
- * @param config - A configuration object for this publisher
27
- * @param platformsToPublishOn - If you want this maker to run on platforms different from `defaultPlatforms` you can provide those platforms here
28
- */
29
- constructor(config: C, platformsToPublishOn?: string[] | undefined);
30
- get platforms(): ForgePlatform[];
31
- /**
32
- * Publishers must implement this method to publish the artifacts returned from
33
- * make calls. If any errors occur you must throw them, failing silently or simply
34
- * logging will not propagate issues up to forge.
35
- *
36
- * Please note for a given version publish will be called multiple times, once
37
- * for each set of "platform" and "arch". This means if you are publishing
38
- * darwin and win32 artifacts to somewhere like GitHub on the first publish call
39
- * you will have to create the version on GitHub and the second call will just
40
- * be appending files to the existing version.
41
- */
42
- publish(opts: PublisherOptions): Promise<void>;
43
- }
44
- export { Publisher as PublisherBase };
45
- //# sourceMappingURL=Publisher.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Publisher.d.ts","sourceRoot":"","sources":["../src/Publisher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEpH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B;;;;OAIG;IACH,WAAW,EAAE,mBAAmB,CAAC;CAClC;AAED,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,SAAS,CAAC,CAAC,CAAE,YAAW,eAAe;IAYhD,MAAM,EAAE,CAAC;IAAE,SAAS,CAAC,oBAAoB,CAAC;IAX7D,SAAgB,IAAI,EAAE,MAAM,CAAC;IAEtB,gBAAgB,CAAC,EAAE,aAAa,EAAE,CAAC;IAE1C,gBAAgB;IAChB,0BAA0B,EAAG,IAAI,CAAC;IAElC;;;OAGG;gBACgB,MAAM,EAAE,CAAC,EAAY,oBAAoB,CAAC,sBAAiB;IAS9E,IAAI,SAAS,IAAI,aAAa,EAAE,CAI/B;IAED;;;;;;;;;;OAUG;IAEG,OAAO,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAGrD;AAED,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,CAAC"}
package/dist/Publisher.js DELETED
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- exports.PublisherBase = exports.default = void 0;
6
- class Publisher {
7
- /**
8
- * @param config - A configuration object for this publisher
9
- * @param platformsToPublishOn - If you want this maker to run on platforms different from `defaultPlatforms` you can provide those platforms here
10
- */ constructor(config, platformsToPublishOn){
11
- this.config = config;
12
- this.platformsToPublishOn = platformsToPublishOn;
13
- this.config = config;
14
- Object.defineProperty(this, '__isElectronForgePublisher', {
15
- value: true,
16
- enumerable: false,
17
- configurable: false
18
- });
19
- }
20
- get platforms() {
21
- if (this.platformsToPublishOn) return this.platformsToPublishOn;
22
- if (this.defaultPlatforms) return this.defaultPlatforms;
23
- return [
24
- 'win32',
25
- 'linux',
26
- 'darwin',
27
- 'mas'
28
- ];
29
- }
30
- /**
31
- * Publishers must implement this method to publish the artifacts returned from
32
- * make calls. If any errors occur you must throw them, failing silently or simply
33
- * logging will not propagate issues up to forge.
34
- *
35
- * Please note for a given version publish will be called multiple times, once
36
- * for each set of "platform" and "arch". This means if you are publishing
37
- * darwin and win32 artifacts to somewhere like GitHub on the first publish call
38
- * you will have to create the version on GitHub and the second call will just
39
- * be appending files to the existing version.
40
- */ // eslint-disable-next-line @typescript-eslint/no-unused-vars
41
- async publish(opts) {
42
- throw new Error(`Publisher ${this.name} did not implement the publish method`);
43
- }
44
- }
45
- exports.default = Publisher;
46
- exports.PublisherBase = Publisher;
47
-
48
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9QdWJsaXNoZXIudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgRm9yZ2VNYWtlUmVzdWx0LCBGb3JnZVBsYXRmb3JtLCBJRm9yZ2VQdWJsaXNoZXIsIFJlc29sdmVkRm9yZ2VDb25maWcgfSBmcm9tICdAZWxlY3Ryb24tZm9yZ2Uvc2hhcmVkLXR5cGVzJztcblxuZXhwb3J0IGludGVyZmFjZSBQdWJsaXNoZXJPcHRpb25zIHtcbiAgLyoqXG4gICAqIFRoZSBiYXNlIGRpcmVjdG9yeSBvZiB0aGUgYXBwcyBzb3VyY2UgY29kZVxuICAgKi9cbiAgZGlyOiBzdHJpbmc7XG4gIC8qKlxuICAgKiBUaGUgcmVzdWx0cyBmcm9tIHJ1bm5pbmcgdGhlIG1ha2UgY29tbWFuZFxuICAgKi9cbiAgbWFrZVJlc3VsdHM6IEZvcmdlTWFrZVJlc3VsdFtdO1xuICAvKipcbiAgICogVGhlIHJhdyBmb3JnZUNvbmZpZyB0aGlzIGFwcCBpcyB1c2luZy5cbiAgICpcbiAgICogWW91IHByb2JhYmx5IHNob3VsZG4ndCB1c2UgdGhpc1xuICAgKi9cbiAgZm9yZ2VDb25maWc6IFJlc29sdmVkRm9yZ2VDb25maWc7XG59XG5cbmV4cG9ydCBkZWZhdWx0IGFic3RyYWN0IGNsYXNzIFB1Ymxpc2hlcjxDPiBpbXBsZW1lbnRzIElGb3JnZVB1Ymxpc2hlciB7XG4gIHB1YmxpYyBhYnN0cmFjdCBuYW1lOiBzdHJpbmc7XG5cbiAgcHVibGljIGRlZmF1bHRQbGF0Zm9ybXM/OiBGb3JnZVBsYXRmb3JtW107XG5cbiAgLyoqIEBp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