1.0.1 • Published 1 year ago

si-app-version v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

app-version

Installation

npm i -D si-app-version

How to inject a app version in vue application ?

  • Install si-app-version package from npm repository.
  • Now import si-app-version package in your vue.config.js file at line no.1.
    // vue.config.js
    require("si-app-version");
    ...
  • This package injects a VUE_APP_VERSION VUE_APP_BRANCH VUE_APP_COMMIT_SHA in to environment variables.
  • VUE_APP_VERSION consists a build time (current date and time) and git branch name (current branch name).
  • version.txt will get updated with VUE_APP_VERSION version value.
  • To print app version in browser, add this line console.log("%c" + process.env.VUE_APP_VERSION, "color:blue;font-size: 14px;font-weight: 700") in mounted or created hook of your entry vue file.
    // App.vue
    export default {
        name: 'app',
        components: {
            ...
        },
        created() {
            console.log("%c" + process.env.VUE_APP_VERSION, "color:blue;font-size: 14px;font-weight: 700")
        },
        mounted (){
            ...
        }
    }