Version bump and sync git hash

This commit is contained in:
Nicholas Zuber 2018-11-10 23:29:53 -05:00
parent 7ad93df2bd
commit b27c4bc962
4 changed files with 27 additions and 11 deletions

View File

@ -2,6 +2,7 @@
const path = require('path');
const webpack = require('webpack');
const {execSync} = require('child_process');
const PnpWebpackPlugin = require('pnp-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
@ -14,6 +15,7 @@ const paths = require('./paths');
const ManifestPlugin = require('webpack-manifest-plugin');
const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
const gitHash = execSync('git rev-parse --short HEAD').toString().trim();
// Webpack uses `publicPath` to determine where the app is being served from.
// In development, we always serve from the root. This makes config easier.
@ -327,6 +329,11 @@ module.exports = {
],
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
'GIT_HASH': JSON.stringify(gitHash)
}
}),
// Generates an `index.html` file with the <script> injected.
new HtmlWebpackPlugin({
inject: true,

View File

@ -2,6 +2,7 @@
const path = require('path');
const webpack = require('webpack');
const {execSync} = require('child_process');
const PnpWebpackPlugin = require('pnp-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin');
@ -18,6 +19,8 @@ const paths = require('./paths');
const getClientEnvironment = require('./env');
const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
const gitHash = execSync('git rev-parse --short HEAD').toString().trim();
// Webpack uses `publicPath` to determine where the app is being served from.
// It requires a trailing slash, or the file assets will get an incorrect path.
@ -416,6 +419,11 @@ module.exports = {
],
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
'GIT_HASH': JSON.stringify(gitHash)
}
}),
// Generates an `index.html` file with the <script> injected.
new HtmlWebpackPlugin({
inject: true,

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "meteorite",
"version": "0.1.0",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -8,7 +8,8 @@ import Logo from '../../components/Logo';
import screenshot from '../../images/screenshot.png';
import '../../styles/gradient.css';
const version = require('../../../package.json').version;
const hash = process.env.GIT_HASH ? `#${process.env.GIT_HASH}` : '';
const version = require('../../../package.json').version + hash;
function createImagePlaceholder (highlight) {
return (
@ -749,9 +750,9 @@ export default function Scene ({loggedIn, onLogout, ...props}) {
</SmallText>
</Item>
<Item style={{textAlign: 'right'}} className="footer-links">
<SmallLink style={{marginLeft: 28}}>Source code</SmallLink>
<SmallLink style={{marginLeft: 28}}>Bug reports</SmallLink>
<SmallLink style={{marginLeft: 28}}>Submit feedback</SmallLink>
<SmallLink target="_blank" href="https://github.com/nickzuber/meteorite/" style={{marginLeft: 28}}>Source code</SmallLink>
<SmallLink target="_blank" href="https://github.com/nickzuber/meteorite/issues" style={{marginLeft: 28}}>Bug reports</SmallLink>
<SmallLink target="_blank" href="https://github.com/nickzuber/meteorite/issues" style={{marginLeft: 28}}>Submit feedback</SmallLink>
<SmallText style={{marginLeft: 28, opacity: .25}}>v{version}</SmallText>
</Item>
<Item style={{flex: '0 0 2.5%', padding: 0}} />