vue-cli-plugin-build-info
Vue-cli plugin that shows build information in console.
It may be useful if you have established CI out of your control and want to make sure the version everyone sees on staging corresponds to last commit.
Install
⚠️ Make sure you have vue-cli
vue --version
If you don't have a project created with vue-cli yet:
vue create my-app
Navigate to the newly created project folder and add the cli plugin. Before installing it, make sure to commit your current changes should you wish to revert them later.
vue add build-info
Usage
Vue-cli:
The plugin automatically injects a method into your entry file that allows you to see basic information about the latest build in console
//main.js
You can also import a method getBuildInfo
that return an object BUILD_INFO
that contains VERSION, TIMESTAMP, COMMIT
to use it for your own purposes.
//main.jsconsole
Nuxt:
The plugin automatically create vue-cli-plugin-build-info.js
in your plugins directory and inject necessary import in your nuxt.config.js
. You need to extend your nuxt.config.js
in two places:
- Add the file path inside the
plugins
key of ournuxt.config.js
:
//nuxt.config.jsconst VueCliPluginBuildInfo =plugins: '~/plugins/vue-cli-plugin-build-info'
- Add imported plugin in
build
sectiontranspile
it:
//nuxt.config.jsconst VueCliPluginBuildInfo =build:transpile: 'vue-cli-plugin-build-info'plugins: VueCliPluginBuildInfo
Explanations:
Commit: Unable to retrieve commit information
- you do not init your local Git repository and your local directory doesn't have a .git folder
Licence
MIT