diff --git a/spark-frontend/config/webpack.config.js b/spark-frontend/config/webpack.config.js index 3f2a9c61..961c21ae 100644 --- a/spark-frontend/config/webpack.config.js +++ b/spark-frontend/config/webpack.config.js @@ -85,6 +85,13 @@ const hasJsxRuntime = (() => { } })(); +const COMMIT_HASH = require('child_process') +.execSync('git rev-parse --short HEAD') +.toString() +.trim(); + +console.log(COMMIT_HASH) + // This is the production and development configuration. // It is focused on developer experience, fast rebuilds, and a minimal bundle. module.exports = function (webpackEnv) { @@ -751,6 +758,9 @@ module.exports = function (webpackEnv) { }, }, }), + new webpack.DefinePlugin({ + __COMMIT_HASH__: JSON.stringify(COMMIT_HASH) + }) ].filter(Boolean), // Turn off performance processing because we utilize // our own hints via the FileSizeReporter diff --git a/spark-frontend/src/index.tsx b/spark-frontend/src/index.tsx index 682cc831..53ab8fe1 100644 --- a/spark-frontend/src/index.tsx +++ b/spark-frontend/src/index.tsx @@ -19,6 +19,8 @@ const initState = loadState(); const STORE = RootStore.create(initState); +console.warn(`Version: ${__COMMIT_HASH__}`); + const root = ReactDOM.createRoot(document.getElementById("root") as HTMLElement); root.render( // diff --git a/spark-frontend/src/typings/react-app-env.d.ts b/spark-frontend/src/typings/react-app-env.d.ts index 3523af0c..885ba0d4 100644 --- a/spark-frontend/src/typings/react-app-env.d.ts +++ b/spark-frontend/src/typings/react-app-env.d.ts @@ -80,3 +80,5 @@ declare module "*.module.sass" { const classes: { readonly [key: string]: string }; export default classes; } + +declare const __COMMIT_HASH__: string; \ No newline at end of file