-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1054 from thunderstore-io/ecosystem-schema
Add a node script for syncing supported games list
- Loading branch information
Showing
3 changed files
with
5,906 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
Oops, something went wrong.