aboutsummaryrefslogtreecommitdiff
path: root/svelte.config.js
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-03-05 16:58:43 -0600
committermat <github@matdoes.dev>2022-03-05 16:58:43 -0600
commit5226124e477aa1c706960b7c56fafd001ce7e007 (patch)
treec7de655848121b515117bc47f3af00bc32c39bdd /svelte.config.js
parentcf7c8a7b343acd7c9a4b6087f9a76b2e099889d5 (diff)
downloadskyblock-stats-5226124e477aa1c706960b7c56fafd001ce7e007.tar.gz
skyblock-stats-5226124e477aa1c706960b7c56fafd001ce7e007.tar.bz2
skyblock-stats-5226124e477aa1c706960b7c56fafd001ce7e007.zip
donators
Diffstat (limited to 'svelte.config.js')
-rw-r--r--svelte.config.js49
1 files changed, 0 insertions, 49 deletions
diff --git a/svelte.config.js b/svelte.config.js
index 52db23e..9201300 100644
--- a/svelte.config.js
+++ b/svelte.config.js
@@ -1,57 +1,8 @@
// import adapter from '@sveltejs/adapter-cloudflare'
import adapter from '@sveltejs/adapter-auto'
import preprocess from 'svelte-preprocess'
-import fs from 'fs'
-import https from 'https'
-function fetch(url) {
- return new Promise((resolve, reject) => {
- let data = ''
- const req = https.request(new URL(url), res => {
- res.on('data', d => {
- data += d
- })
-
- res.on('end', () => {
- resolve(data)
- })
- })
-
- req.on('error', error => {
- reject(error)
- })
-
- req.end()
- })
-}
-function shuffle(a) {
- for (let i = a.length - 1; i > 0; i--) {
- const j = Math.floor(Math.random() * (i + 1))
- ;[a[i], a[j]] = [a[j], a[i]]
- }
- return a
-}
-
-(async () => {
- const API_URL = 'https://skyblock-api.matdoes.dev/'
-
- // create a donators.json from the donators.txt
- const donatorUuidsText = await fs.promises.readFile('src/donators.txt', {
- encoding: 'utf8'
- })
- const donatorUuids = donatorUuidsText.split('\n').map(u => u.split(' ')[0]).filter(u => u)
- const donators = await Promise.all(
- donatorUuids.map(u => fetch(`${API_URL}player/${u}`)
- .then(r => JSON.parse(r).player)
- )
- )
- await fs.promises.writeFile(
- 'src/_donators.json',
- JSON.stringify(donators),
- { encoding: 'utf8' }
- )
-})()
/** @type {import('@sveltejs/kit').Config} */
const config = {