diff --git a/src/index.js b/src/index.js index 349346bf9..34d03779a 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,5 @@ /* global AFRAME, THREE, XMLHttpRequest */ +if (typeof VERSION !== 'undefined') { console.log(`3DStreet Version: ${VERSION} (Date: ${new Date(COMMIT_DATE).toISOString().split('T')[0]}, Commit Hash: #${COMMIT_HASH})`); } var streetmixParsers = require('./aframe-streetmix-parsers'); var streetmixUtils = require('./tested/streetmix-utils'); require('./components/anisotropy'); diff --git a/webpack.config.js b/webpack.config.js index f3016985c..0aa5653d3 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,4 +1,5 @@ const path = require('path'); +const webpack = require('webpack'); const TerserPlugin = require('terser-webpack-plugin'); module.exports = { @@ -14,6 +15,17 @@ module.exports = { ] }, optimization: { - minimizer: [new TerserPlugin({ extractComments: false })], - } + minimizer: [new TerserPlugin({ extractComments: false })] + }, + plugins: [ + new webpack.DefinePlugin({ + VERSION: JSON.stringify(process.env.npm_package_version) + }), + new webpack.DefinePlugin({ + COMMIT_DATE: JSON.stringify(require('child_process').execSync('git log -1 --format=%cd').toString().trim()) + }), + new webpack.DefinePlugin({ + COMMIT_HASH: JSON.stringify(require('child_process').execSync('git rev-parse --short HEAD').toString().trim()) + }) + ] };