From 21779007be023436b85e60bce01a18fc3eb600cc Mon Sep 17 00:00:00 2001 From: "a.bouhuolia" Date: Mon, 3 Jan 2022 23:14:11 +0200 Subject: [PATCH] fix: application version. --- config/env.js | 3 +++ config/paths.js | 3 +++ src/components/Sidebar/Sidebar.js | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/config/env.js b/config/env.js index 09ec03c5b..24a907f0d 100644 --- a/config/env.js +++ b/config/env.js @@ -85,6 +85,9 @@ function getClientEnvironment(publicUrl) { WDS_SOCKET_HOST: process.env.WDS_SOCKET_HOST, WDS_SOCKET_PATH: process.env.WDS_SOCKET_PATH, WDS_SOCKET_PORT: process.env.WDS_SOCKET_PORT, + + // Application version. + VERSION: paths.appVersion } ); // Stringify all values so we can feed into webpack DefinePlugin diff --git a/config/paths.js b/config/paths.js index b3fd764ae..d9a21bc72 100644 --- a/config/paths.js +++ b/config/paths.js @@ -48,6 +48,8 @@ const resolveModule = (resolveFn, filePath) => { return resolveFn(`${filePath}.js`); }; +const appVersion = require(resolveApp('package.json')).version; + // config after eject: we're in ./config/ module.exports = { dotenv: resolveApp('.env'), @@ -65,6 +67,7 @@ module.exports = { proxySetup: resolveApp('src/setupProxy.js'), appNodeModules: resolveApp('node_modules'), publicUrlOrPath, + appVersion }; diff --git a/src/components/Sidebar/Sidebar.js b/src/components/Sidebar/Sidebar.js index dee5b7d12..92f97cc95 100644 --- a/src/components/Sidebar/Sidebar.js +++ b/src/components/Sidebar/Sidebar.js @@ -28,7 +28,7 @@ export default function Sidebar({ dashboardContentRef }) { * @returns {React.JSX} */ function SidebarFooterVersion() { - const { REACT_APP_VERSION: VERSION } = process.env; + const { VERSION } = process.env; if (!VERSION) { return null;