1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
// 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', () => {
console.log(data)
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
}
console.log('svelte.config.js');
(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' }
)
console.log('wrote file!')
})()
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://github.com/sveltejs/svelte-preprocess
// for more information about preprocessors
preprocess: preprocess(),
kit: {
adapter: adapter(),
// adapter: adapter({
// out: 'build',
// precompress: true,
// env: {
// host: '127.0.0.1'
// }
// }),
// Override http methods in the Todo forms
methodOverride: {
allowed: ['PATCH', 'DELETE']
},
// https://vitejs.dev/config/
vite: {
// plugins: [createHtmlPlugin({
// minify: true
// })],
build: {
rollupOptions: {
// external: ['discord-api-types/payloads/v9', 'discord-api-types', 'discord-api-types/v9'],
output: {
manualChunks: undefined,
},
},
},
},
}
}
export default config
|