@electron-forge/publisher-electron-release-server 6.0.0-beta.9 → 6.0.1

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.
@@ -1,271 +0,0 @@
1
- <!doctype html>
2
- <html class="default no-js">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
- <title>PublisherERSConfig | @electron-forge/publisher-electron-release-server</title>
7
- <meta name="description" content="">
8
- <meta name="viewport" content="width=device-width, initial-scale=1">
9
- <link rel="stylesheet" href="../assets/css/main.css">
10
- </head>
11
- <body>
12
- <header>
13
- <div class="tsd-page-toolbar">
14
- <div class="container">
15
- <div class="table-wrap">
16
- <div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" data-base="..">
17
- <div class="field">
18
- <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
19
- <input id="tsd-search-field" type="text" />
20
- </div>
21
- <ul class="results">
22
- <li class="state loading">Preparing search index...</li>
23
- <li class="state failure">The search index is not available</li>
24
- </ul>
25
- <a href="../index.html" class="title">@electron-forge/publisher-electron-release-server</a>
26
- </div>
27
- <div class="table-cell" id="tsd-widgets">
28
- <div id="tsd-filter">
29
- <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
30
- <div class="tsd-filter-group">
31
- <div class="tsd-select" id="tsd-filter-visibility">
32
- <span class="tsd-select-label">All</span>
33
- <ul class="tsd-select-list">
34
- <li data-value="public">Public</li>
35
- <li data-value="protected">Public/Protected</li>
36
- <li data-value="private" class="selected">All</li>
37
- </ul>
38
- </div>
39
- <input type="checkbox" id="tsd-filter-inherited" checked />
40
- <label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
41
- <input type="checkbox" id="tsd-filter-only-exported" />
42
- <label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label>
43
- </div>
44
- </div>
45
- <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
46
- </div>
47
- </div>
48
- </div>
49
- </div>
50
- <div class="tsd-page-title">
51
- <div class="container">
52
- <ul class="tsd-breadcrumb">
53
- <li>
54
- <a href="../globals.html">Globals</a>
55
- </li>
56
- <li>
57
- <a href="publisherersconfig.html">PublisherERSConfig</a>
58
- </li>
59
- </ul>
60
- <h1>Interface PublisherERSConfig</h1>
61
- </div>
62
- </div>
63
- </header>
64
- <div class="container container-main">
65
- <div class="row">
66
- <div class="col-8 col-content">
67
- <section class="tsd-panel tsd-hierarchy">
68
- <h3>Hierarchy</h3>
69
- <ul class="tsd-hierarchy">
70
- <li>
71
- <span class="target">PublisherERSConfig</span>
72
- </li>
73
- </ul>
74
- </section>
75
- <section class="tsd-panel-group tsd-index-group">
76
- <h2>Index</h2>
77
- <section class="tsd-panel tsd-index-panel">
78
- <div class="tsd-index-content">
79
- <section class="tsd-index-section ">
80
- <h3>Properties</h3>
81
- <ul class="tsd-index-list">
82
- <li class="tsd-kind-property tsd-parent-kind-interface"><a href="publisherersconfig.html#baseurl" class="tsd-kind-icon">base<wbr>Url</a></li>
83
- <li class="tsd-kind-property tsd-parent-kind-interface"><a href="publisherersconfig.html#channel" class="tsd-kind-icon">channel</a></li>
84
- <li class="tsd-kind-property tsd-parent-kind-interface"><a href="publisherersconfig.html#password" class="tsd-kind-icon">password</a></li>
85
- <li class="tsd-kind-property tsd-parent-kind-interface"><a href="publisherersconfig.html#username" class="tsd-kind-icon">username</a></li>
86
- </ul>
87
- </section>
88
- </div>
89
- </section>
90
- </section>
91
- <section class="tsd-panel-group tsd-member-group ">
92
- <h2>Properties</h2>
93
- <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
94
- <a name="baseurl" class="tsd-anchor"></a>
95
- <h3>base<wbr>Url</h3>
96
- <div class="tsd-signature tsd-kind-icon">base<wbr>Url<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
97
- <aside class="tsd-sources">
98
- <ul>
99
- <li>Defined in <a href="https://github.com/electron-userland/electron-forge/blob/ab64142/packages/publisher/electron-release-server/src/Config.ts#L7">Config.ts:7</a></li>
100
- </ul>
101
- </aside>
102
- <div class="tsd-comment tsd-typography">
103
- <div class="lead">
104
- <p>The base URL of your instance of ERS.</p>
105
- </div>
106
- <p>E.g. <a href="https://my-update.server.com">https://my-update.server.com</a></p>
107
- </div>
108
- </section>
109
- <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
110
- <a name="channel" class="tsd-anchor"></a>
111
- <h3><span class="tsd-flag ts-flagOptional">Optional</span> channel</h3>
112
- <div class="tsd-signature tsd-kind-icon">channel<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div>
113
- <aside class="tsd-sources">
114
- <ul>
115
- <li>Defined in <a href="https://github.com/electron-userland/electron-forge/blob/ab64142/packages/publisher/electron-release-server/src/Config.ts#L25">Config.ts:25</a></li>
116
- </ul>
117
- </aside>
118
- <div class="tsd-comment tsd-typography">
119
- <div class="lead">
120
- <p>The release channel you want to send artifacts to, normally something like
121
- &quot;stable&quot;, &quot;beta&quot; or &quot;alpha&quot;.</p>
122
- </div>
123
- <p>If left unspecified we will try to infer the channel from your version
124
- field in your package.json.</p>
125
- <p>Default: stable</p>
126
- </div>
127
- </section>
128
- <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
129
- <a name="password" class="tsd-anchor"></a>
130
- <h3>password</h3>
131
- <div class="tsd-signature tsd-kind-icon">password<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
132
- <aside class="tsd-sources">
133
- <ul>
134
- <li>Defined in <a href="https://github.com/electron-userland/electron-forge/blob/ab64142/packages/publisher/electron-release-server/src/Config.ts#L15">Config.ts:15</a></li>
135
- </ul>
136
- </aside>
137
- <div class="tsd-comment tsd-typography">
138
- <div class="lead">
139
- <p>The password you use to sign in to ERS</p>
140
- </div>
141
- </div>
142
- </section>
143
- <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
144
- <a name="username" class="tsd-anchor"></a>
145
- <h3>username</h3>
146
- <div class="tsd-signature tsd-kind-icon">username<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
147
- <aside class="tsd-sources">
148
- <ul>
149
- <li>Defined in <a href="https://github.com/electron-userland/electron-forge/blob/ab64142/packages/publisher/electron-release-server/src/Config.ts#L11">Config.ts:11</a></li>
150
- </ul>
151
- </aside>
152
- <div class="tsd-comment tsd-typography">
153
- <div class="lead">
154
- <p>The username you use to sign in to ERS</p>
155
- </div>
156
- </div>
157
- </section>
158
- </section>
159
- </div>
160
- <div class="col-4 col-menu menu-sticky-wrap menu-highlight">
161
- <nav class="tsd-navigation primary">
162
- <ul>
163
- <li class="globals ">
164
- <a href="../globals.html"><em>Globals</em></a>
165
- </li>
166
- </ul>
167
- </nav>
168
- <nav class="tsd-navigation secondary menu-sticky">
169
- <ul class="before-current">
170
- <li class=" tsd-kind-class">
171
- <a href="../classes/publisherers.html" class="tsd-kind-icon">PublisherERS</a>
172
- </li>
173
- <li class=" tsd-kind-interface tsd-is-not-exported">
174
- <a href="ersversion.html" class="tsd-kind-icon">ERSVersion</a>
175
- </li>
176
- </ul>
177
- <ul class="current">
178
- <li class="current tsd-kind-interface">
179
- <a href="publisherersconfig.html" class="tsd-kind-icon">PublisherERSConfig</a>
180
- <ul>
181
- <li class=" tsd-kind-property tsd-parent-kind-interface">
182
- <a href="publisherersconfig.html#baseurl" class="tsd-kind-icon">base<wbr>Url</a>
183
- </li>
184
- <li class=" tsd-kind-property tsd-parent-kind-interface">
185
- <a href="publisherersconfig.html#channel" class="tsd-kind-icon">channel</a>
186
- </li>
187
- <li class=" tsd-kind-property tsd-parent-kind-interface">
188
- <a href="publisherersconfig.html#password" class="tsd-kind-icon">password</a>
189
- </li>
190
- <li class=" tsd-kind-property tsd-parent-kind-interface">
191
- <a href="publisherersconfig.html#username" class="tsd-kind-icon">username</a>
192
- </li>
193
- </ul>
194
- </li>
195
- </ul>
196
- <ul class="after-current">
197
- <li class=" tsd-kind-variable tsd-is-not-exported">
198
- <a href="../globals.html#d" class="tsd-kind-icon">d</a>
199
- </li>
200
- <li class=" tsd-kind-function">
201
- <a href="../globals.html#ersplatform" class="tsd-kind-icon">ers<wbr>Platform</a>
202
- </li>
203
- </ul>
204
- </nav>
205
- </div>
206
- </div>
207
- </div>
208
- <footer>
209
- <div class="container">
210
- <h2>Legend</h2>
211
- <div class="tsd-legend-group">
212
- <ul class="tsd-legend">
213
- <li class="tsd-kind-module"><span class="tsd-kind-icon">Module</span></li>
214
- <li class="tsd-kind-object-literal"><span class="tsd-kind-icon">Object literal</span></li>
215
- <li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
216
- <li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
217
- <li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li>
218
- <li class="tsd-kind-index-signature"><span class="tsd-kind-icon">Index signature</span></li>
219
- <li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
220
- </ul>
221
- <ul class="tsd-legend">
222
- <li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
223
- <li class="tsd-kind-enum-member"><span class="tsd-kind-icon">Enumeration member</span></li>
224
- <li class="tsd-kind-property tsd-parent-kind-enum"><span class="tsd-kind-icon">Property</span></li>
225
- <li class="tsd-kind-method tsd-parent-kind-enum"><span class="tsd-kind-icon">Method</span></li>
226
- </ul>
227
- <ul class="tsd-legend">
228
- <li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
229
- <li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li>
230
- <li class="tsd-kind-constructor tsd-parent-kind-interface"><span class="tsd-kind-icon">Constructor</span></li>
231
- <li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
232
- <li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
233
- <li class="tsd-kind-index-signature tsd-parent-kind-interface"><span class="tsd-kind-icon">Index signature</span></li>
234
- </ul>
235
- <ul class="tsd-legend">
236
- <li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
237
- <li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li>
238
- <li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
239
- <li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
240
- <li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
241
- <li class="tsd-kind-accessor tsd-parent-kind-class"><span class="tsd-kind-icon">Accessor</span></li>
242
- <li class="tsd-kind-index-signature tsd-parent-kind-class"><span class="tsd-kind-icon">Index signature</span></li>
243
- </ul>
244
- <ul class="tsd-legend">
245
- <li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li>
246
- <li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
247
- <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
248
- <li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited accessor</span></li>
249
- </ul>
250
- <ul class="tsd-legend">
251
- <li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li>
252
- <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li>
253
- <li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected accessor</span></li>
254
- </ul>
255
- <ul class="tsd-legend">
256
- <li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li>
257
- <li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li>
258
- <li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private accessor</span></li>
259
- </ul>
260
- <ul class="tsd-legend">
261
- <li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li>
262
- <li class="tsd-kind-call-signature tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
263
- </ul>
264
- </div>
265
- </div>
266
- </footer>
267
- <div class="overlay"></div>
268
- <script src="../assets/js/main.js"></script>
269
- <script>if (location.protocol == 'file:') document.write('<script src="../assets/js/search.js"><' + '/script>');</script>
270
- </body>
271
- </html>
package/src/Config.ts DELETED
@@ -1,26 +0,0 @@
1
- export interface PublisherERSConfig {
2
- /**
3
- * The base URL of your instance of ERS.
4
- *
5
- * E.g. https://my-update.server.com
6
- */
7
- baseUrl: string;
8
- /**
9
- * The username you use to sign in to ERS
10
- */
11
- username: string;
12
- /**
13
- * The password you use to sign in to ERS
14
- */
15
- password: string;
16
- /**
17
- * The release channel you want to send artifacts to, normally something like
18
- * "stable", "beta" or "alpha".
19
- *
20
- * If left unspecified we will try to infer the channel from your version
21
- * field in your package.json.
22
- *
23
- * Default: stable
24
- */
25
- channel?: string;
26
- }
@@ -1,141 +0,0 @@
1
- import PublisherBase, { PublisherOptions } from '@electron-forge/publisher-base';
2
- import { asyncOra } from '@electron-forge/async-ora';
3
- import { ForgePlatform, ForgeArch } from '@electron-forge/shared-types';
4
-
5
- import debug from 'debug';
6
- import fetch from 'node-fetch';
7
- import FormData from 'form-data';
8
- import fs from 'fs-extra';
9
- import path from 'path';
10
-
11
- import { PublisherERSConfig } from './Config';
12
-
13
- const d = debug('electron-forge:publish:ers');
14
-
15
- interface ERSVersion {
16
- name: string;
17
- assets: { name: string; }[];
18
- }
19
-
20
- export const ersPlatform = (platform: ForgePlatform, arch: ForgeArch) => {
21
- switch (platform) {
22
- case 'darwin':
23
- return 'osx_64';
24
- case 'linux':
25
- return arch === 'ia32' ? 'linux_32' : 'linux_64';
26
- case 'win32':
27
- return arch === 'ia32' ? 'windows_32' : 'windows_64';
28
- default:
29
- return platform;
30
- }
31
- };
32
-
33
- export default class PublisherERS extends PublisherBase<PublisherERSConfig> {
34
- name = 'electron-release-server';
35
-
36
- async publish({ makeResults }: PublisherOptions) {
37
- const { config } = this;
38
-
39
- if (!(config.baseUrl && config.username && config.password)) {
40
- throw 'In order to publish to ERS you must set the "electronReleaseServer.baseUrl", "electronReleaseServer.username" and "electronReleaseServer.password" properties in your forge config. See the docs for more info'; // eslint-disable-line
41
- }
42
-
43
- d('attempting to authenticate to ERS');
44
-
45
- const api = (apiPath: string) => `${config.baseUrl}/${apiPath}`;
46
-
47
- const { token } = await (await fetch(api('api/auth/login'), {
48
- method: 'POST',
49
- body: JSON.stringify({
50
- username: config.username,
51
- password: config.password,
52
- }),
53
- headers: {
54
- 'Content-Type': 'application/json',
55
- },
56
- })).json();
57
-
58
- const authFetch = (apiPath: string, options?: any) =>
59
- fetch(api(apiPath), Object.assign({}, options || {}, {
60
- headers: Object.assign({}, (options || {}).headers, { Authorization: `Bearer ${token}` }),
61
- }));
62
-
63
- const versions: ERSVersion[] = await (await authFetch('api/version')).json();
64
-
65
- for (const makeResult of makeResults) {
66
- const { artifacts, packageJSON } = makeResult;
67
-
68
- const existingVersion = versions.find(version => version.name === packageJSON.version);
69
-
70
- let channel = 'stable';
71
- if (config.channel) {
72
- channel = config.channel;
73
- } else if (packageJSON.version.includes('beta')) {
74
- channel = 'beta';
75
- } else if (packageJSON.version.includes('alpha')) {
76
- channel = 'alpha';
77
- }
78
-
79
- if (!existingVersion) {
80
- await authFetch('api/version', {
81
- method: 'POST',
82
- body: JSON.stringify({
83
- channel: {
84
- name: channel,
85
- },
86
- name: packageJSON.version,
87
- notes: '',
88
- }),
89
- headers: {
90
- 'Content-Type': 'application/json',
91
- },
92
- });
93
- }
94
-
95
- let uploaded = 0;
96
- const getText = () => `Uploading Artifacts ${uploaded}/${artifacts.length}`;
97
-
98
- await asyncOra(getText(), async (uploadSpinner) => {
99
- const updateSpinner = () => {
100
- uploadSpinner.text = getText();
101
- };
102
-
103
- await Promise.all(artifacts.map(artifactPath =>
104
- new Promise(async (resolve, reject) => {
105
- if (existingVersion) {
106
- const existingAsset = existingVersion.assets.find(
107
- asset => asset.name === path.basename(artifactPath),
108
- );
109
-
110
- if (existingAsset) {
111
- d('asset at path:', artifactPath, 'already exists on server');
112
- uploaded += 1;
113
- updateSpinner();
114
- return;
115
- }
116
- }
117
- try {
118
- d('attempting to upload asset:', artifactPath);
119
- const artifactForm = new FormData();
120
- artifactForm.append('token', token);
121
- artifactForm.append('version', packageJSON.version);
122
- artifactForm.append('platform', ersPlatform(makeResult.platform, makeResult.arch));
123
- artifactForm.append('file', fs.createReadStream(artifactPath));
124
- await authFetch('api/asset', {
125
- method: 'POST',
126
- body: artifactForm,
127
- headers: artifactForm.getHeaders(),
128
- });
129
- d('upload successful for asset:', artifactPath);
130
- uploaded += 1;
131
- updateSpinner();
132
- resolve();
133
- } catch (err) {
134
- reject(err);
135
- }
136
- }),
137
- ));
138
- });
139
- }
140
- }
141
- }
package/tslint.json DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "extends": "tslint-config-airbnb",
3
- "rules": {
4
- "no-boolean-literal-compare": false,
5
- "import-name": false,
6
- "align": false,
7
- "variable-name": [true, "ban-keywords", "check-format", "allow-pascal-case"],
8
- "no-this-assignment": [true, { "allow-destructuring": true }],
9
- "max-line-length": false,
10
- "no-parameter-reassignment": false
11
- }
12
- }