Skip to content

Commit

Permalink
adjust build setup
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Aug 3, 2016
1 parent d82a789 commit 7d89380
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 353 deletions.
72 changes: 0 additions & 72 deletions build/build.js

This file was deleted.

16 changes: 16 additions & 0 deletions build/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const buble = require('rollup-plugin-buble')
const version = process.env.VERSION || require('../package.json').version

module.exports = {
entry: 'src/index.js',
dest: 'dist/vuex.js',
format: 'umd',
moduleName: 'Vuex',
plugins: [buble()],
banner:
`/**
* vuex v${version}
* (c) ${new Date().getFullYear()} Evan You
* @license MIT
*/`
}
2 changes: 1 addition & 1 deletion examples/chat/vuex/store.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Vue from 'vue'
import Vuex from '../../../src'
import Vuex from 'vuex'
import * as getters from './getters'
import * as actions from './actions'
import mutations from './mutations'
Expand Down
2 changes: 1 addition & 1 deletion examples/shopping-cart/vuex/store.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Vue from 'vue'
import Vuex from '../../../src'
import Vuex from 'vuex'
import * as actions from './actions'
import * as getters from './getters'
import cart from './modules/cart'
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
],
"scripts": {
"dev": "node examples/server.js",
"dev:dist": "rollup -wm -c build/rollup.config.js",
"build": "rollup -c build/rollup.config.js && uglifyjs dist/vuex.js -cm --comments -o dist/vuex.min.js",
"test": "eslint src && npm run test:unit && npm run test:e2e",
"test:unit": "jasmine JASMINE_CONFIG_PATH=test/unit/jasmine.json",
"test:unit": "rollup -c build/rollup.config.js && jasmine JASMINE_CONFIG_PATH=test/unit/jasmine.json",
"test:e2e": "node test/e2e/runner.js",
"build": "node build/build.js",
"release": "bash build/release.sh",
"docs": "cd docs && gitbook serve",
"docs:deploy": "cd docs && ./deploy.sh"
Expand Down Expand Up @@ -48,7 +49,8 @@
"nightwatch-helpers": "^1.1.0",
"phantomjs-prebuilt": "^2.1.7",
"rollup": "^0.34.1",
"rollup-plugin-babel": "^2.4.0",
"rollup-plugin-buble": "^0.12.1",
"rollup-watch": "^2.5.0",
"selenium-server": "^2.53.1",
"todomvc-app-css": "^2.0.3",
"uglify-js": "^2.6.2",
Expand Down
4 changes: 2 additions & 2 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function mapMutations (mutations) {
const res = {}
normalizeMap(mutations).forEach(({ key, val }) => {
res[key] = function mappedMutation (...args) {
return this.$store.commit(val, ...args)
return this.$store.commit.apply(this.$store, [val].concat(args))
}
})
return res
Expand All @@ -37,7 +37,7 @@ export function mapActions (actions) {
const res = {}
normalizeMap(actions).forEach(({ key, val }) => {
res[key] = function mappedAction (...args) {
return this.$store.dispatch(val, ...args)
return this.$store.dispatch.apply(this.$store, [val].concat(args))
}
})
return res
Expand Down
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ function initModule (store, path, module, hot) {
// set state
if (!isRoot && !hot) {
const parentState = getNestedState(store.state, path.slice(0, -1))
if (!parentState) debugger
const moduleName = path[path.length - 1]
Vue.set(parentState, moduleName, state || {})
}
Expand Down
Loading

0 comments on commit 7d89380

Please sign in to comment.