Skip to content

Commit df6862f

Browse files
committed
Replace branch with pkg name
1 parent 57b270c commit df6862f

File tree

6 files changed

+13
-19
lines changed

6 files changed

+13
-19
lines changed

apps/koku-ui-hccm/fec.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
44
const { GitRevisionPlugin } = require('git-revision-webpack-plugin');
55
const path = require('path');
66
const webpack = require('webpack');
7-
const { dependencies, insights } = require('./package.json');
7+
const { dependencies, insights, name } = require('./package.json');
88

99
const moduleName = insights.appname.replace(/-(\w)/g, (_, match) => match.toUpperCase());
1010
const 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: {

apps/koku-ui-hccm/src/app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
};

apps/koku-ui-ros/fec.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
44
const { GitRevisionPlugin } = require('git-revision-webpack-plugin');
55
const path = require('path');
66
const webpack = require('webpack');
7-
const { dependencies, insights } = require('./package.json');
7+
const { dependencies, insights, name } = require('./package.json');
88

99
const moduleName = insights.appname.replace(/-(\w)/g, (_, match) => match.toUpperCase());
1010
const 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: {

apps/koku-ui-ros/src/app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
};

apps/koku-ui-ros/src/fed-modules/optimizationsWrapper.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import { rosStore } from 'store';
88

99
// eslint-disable-next-line no-restricted-imports
1010
import messages from '../../locales/data.json';
11-
// eslint-disable-next-line no-restricted-imports
12-
import pkg from '../../package.json';
1311

1412
export 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
);
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
import 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

1410
export default UiVersion;

0 commit comments

Comments
 (0)