Commit f3b33a66 authored by Joseph Weston's avatar Joseph Weston

get zesje version from zesje/_version.py

parent de542380
......@@ -181,7 +181,7 @@ class NavBar extends React.Component {
: <Link className='navbar-item' to='/graders'>Add grader</Link>
}
<div className='navbar-item'>
<i>Version {__COMMIT_HASH__}</i>
<i>Version {__ZESJE_VERSION__}</i>
</div>
</div>
</div>
......
......@@ -18,7 +18,7 @@
"standard": {
"parser": "babel-eslint",
"globals": [
"__COMMIT_HASH__",
"__ZESJE_VERSION__",
"alert",
"confirm"
]
......
......@@ -2,6 +2,7 @@
./webpack.config.js
*/
const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
......@@ -11,6 +12,11 @@ const HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
inject: 'body'
})
const zesjeVersion = require('child_process')
.execSync('python zesje/_version.py')
.toString()
.trim()
module.exports = {
entry: './client/index.jsx',
output: {
......@@ -28,5 +34,10 @@ module.exports = {
]
},
plugins: [HtmlWebpackPluginConfig]
plugins: [
HtmlWebpackPluginConfig,
new webpack.DefinePlugin({
__ZESJE_VERSION__: JSON.stringify(zesjeVersion)
})
]
}
......@@ -2,11 +2,6 @@ const webpack = require('webpack')
const merge = require('webpack-merge')
const common = require('./webpack.common.js')
const commitHash = require('child_process')
.execSync('git rev-parse --short HEAD')
.toString()
.trim()
module.exports = merge(common, {
mode: 'development',
module: {
......@@ -34,9 +29,6 @@ module.exports = merge(common, {
plugins: [
new webpack.EvalSourceMapDevToolPlugin({
sourceURLTemplate: module => `/${module.identifier}`
}),
new webpack.DefinePlugin({
__COMMIT_HASH__: JSON.stringify(commitHash + '-dev')
})
]
})
......@@ -5,11 +5,6 @@ const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const common = require('./webpack.common.js')
const commitHash = require('child_process')
.execSync('git rev-parse --short HEAD')
.toString()
.trim()
module.exports = merge(common, {
mode: 'production',
......@@ -41,9 +36,6 @@ module.exports = merge(common, {
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].css'
}),
new webpack.DefinePlugin({
__COMMIT_HASH__: JSON.stringify(commitHash + '-prod')
})
]
})
......@@ -164,3 +164,6 @@ class _sdist(sdist_orig):
cmdclass = dict(sdist=_sdist, build_py=_build_py)
if __name__ == '__main__':
print(__version__)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment