File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 1+ import * as packageJson from '../../../package.json'
2+
13const intEnv = ( envName : string , defaultValue : number ) : number => {
24 const value = parseInt ( process ?. env ?. [ envName ] || '' , 10 )
35
@@ -44,6 +46,8 @@ export const defaultConfig = {
4446 ) ,
4547 } ,
4648 app : {
49+ version : packageJson . version ,
50+ sha : process . env . GITHUB_SHA ,
4751 env : process . env . NODE_ENV ,
4852 type : process . env . RI_APP_TYPE ,
4953 resourcesBaseUrl : process . env . RI_RESOURCES_BASE_URL ?? apiUrl , // todo: no usage found
Original file line number Diff line number Diff line change @@ -37,6 +37,18 @@ export default defineConfig({
3737 svgr ( { include : [ '**/*.svg?react' ] } ) ,
3838 reactClickToComponent ( ) ,
3939 ViteEjsPlugin ( ) ,
40+ // Inject app info to window global object via custom plugin
41+ {
42+ name : 'app-info' ,
43+ transformIndexHtml ( html ) {
44+ const script = `<script>window.appInfo = ${ JSON . stringify ( {
45+ version : defaultConfig . app . version ,
46+ sha : defaultConfig . app . sha ,
47+ } ) } ;</script>`;
48+
49+ return html . replace ( / < h e a d > / , `<head>\n ${ script } ` ) ;
50+ }
51+ }
4052 // !isElectron && compression({
4153 // include: [/\.(js)$/, /\.(css)$/],
4254 // deleteOriginalAssets: true
You can’t perform that action at this time.
0 commit comments