File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,35 @@ import VueRouter from 'unplugin-vue-router/vite'
8
8
9
9
// Utilities
10
10
import { defineConfig } from 'vite'
11
+ import { execSync } from 'node:child_process'
11
12
import { fileURLToPath , URL } from 'node:url'
12
13
13
14
import { commonjsDeps } from '@koumoul/vjsf/utils/build.js'
14
15
16
+ function getVersion ( ) {
17
+ // Try to get the version via `git` if available; otherwise fall back on
18
+ // the COMMIT_REF environment variable provided by Netlify's build
19
+ // environment; if that is missing, report "unknown" as the version.
20
+
21
+ try {
22
+ return execSync ( 'git describe --tags' ) . toString ( ) ;
23
+ } catch {
24
+ return process . env . COMMIT_REF ? process . env . COMMIT_REF : 'unknown' ;
25
+ }
26
+ }
27
+
28
+ function getGitRevision ( ) {
29
+ try {
30
+ return execSync ( 'git rev-parse HEAD' ) . toString ( ) ;
31
+ } catch {
32
+ return '' ;
33
+ }
34
+ }
35
+
36
+ process . env . VITE_APP_VERSION = getVersion ( ) ;
37
+ process . env . VITE_APP_GIT_REVISION = getGitRevision ( ) ;
38
+
39
+
15
40
// https://vitejs.dev/config/
16
41
export default defineConfig ( {
17
42
plugins : [
You can’t perform that action at this time.
0 commit comments