Skip to content

Commit 7fe2fdd

Browse files
authored
build: use @electron/fiddle-core to fetch releases (#1344)
1 parent 9e0a6d9 commit 7fe2fdd

File tree

3 files changed

+11
-21
lines changed

3 files changed

+11
-21
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"@blueprintjs/core": "^3.36.0",
4040
"@blueprintjs/popover2": "^0.12.2",
4141
"@blueprintjs/select": "^3.15.0",
42-
"@electron/fiddle-core": "^1.2.2",
42+
"@electron/fiddle-core": "^1.3.0",
4343
"@octokit/rest": "^16.43.1",
4444
"@sentry/electron": "^4.4.0",
4545
"algoliasearch": "^4.12.0",

tools/fetch-releases.js

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,20 @@
11
const path = require('path');
22

3-
const fetch = require('cross-fetch');
3+
const { ElectronVersions } = require('@electron/fiddle-core');
44
const fs = require('fs-extra');
55

66
const file = path.join(__dirname, '..', 'static', 'releases.json');
77

8-
async function getReleases() {
9-
const url = 'https://releases.electronjs.org/releases.json';
10-
const response = await fetch(url, {
11-
headers: {
12-
'User-Agent': 'Electron Fiddle',
13-
},
14-
});
15-
return await response.json();
16-
}
17-
188
async function populateReleases() {
19-
const data = await getReleases();
20-
const releases = data.map(({ version, node }) => ({ version, node }));
9+
const elves = await ElectronVersions.create(undefined, { ignoreCache: true });
10+
const releases = elves.versions.map(({ version }) =>
11+
elves.getReleaseInfo(version),
12+
);
2113

2214
console.log(`Updating local releases.json with ${releases.length} versions.`);
2315

2416
await fs.remove(file);
25-
await fs.outputFile(file, JSON.stringify(releases));
26-
27-
console.log('Updating tests with new expected version count.');
17+
await fs.outputJSON(file, releases);
2818
}
2919

3020
module.exports = {

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -922,10 +922,10 @@
922922
optionalDependencies:
923923
"@types/glob" "^7.1.1"
924924

925-
"@electron/fiddle-core@^1.2.2":
926-
version "1.2.2"
927-
resolved "https://registry.yarnpkg.com/@electron/fiddle-core/-/fiddle-core-1.2.2.tgz#33a89618505c4918fd339f7f08ba8f1155551d84"
928-
integrity sha512-3YVgKCFQrJ5KHy9CYxtUSO97FVXDPcTFJhQcifDuSh2gTiGRHvXY1sVVp59kUGdwa2kl0sNMhRkJCmHDR88tfw==
925+
"@electron/fiddle-core@^1.3.0":
926+
version "1.3.0"
927+
resolved "https://registry.yarnpkg.com/@electron/fiddle-core/-/fiddle-core-1.3.0.tgz#8303629badc72c2a0d5029d13e0cb701fd06d6a1"
928+
integrity sha512-RlH4j0RtcRHMVQCaiC/xS8UmvmmgTqCJI8Iw+GIUTswzA7WrXRPCTX+izvb2NiBmpf0Ll/+GPuQ1VtV9v3P7pA==
929929
dependencies:
930930
"@electron/get" "^2.0.0"
931931
debug "^4.3.3"

0 commit comments

Comments
 (0)