Skip to content

Commit

Permalink
Merge pull request #1054 from thunderstore-io/ecosystem-schema
Browse files Browse the repository at this point in the history
Add a node script for syncing supported games list
  • Loading branch information
MythicManiac authored Aug 18, 2023
2 parents 5294296 + a2cbd21 commit 9dd763f
Show file tree
Hide file tree
Showing 3 changed files with 5,906 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"scripts": {
"test": "echo \"See package.json => scripts for available tests.\" && exit 0",
"run": "quasar dev -m electron --modern",
"sync": "ts-node ./scripts/sync.ts",
"build-win": "quasar build --mode electron -T win32",
"build-linux": "quasar build --mode electron -T linux",
"build-osx": "quasar build --mode electron -T mac",
Expand Down
19 changes: 19 additions & 0 deletions scripts/sync.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import fs from "fs";

/**
* This script synchronizes the in-repo ecosystem schema JSON to the latest
* version.
*/

async function updateSchema() {
console.log("Updating games.json...")
const response = await fetch("https://thunderstore.io/api/experimental/schema/dev/latest/");
if (response.status !== 200) {
throw new Error(`Received non-200 status from schema API: ${response.status}`);
}
const data = Buffer.from(await response.arrayBuffer());
fs.writeFileSync("./src/assets/data/games.json", data);
console.log("Done!");
}

updateSchema();
Loading

0 comments on commit 9dd763f

Please sign in to comment.