-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
svelte.config.js
32 lines (26 loc) · 1.07 KB
/
svelte.config.js
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
import adapterAuto from '@sveltejs/adapter-auto'
import adapterNode from '@sveltejs/adapter-node'
import adapterStatic from '@sveltejs/adapter-static'
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
import { execSync } from 'child_process'
import { loadEnv } from 'vite'
/** @type {import('./src/lib/utils/vite.js').BuildEnv} */
const env = loadEnv(process.env['NODE_ENV'] ?? 'development', process.cwd(), 'BUILD_')
/** @returns {import('@sveltejs/kit').Adapter} */
function adapter() {
if (env.BUILD_IPFS === 'true') return adapterStatic({ fallback: 'ipfs-404.html' })
else if (env.BUILD_ADAPTER === 'node') return adapterNode()
else if (env.BUILD_ADAPTER === 'static' || process.env.GITHUB_ACTIONS === 'true')
return adapterStatic({ fallback: '404.html' })
return adapterAuto()
}
/** @type {import('@sveltejs/kit').Config} */
const config = {
preprocess: [vitePreprocess()],
kit: {
adapter: adapter(),
paths: { base: env.BUILD_BASE },
version: { name: execSync('git describe --always --broken --dirty --tags').toString().trim() },
},
}
export default config