forked from mubaidr/vite-vue3-browser-extension-v3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
define.config.ts
26 lines (20 loc) · 887 Bytes
/
define.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
import fs from 'fs'
import { spawnSync } from 'child_process'
import packageJson from './package.json'
// Read CHANGELOG.md file into a string.
const changelog = fs.readFileSync('./CHANGELOG.md', 'utf-8')
// Get the current git commit hash.
const gitCommit = spawnSync('git', ['rev-parse', '--short', 'HEAD'])
.stdout.toString()
.trim()
const jsn = (value: string) => JSON.stringify(value)
// Don't forget to add your added variables to vite-env.d.ts also!
// These variables are available in your Vue components and will be replaced by their values at build time.
// These will be compiled into your app. Don't store secrets here!
export const defineViteConfig = {
__VERSION__: jsn(packageJson.version),
__DISPLAY_NAME__: jsn(packageJson.displayName),
__CHANGELOG__: jsn(changelog),
__GIT_COMMIT__: jsn(gitCommit),
__GITHUB_URL__: jsn(packageJson.repository.url),
}