Skip to content

Commit a9bf69d

Browse files
committed
feat: distribution should have a version #129
closes #129
1 parent 9b1395a commit a9bf69d

File tree

6 files changed

+50
-11
lines changed

6 files changed

+50
-11
lines changed

components/base/auto-init.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
export function autoInit (plugin) {
2-
// Auto-install
3-
let _Vue = null
4-
if (typeof window !== 'undefined') {
5-
_Vue = window.Vue
6-
} else if (typeof global !== 'undefined') {
7-
/*global global*/
8-
_Vue = global.Vue
9-
}
10-
if (_Vue) {
11-
_Vue.use(plugin)
12-
}
2+
// Auto-install
3+
let _Vue = null
4+
if (typeof window !== 'undefined') {
5+
_Vue = window.Vue
6+
} else if (typeof global !== 'undefined') {
7+
/*global global*/
8+
_Vue = global.Vue
139
}
10+
if (_Vue) {
11+
_Vue.use(plugin)
12+
}
13+
}
1414

components/base/base-plugin.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export function BasePlugin (components) {
22
return {
3+
version: '__VERSION__',
34
install: (vm) => {
45
for (let key in components) {
56
let component = components[key]

components/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import VueMDCToolbar from './toolbar'
2929
import VueMDCTypography from './typography'
3030

3131
export default {
32+
version: '__VERSION__',
3233
install (vm) {
3334
vm.use(VueMDCButton)
3435
vm.use(VueMDCCard)

package-lock.json

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
"rollup-plugin-babel": "^3.0.2",
114114
"rollup-plugin-commonjs": "^8.2.6",
115115
"rollup-plugin-node-resolve": "^3.0.0",
116+
"rollup-plugin-replace": "^2.0.0",
116117
"rollup-plugin-sass": "^0.5.3",
117118
"rollup-plugin-uglify": "^2.0.1",
118119
"rollup-plugin-vue": "^3.0.0",

rollup.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import postcss from 'postcss'
1111
import csso from 'postcss-csso';
1212
import { minify } from 'uglify-es'
1313
import pkg from './package.json';
14+
import replace from 'rollup-plugin-replace'
1415

1516
const PLUGINS = [
1617
'button',
@@ -137,6 +138,9 @@ function createUmdConfig(module, env, extract) {
137138
sass(sassConfig),
138139
babel(babelConfig),
139140
commonjs(),
141+
replace({
142+
__VERSION__: pkg.version
143+
}),
140144
],
141145
onwarn
142146
}
@@ -216,6 +220,9 @@ function createEsmConfig(module) {
216220
resolve({ jsnext: true, main: true, browser: true }),
217221
babel(babelConfig),
218222
commonjs(),
223+
replace({
224+
__VERSION__: pkg.version
225+
}),
219226
],
220227
onwarn
221228
}

0 commit comments

Comments
 (0)