File tree Expand file tree Collapse file tree 6 files changed +13
-19
lines changed
libs/ui-lib/src/components/page/uiVersion Expand file tree Collapse file tree 6 files changed +13
-19
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
44const { GitRevisionPlugin } = require ( 'git-revision-webpack-plugin' ) ;
55const path = require ( 'path' ) ;
66const webpack = require ( 'webpack' ) ;
7- const { dependencies, insights } = require ( './package.json' ) ;
7+ const { dependencies, insights, name } = require ( './package.json' ) ;
88
99const moduleName = insights . appname . replace ( / - ( \w ) / g, ( _ , match ) => match . toUpperCase ( ) ) ;
1010const srcDir = path . resolve ( __dirname , './src' ) ;
@@ -89,8 +89,8 @@ module.exports = {
8989 } ) ,
9090 gitRevisionPlugin ,
9191 new webpack . DefinePlugin ( {
92- 'process.env.COMMITHASH ' : JSON . stringify ( gitRevisionPlugin . commithash ( ) ) ,
93- 'process.env.BRANCH ' : JSON . stringify ( gitRevisionPlugin . branch ( ) ) ,
92+ 'process.env.KOKU_UI_COMMITHASH ' : JSON . stringify ( gitRevisionPlugin . commithash ( ) ) ,
93+ 'process.env.KOKU_UI_PKGNAME ' : JSON . stringify ( name ) ,
9494 } ) ,
9595 ] ,
9696 resolve : {
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ const App = () => {
3838 < NotificationsProvider store = { store } >
3939 < Routes />
4040 </ NotificationsProvider >
41- < UiVersion appName = { pkg . name } />
41+ < UiVersion />
4242 </ div >
4343 ) ;
4444} ;
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
44const { GitRevisionPlugin } = require ( 'git-revision-webpack-plugin' ) ;
55const path = require ( 'path' ) ;
66const webpack = require ( 'webpack' ) ;
7- const { dependencies, insights } = require ( './package.json' ) ;
7+ const { dependencies, insights, name } = require ( './package.json' ) ;
88
99const moduleName = insights . appname . replace ( / - ( \w ) / g, ( _ , match ) => match . toUpperCase ( ) ) ;
1010const srcDir = path . resolve ( __dirname , './src' ) ;
@@ -93,8 +93,8 @@ module.exports = {
9393 } ) ,
9494 gitRevisionPlugin ,
9595 new webpack . DefinePlugin ( {
96- 'process.env.COMMITHASH ' : JSON . stringify ( gitRevisionPlugin . commithash ( ) ) ,
97- 'process.env.BRANCH ' : JSON . stringify ( gitRevisionPlugin . branch ( ) ) ,
96+ 'process.env.KOKU_UI_COMMITHASH ' : JSON . stringify ( gitRevisionPlugin . commithash ( ) ) ,
97+ 'process.env.KOKU_UI_PKGNAME ' : JSON . stringify ( name ) ,
9898 } ) ,
9999 ] ,
100100 resolve : {
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ const App = () => {
3838 < NotificationsProvider store = { store } >
3939 < Routes />
4040 </ NotificationsProvider >
41- < UiVersion appName = { pkg . name } />
41+ < UiVersion />
4242 </ div >
4343 ) ;
4444} ;
Original file line number Diff line number Diff line change @@ -8,8 +8,6 @@ import { rosStore } from 'store';
88
99// eslint-disable-next-line no-restricted-imports
1010import messages from '../../locales/data.json' ;
11- // eslint-disable-next-line no-restricted-imports
12- import pkg from '../../package.json' ;
1311
1412export interface OptimizationsWrapperOwnProps {
1513 children ?: React . ReactNode ;
@@ -25,7 +23,7 @@ const OptimizationsWrapper: React.FC<OptimizationsWrapperProps> = ({ children }:
2523 < IntlProvider defaultLocale = "en" locale = { locale } messages = { messages [ locale ] } onError = { console . log } >
2624 < Provider store = { rosStore as any } >
2725 < div className = "costManagementRos" > { children } </ div >
28- < UiVersion appName = { pkg . name } />
26+ < UiVersion />
2927 </ Provider >
3028 </ IntlProvider >
3129 ) ;
Original file line number Diff line number Diff line change 11import React from 'react' ;
22
3- interface UiVersionProps {
4- appName ?: string ;
5- }
3+ const UiVersion = ( ) => {
4+ const pkgname = process . env . KOKU_UI_PKGNAME ?? 'unknown-pkgname' ;
5+ const commithash = process . env . KOKU_UI_COMMITHASH ?? 'unknown-commithash' ;
66
7- const UiVersion = ( { appName = '@koku-ui' } : UiVersionProps ) => {
8- const branch = process . env . BRANCH ?? 'unknown-branch' ;
9- const commithash = process . env . COMMITHASH ?? 'unknown-commithash' ;
10-
11- return < div id = { `${ appName } :${ branch } :${ commithash } ` } hidden /> ;
7+ return < div id = { `${ pkgname } _${ commithash } ` } hidden /> ;
128} ;
139
1410export default UiVersion ;
You can’t perform that action at this time.
0 commit comments