Commit 8e41d97f authored by Reza Sahebgharan's avatar Reza Sahebgharan

feat: app version.vue

parent b8159c9f
...@@ -9,7 +9,12 @@ import VueRouter from 'vue-router'; ...@@ -9,7 +9,12 @@ import VueRouter from 'vue-router';
Vue.use(VueRouter); Vue.use(VueRouter);
import { Plugin } from 'vue-fragment' import { Plugin } from 'vue-fragment'
Vue.use(Plugin) Vue.use(Plugin);
console.log(COMMITHASH);
console.log(VERSION);
console.log(BRANCH);
import routes from './plugins/routes'; import routes from './plugins/routes';
......
...@@ -33,12 +33,19 @@ ...@@ -33,12 +33,19 @@
// import EditWorkList from '../components/EditWorkList.vue'; // import EditWorkList from '../components/EditWorkList.vue';
// import WorkList from '../components/Worklist.vue'; // import WorkList from '../components/Worklist.vue';
import AppVersion from '../views/AppVersion.vue';
const routes = [{ const routes = [{
path: '/', path: '/',
component: () => component: () =>
import ('../views/Home.vue'), import ('../views/Home.vue'),
name: 'Home' name: 'Home'
}, },
{
path: '/appversion',
component: AppVersion,
name: 'AppVersion'
},
{ {
path: '/signin', path: '/signin',
component: () => component: () =>
......
<template>
<div>
<div>Version: {{Version}}</div>
<div>CommitHash:{{CommitHash}}</div>
<div>BRANCH:{{Branch}}</div>
</div>
</template>
<script>
export default {
data() {
return {
Version: VERSION,
CommitHash: COMMITHASH,
Branch: BRANCH
};
}
};
</script>
\ No newline at end of file
...@@ -2897,6 +2897,12 @@ ...@@ -2897,6 +2897,12 @@
"assert-plus": "^1.0.0" "assert-plus": "^1.0.0"
} }
}, },
"git-revision-webpack-plugin": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/git-revision-webpack-plugin/-/git-revision-webpack-plugin-3.0.4.tgz",
"integrity": "sha512-ym4Zkl32HtTRZVVgl1KoE+sWtgeFyDjN3vaBQfn8cCv1btAX7rdDY9tgpv4Zi+yxq150pp+pUkGH9L1lRpZOUg==",
"dev": true
},
"glob": { "glob": {
"version": "7.1.4", "version": "7.1.4",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz",
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
"css-loader": "^3.2.0", "css-loader": "^3.2.0",
"deepmerge": "^4.0.0", "deepmerge": "^4.0.0",
"file-loader": "^4.2.0", "file-loader": "^4.2.0",
"git-revision-webpack-plugin": "^3.0.4",
"html-loader": "^0.5.5", "html-loader": "^0.5.5",
"html-webpack-plugin": "^3.2.0", "html-webpack-plugin": "^3.2.0",
"less": "^3.10.3", "less": "^3.10.3",
......
...@@ -6,6 +6,9 @@ const VueLoaderPlugin = require('vue-loader/lib/plugin'); ...@@ -6,6 +6,9 @@ const VueLoaderPlugin = require('vue-loader/lib/plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const GitRevisionPlugin = require('git-revision-webpack-plugin');
const gitRevisionPlugin = new GitRevisionPlugin();
const clientConfig = { const clientConfig = {
entry: './client/main.js', entry: './client/main.js',
// output: { // output: {
...@@ -152,7 +155,12 @@ const clientConfig = { ...@@ -152,7 +155,12 @@ const clientConfig = {
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: './client/main.html' template: './client/main.html'
}), }),
new VueLoaderPlugin() new VueLoaderPlugin(),
new webpack.DefinePlugin({
'VERSION': JSON.stringify(gitRevisionPlugin.version()),
'COMMITHASH': JSON.stringify(gitRevisionPlugin.commithash()),
'BRANCH': JSON.stringify(gitRevisionPlugin.branch()),
})
] ]
} }
......
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