diff options
author | lonkaars <loek@pipeframe.xyz> | 2021-04-29 19:01:09 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2021-04-29 19:01:09 +0200 |
commit | 9eba5d3e5da90987bb38ee33b505e0c26ea310d9 (patch) | |
tree | 0776ecae8d04b450fa5b5be092dd50cbda07ee0b | |
parent | 793fbd746ec640d884ff1fd859231404c31a05fd (diff) |
more endpoints
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | index.ts | 10 | ||||
-rw-r--r-- | makefile | 6 |
3 files changed, 13 insertions, 4 deletions
@@ -41,3 +41,4 @@ jspm_packages **/*.js downloads.html +out/ @@ -1,5 +1,9 @@ import puppeteer from 'puppeteer'; import cheerio from 'cheerio'; +import { writeFile } from 'fs'; +import { promisify } from 'util'; + +var writeFileAsync = promisify(writeFile); import * as types from './types'; @@ -53,6 +57,10 @@ downloads.each(async (i, el) => { latestPre = version; } + for(var mcVersion in minecraftVersions) { + await writeFileAsync("./out/" + mcVersion, JSON.stringify(minecraftVersions[mcVersion])); + } + var response: types.APIResponse = { lastUpdate: Date.now(), all: versions, @@ -61,7 +69,7 @@ downloads.each(async (i, el) => { latestPre } - console.log(JSON.stringify(response)); + await writeFileAsync("./out/all", JSON.stringify(response)); process.exit(0); } }); @@ -1,4 +1,4 @@ -all: source +all: + mkdir out + node . -source: - node . > downloads.html |