Merge branch 'hotfix/minification'

* hotfix/minification:
  ⬆️ Update npm version
  💎 Release new version v2.3.0
  📝 Update README
   Add mixins to alias
  ⬆️ Update dependencies
  Change mixins exports to be seperate
This commit is contained in:
Jakub Juszczak
2016-12-17 18:20:03 +01:00
9 changed files with 411 additions and 460 deletions

View File

@@ -100,11 +100,58 @@ However you can simply implement this by your own or use one of the two mixins w
- `reactiveProp` - `reactiveProp`
- `reactiveData` - `reactiveData`
Both are included in the `mixins` module.
The mixins automatically create `chartData` as a prop or data. And add a watcher. If data has changed, the chart will update. The mixins automatically create `chartData` as a prop or data. And add a watcher. If data has changed, the chart will update.
```javascript ```javascript
// MonthlyIncome.js // MonthlyIncome.js
import { Line, reactiveProp } from 'vue-chartjs' import { Line, mixins } from 'vue-chartjs'
export default Line.extend({
mixins: [mixins.reactiveProp],
props: ["chartData", "options"],
mounted () {
this.renderChart(this.chartData, this.options)
}
})
```
### Mixins module
The `mixins` module is included in the `VueCharts` module and as a seperate module.
Some ways to import them:
```javascript
// Load complete module with all charts
import VueCharts from 'vue-chartjs'
export default VueCharts.Line.extend({
mixins: [VueCharts.mixins.reactiveProp],
props: ["chartData", "options"],
mounted () {
this.renderChart(this.chartData, this.options)
}
})
```
```javascript
// Load speperate modules
import { Line, mixins } from 'vue-chartjs'
export default Line.extend({
mixins: [mixins.reactiveProp],
props: ["chartData", "options"],
mounted () {
this.renderChart(this.chartData, this.options)
}
})
```
```javascript
// Load speperate modules with destructure assign
import { Line, mixins } from 'vue-chartjs'
const { reactiveProp } = mixins
export default Line.extend({ export default Line.extend({
mixins: [reactiveProp], mixins: [reactiveProp],
@@ -113,7 +160,6 @@ export default Line.extend({
this.renderChart(this.chartData, this.options) this.renderChart(this.chartData, this.options)
} }
}) })
``` ```
## Available Charts ## Available Charts

View File

@@ -16,8 +16,9 @@ module.exports = {
extensions: ['', '.js', '.vue'], extensions: ['', '.js', '.vue'],
fallback: [path.join(__dirname, '../node_modules')], fallback: [path.join(__dirname, '../node_modules')],
alias: { alias: {
'vue': 'vue/dist/vue.js', 'vue': 'vue/dist/vue.common.js',
'src': path.resolve(__dirname, '../src'), 'src': path.resolve(__dirname, '../src'),
'mixins': path.resolve(__dirname, '../src/mixins'),
'BaseCharts': path.resolve(__dirname, '../src/BaseCharts') 'BaseCharts': path.resolve(__dirname, '../src/BaseCharts')
} }
}, },

View File

@@ -1,6 +1,9 @@
const webpack = require('webpack') const webpack = require('webpack')
const base = require('./webpack.base.conf') const base = require('./webpack.base.conf')
const config = require('../config') const config = require('../config')
var env = process.env.NODE_ENV === 'testing'
? require('../config/test.env')
: config.build.env
base.entry = { base.entry = {
lib: './src/index.js' lib: './src/index.js'
@@ -19,9 +22,7 @@ var webpackConfig = Object.assign({}, base)
webpackConfig.devtool = '#source-map' webpackConfig.devtool = '#source-map'
webpackConfig.plugins = (webpackConfig.plugins || []).concat([ webpackConfig.plugins = (webpackConfig.plugins || []).concat([
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': { 'process.env.NODE_ENV': env
NODE_ENV: '"production"'
}
}), }),
new webpack.optimize.UglifyJsPlugin({ new webpack.optimize.UglifyJsPlugin({
compress: { warnings: false } compress: { warnings: false }

34
dist/vue-chartjs.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
{ {
"name": "vue-chartjs", "name": "vue-chartjs",
"version": "2.2.1", "version": "2.3.0",
"description": "Vue wrapper for chart.js", "description": "vue.js wrapper for chart.js",
"author": "Jakub Juszczak <jakub@nextindex.de>", "author": "Jakub Juszczak <jakub@nextindex.de>",
"repository": { "repository": {
"type": "git", "type": "git",
@@ -26,8 +26,8 @@
}, },
"dependencies": { "dependencies": {
"babel-runtime": "^6.11.6", "babel-runtime": "^6.11.6",
"chart.js": "^2.2.1", "chart.js": "^2.4.0",
"vue": "^2.0.1" "vue": "^2.1.6"
}, },
"devDependencies": { "devDependencies": {
"babel-core": "^6.10.4", "babel-core": "^6.10.4",
@@ -38,14 +38,14 @@
"chai": "^3.5.0", "chai": "^3.5.0",
"chromedriver": "^2.21.2", "chromedriver": "^2.21.2",
"connect-history-api-fallback": "^1.1.0", "connect-history-api-fallback": "^1.1.0",
"cross-spawn": "^4.0.2", "cross-spawn": "^5.0.1",
"css-loader": "^0.25.0", "css-loader": "^0.26.1",
"eslint": "^3.7.1", "eslint": "^3.7.1",
"eslint-config-standard": "^6.2.0", "eslint-config-standard": "^6.2.0",
"eslint-friendly-formatter": "^2.0.5", "eslint-friendly-formatter": "^2.0.5",
"eslint-loader": "^1.3.0", "eslint-loader": "^1.3.0",
"eslint-plugin-html": "^1.3.0", "eslint-plugin-html": "^1.3.0",
"eslint-plugin-promise": "^2.0.1", "eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^2.0.1", "eslint-plugin-standard": "^2.0.1",
"eventsource-polyfill": "^0.9.6", "eventsource-polyfill": "^0.9.6",
"express": "^4.13.3", "express": "^4.13.3",
@@ -54,7 +54,7 @@
"function-bind": "^1.0.2", "function-bind": "^1.0.2",
"html-webpack-plugin": "^2.8.1", "html-webpack-plugin": "^2.8.1",
"http-proxy-middleware": "^0.17.2", "http-proxy-middleware": "^0.17.2",
"inject-loader": "^2.0.1", "inject-loader": "^3.0.0-beta2",
"isparta-loader": "^2.0.0", "isparta-loader": "^2.0.0",
"jasmine-core": "^2.5.2", "jasmine-core": "^2.5.2",
"json-loader": "^0.5.4", "json-loader": "^0.5.4",
@@ -73,18 +73,18 @@
"nightwatch": "^0.9.8", "nightwatch": "^0.9.8",
"ora": "^0.3.0", "ora": "^0.3.0",
"phantomjs-prebuilt": "^2.1.13", "phantomjs-prebuilt": "^2.1.13",
"selenium-server": "^2.53.1", "selenium-server": "^3.0.1",
"shelljs": "^0.7.4", "shelljs": "^0.7.4",
"sinon": "^1.17.3", "sinon": "^1.17.3",
"sinon-chai": "^2.8.0", "sinon-chai": "^2.8.0",
"url-loader": "^0.5.7", "url-loader": "^0.5.7",
"vue-hot-reload-api": "^2.0.6", "vue-hot-reload-api": "^2.0.6",
"vue-html-loader": "^1.2.3", "vue-html-loader": "^1.2.3",
"vue-loader": "^9.3.0", "vue-loader": "^10.0.2",
"vue-style-loader": "^1.0.0", "vue-style-loader": "^1.0.0",
"webpack": "^1.13.2", "webpack": "^1.13.2",
"webpack-dev-middleware": "^1.4.0", "webpack-dev-middleware": "^1.4.0",
"webpack-hot-middleware": "^2.6.0", "webpack-hot-middleware": "^2.6.0",
"webpack-merge": "^0.14.1" "webpack-merge": "^1.1.1"
} }
} }

View File

@@ -5,8 +5,7 @@ import Pie from './BaseCharts/Pie'
import PolarArea from './BaseCharts/PolarArea' import PolarArea from './BaseCharts/PolarArea'
import Radar from './BaseCharts/Radar' import Radar from './BaseCharts/Radar'
import Bubble from './BaseCharts/Bubble' import Bubble from './BaseCharts/Bubble'
import reactiveProp from './mixins/reactiveProp' import mixins from './mixins/index.js'
import reactiveData from './mixins/reactiveData'
const VueCharts = { const VueCharts = {
Bar, Bar,
@@ -16,8 +15,19 @@ const VueCharts = {
PolarArea, PolarArea,
Radar, Radar,
Bubble, Bubble,
reactiveProp, mixins
reactiveData
} }
module.exports = VueCharts export default VueCharts
export {
VueCharts,
Bar,
Doughnut,
Line,
Pie,
PolarArea,
Radar,
Bubble,
mixins
}

7
src/mixins/index.js Normal file
View File

@@ -0,0 +1,7 @@
import reactiveData from './reactiveData.js'
import reactiveProp from './reactiveProp.js'
export default {
reactiveData,
reactiveProp
}

726
yarn.lock

File diff suppressed because it is too large Load Diff