Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
read version from package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
mort3za committed Jun 29, 2019
1 parent e90a6f7 commit b1b9fdf
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Vue.use(Vuex);

const store = new Vuex.Store({
state: {
appVersion: JSON.parse(unescape(process.env.APP_VERSION)),
diceResult: null,
gameStatus: GameStatus.NOT_STARTED,
boardStatus: BoardStatus.INITIALIZING,
Expand Down Expand Up @@ -55,6 +56,9 @@ const store = new Vuex.Store({
},
boardWidth(state) {
return state.boardWidth;
},
appVersion(state) {
return state.appVersion
}
},
modules: {
Expand Down
16 changes: 11 additions & 5 deletions src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,22 @@
</div>
</div>
<footer>
<small>version: 1.0.0-alpha.2</small>
<small>version: {{appVersion}}</small>
</footer>
</div>
</template>

<script>
<script lang="ts">
import { Vue, Component } from "vue-property-decorator";
import store from '@/store/index.ts';
import Board from "@/components/Board.vue";
export default {
name: "page-home"
};
@Component
export default class HomeComponent extends Vue {
get appVersion() {
return store.getters["appVersion"]
}
}
</script>

<style lang="scss" scoped>
Expand Down
11 changes: 11 additions & 0 deletions vue.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const webpack = require('webpack');

module.exports = {
lintOnSave: false,
productionSourceMap: false,
Expand All @@ -16,6 +18,15 @@ module.exports = {
msTileImage: "img/icons/mstile-144x144.png"
}
},
configureWebpack: {
plugins: [
new webpack.DefinePlugin({
'process.env': {
APP_VERSION: '"' + escape(JSON.stringify(require('./package.json').version)) + '"'
}
})
]
},
css: {
loaderOptions: {
sass: {
Expand Down

0 comments on commit b1b9fdf

Please sign in to comment.