-
-
Notifications
You must be signed in to change notification settings - Fork 121
/
Copy pathsvelte.config.js
69 lines (62 loc) · 2.14 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
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
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import adapter from '@sveltejs/adapter-static';
import * as child_process from 'node:child_process';
import verseCountPerSurah from './scripts/verseCountPerSurah.js';
import { staticUrls } from './scripts/routes.js';
const allSurahAndVerse = [];
for (let indexSurah = 0; indexSurah < 114; indexSurah++) {
allSurahAndVerse.push(`/${indexSurah + 1}`);
allSurahAndVerse.push(`/amp/${indexSurah + 1}`);
allSurahAndVerse.push(`/surah/${indexSurah + 1}`);
const verseCount = verseCountPerSurah[`${indexSurah + 1}`];
for (let indexVerse = 0; indexVerse < verseCount; indexVerse++) {
allSurahAndVerse.push(`/${indexSurah + 1}/${indexVerse + 1}`);
allSurahAndVerse.push(`/amp/${indexSurah + 1}/${indexVerse + 1}`);
allSurahAndVerse.push(`/surah/${indexSurah + 1}/${indexVerse + 1}`);
}
}
const gitRev = child_process.execSync('git rev-parse --short HEAD').toString().trim() || '';
const dateRev = new Date()
.toLocaleDateString('en-CA', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
timeZone: 'Asia/Jakarta'
})
.replace(/-|\//g, '');
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: vitePreprocess({
preserve: ['ld+json']
}),
kit: {
version: {
name: `${gitRev}-${dateRev}`
},
alias: {
$lib: 'src/lib',
$data: 'src/data',
$store: 'src/store'
},
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
adapter: adapter({
// default options are shown. On some platforms
// these options are set automatically — see below
pages: 'build',
assets: 'build',
fallback: '404.html',
precompress: false,
strict: true
}),
prerender: {
crawl: false,
entries: ['/', ...staticUrls, ...allSurahAndVerse],
handleEntryGeneratorMismatch: 'warn'
}
}
};
export default config;