Skip to content

Commit

Permalink
build: move Electron releases fetch to Forge generateAssets hook (#1316)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsanders11 committed Apr 18, 2023
1 parent 6d2532e commit b11e77b
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 48 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ commands:
- run: npm install --global yarn
- run: yarn install --frozen-lockfile
- run: yarn run contributors
- run: yarn run electron-releases
- save_cache:
paths:
- node_modules
Expand Down
42 changes: 0 additions & 42 deletions .github/workflows/electron-releases.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ report.json
# Electron Fiddle-Specific
/static/contributors.json
/static/css/root.css
/static/releases.json

# Webpack configurations
.webpack
.webpack
3 changes: 2 additions & 1 deletion forge.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const path = require('path');

const packageJson = require('./package.json');
const { maybeFetchContributors } = require('./tools/contributors');
const { populateReleases } = require('./tools/fetch-releases');

const { version } = packageJson;
const iconDir = path.resolve(__dirname, 'assets', 'icons');
Expand All @@ -27,7 +28,7 @@ const commonLinuxConfig = {
const config = {
hooks: {
generateAssets: async () => {
await maybeFetchContributors(true);
await Promise.all([populateReleases(), maybeFetchContributors(true)]);
},
},
plugins: [
Expand Down
1 change: 0 additions & 1 deletion static/releases.json

This file was deleted.

3 changes: 2 additions & 1 deletion tests/globalSetup.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const { maybeFetchContributors } = require('../tools/contributors');
const { populateReleases } = require('../tools/fetch-releases');

async function globalSetup() {
await maybeFetchContributors(true);
await Promise.all([maybeFetchContributors(true), populateReleases()]);
}

module.exports = globalSetup;
12 changes: 10 additions & 2 deletions tools/fetch-releases.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async function getReleases() {
return await response.json();
}

async function main() {
async function populateReleases() {
const data = await getReleases();
const releases = data.map(({ version, node }) => ({ version, node }));

Expand All @@ -27,4 +27,12 @@ async function main() {
console.log('Updating tests with new expected version count.');
}

main();
module.exports = {
populateReleases,
};

if (require.main === module) {
(async () => {
await populateReleases();
})();
}

0 comments on commit b11e77b

Please sign in to comment.