Skip to content

Commit 7d89380

Browse files
committed
adjust build setup
1 parent d82a789 commit 7d89380

File tree

9 files changed

+26
-353
lines changed

9 files changed

+26
-353
lines changed

build/build.js

Lines changed: 0 additions & 72 deletions
This file was deleted.

build/rollup.config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const buble = require('rollup-plugin-buble')
2+
const version = process.env.VERSION || require('../package.json').version
3+
4+
module.exports = {
5+
entry: 'src/index.js',
6+
dest: 'dist/vuex.js',
7+
format: 'umd',
8+
moduleName: 'Vuex',
9+
plugins: [buble()],
10+
banner:
11+
`/**
12+
* vuex v${version}
13+
* (c) ${new Date().getFullYear()} Evan You
14+
* @license MIT
15+
*/`
16+
}

examples/chat/vuex/store.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Vue from 'vue'
2-
import Vuex from '../../../src'
2+
import Vuex from 'vuex'
33
import * as getters from './getters'
44
import * as actions from './actions'
55
import mutations from './mutations'

examples/shopping-cart/vuex/store.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Vue from 'vue'
2-
import Vuex from '../../../src'
2+
import Vuex from 'vuex'
33
import * as actions from './actions'
44
import * as getters from './getters'
55
import cart from './modules/cart'

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
],
1111
"scripts": {
1212
"dev": "node examples/server.js",
13+
"dev:dist": "rollup -wm -c build/rollup.config.js",
14+
"build": "rollup -c build/rollup.config.js && uglifyjs dist/vuex.js -cm --comments -o dist/vuex.min.js",
1315
"test": "eslint src && npm run test:unit && npm run test:e2e",
14-
"test:unit": "jasmine JASMINE_CONFIG_PATH=test/unit/jasmine.json",
16+
"test:unit": "rollup -c build/rollup.config.js && jasmine JASMINE_CONFIG_PATH=test/unit/jasmine.json",
1517
"test:e2e": "node test/e2e/runner.js",
16-
"build": "node build/build.js",
1718
"release": "bash build/release.sh",
1819
"docs": "cd docs && gitbook serve",
1920
"docs:deploy": "cd docs && ./deploy.sh"
@@ -48,7 +49,8 @@
4849
"nightwatch-helpers": "^1.1.0",
4950
"phantomjs-prebuilt": "^2.1.7",
5051
"rollup": "^0.34.1",
51-
"rollup-plugin-babel": "^2.4.0",
52+
"rollup-plugin-buble": "^0.12.1",
53+
"rollup-watch": "^2.5.0",
5254
"selenium-server": "^2.53.1",
5355
"todomvc-app-css": "^2.0.3",
5456
"uglify-js": "^2.6.2",

src/helpers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function mapMutations (mutations) {
1414
const res = {}
1515
normalizeMap(mutations).forEach(({ key, val }) => {
1616
res[key] = function mappedMutation (...args) {
17-
return this.$store.commit(val, ...args)
17+
return this.$store.commit.apply(this.$store, [val].concat(args))
1818
}
1919
})
2020
return res
@@ -37,7 +37,7 @@ export function mapActions (actions) {
3737
const res = {}
3838
normalizeMap(actions).forEach(({ key, val }) => {
3939
res[key] = function mappedAction (...args) {
40-
return this.$store.dispatch(val, ...args)
40+
return this.$store.dispatch.apply(this.$store, [val].concat(args))
4141
}
4242
})
4343
return res

src/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ function initModule (store, path, module, hot) {
253253
// set state
254254
if (!isRoot && !hot) {
255255
const parentState = getNestedState(store.state, path.slice(0, -1))
256-
if (!parentState) debugger
257256
const moduleName = path[path.length - 1]
258257
Vue.set(parentState, moduleName, state || {})
259258
}

0 commit comments

Comments
 (0)