-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
32 lines (29 loc) · 995 Bytes
/
vite.config.ts
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 { sveltekit } from '@sveltejs/kit/vite';
import { execSync } from 'node:child_process';
import { imagetools } from 'vite-imagetools';
import { defineConfig } from 'vitest/config';
export default defineConfig(() => {
const commitDescribe = execSync('git describe --tags').toString().trimEnd();
const commitDate = execSync('git log -1 --format=%cI').toString().trimEnd();
const branchName = execSync('git rev-parse --abbrev-ref HEAD').toString().trimEnd();
const commitHash = execSync('git rev-parse HEAD').toString().trimEnd();
process.env.VITE_GIT_COMMIT_DATE = commitDate;
process.env.VITE_GIT_BRANCH_NAME = branchName;
process.env.VITE_GIT_COMMIT_HASH = commitHash;
process.env.VITE_APP_VERSION = commitDescribe;
return {
plugins: [
sveltekit(),
imagetools({
defaultDirectives: () =>
new URLSearchParams({
format: 'webp'
})
})
],
assetsInclude: ['**/*.meme', '**/*.zip'],
test: {
include: ['src/**/*.{test,spec}.{js,ts}']
}
};
});