vue-cli-plugin-build-info
v0.1.12
Published
Vue-cli plugin that shows build information in console.
Downloads
168
Readme
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
:warning: Make sure you have vue-cli
vue --versionIf you don't have a project created with vue-cli yet:
vue create my-appNavigate 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-infoUsage
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
import { consoleBuildInfo } from 'vue-cli-plugin-build-info/plugin'
consoleBuildInfo()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.js
import {getBuildInfo} from 'vue-cli-plugin-build-info/plugin'
console.log(getBuildInfo().VERSION)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
pluginskey of ournuxt.config.js:
//nuxt.config.js
const VueCliPluginBuildInfo = require('vue-cli-plugin-build-info')
export default {
plugins: ['~/plugins/vue-cli-plugin-build-info']
}- Add imported plugin in
buildsectiontranspileit:
//nuxt.config.js
const VueCliPluginBuildInfo = require('vue-cli-plugin-build-info')
export default {
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
