Skip to content

Commit 3cf017a

Browse files
committed
use vuex
1 parent 1714eee commit 3cf017a

32 files changed

+141
-447
lines changed

.eslintrc

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

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ If you want to build a Vue app really really fast, use nether [VuePack](https://
1111
- Vue
1212
- Webpack
1313
- Babel 6
14-
- Redux
14+
- Vuex
1515
- Vue-Router
1616
- Hot reloading
17-
- PostCSS
18-
- PreCSS
17+
- PostCSS & cssnext
1918
- Autoprefixer
2019

2120
## Cli tool

package.json

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
"main": "index.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
8-
"dev": "NODE_ENV=development HOT=1 VUEPACK_PORT=3030 node scripts/devServer.js",
8+
"dev": "cross-env NODE_ENV=development HOT=1 NODE_PORT=3030 node scripts/devServer.js",
99
"build": "rm -rf ./build && webpack -p --config scripts/webpack.config.prod.js",
10-
"publish:demo": "npm run build && surge -d vuepack.surge.sh -p build",
11-
"dev:win": "set NODE_ENV=development && set HOT=1 && set VUEPACK_PORT=3030 && node scripts/devServer.js"
10+
"publish:demo": "npm run build && surge -d vuepack.surge.sh -p build"
1211
},
1312
"repository": {
1413
"type": "git",
@@ -35,29 +34,24 @@
3534
"babel-plugin-transform-runtime": "^6.3.13",
3635
"babel-preset-es2015": "^6.3.13",
3736
"babel-preset-stage-0": "^6.3.13",
38-
"babel-runtime": "^5.8.0",
37+
"babel-runtime": "^5.8.38",
38+
"cross-env": "^1.0.7",
3939
"css-loader": "^0.23.0",
40-
"express": "^4.13.3",
4140
"extract-text-webpack-plugin": "^0.9.1",
4241
"html-webpack-plugin": "^1.7.0",
42+
"postcss-cssnext": "^2.5.2",
4343
"postcss-loader": "^0.8.0",
4444
"style-loader": "^0.13.0",
4545
"vue-hot-reload-api": "^1.2.2",
4646
"vue-html-loader": "^1.0.0",
47-
"vue-loader": "^7.1.7",
47+
"vue-loader": "^8.2.3",
4848
"vue-router": "^0.7.7",
49-
"webpack": "^1.12.9",
50-
"webpack-dev-middleware": "^1.4.0",
51-
"webpack-hot-middleware": "^2.6.0"
49+
"vue-style-loader": "^1.0.0",
50+
"webpack": "^1.13.0",
51+
"webpack-hot-server": "^0.3.6"
5252
},
5353
"dependencies": {
54-
"moment": "^2.10.6",
55-
"redux": "^3.0.4",
56-
"redux-actions": "^0.9.0",
57-
"redux-devtools": "^2.1.5",
58-
"redux-thunk": "^1.0.0",
59-
"revue": "^1.2.5",
60-
"postcss-cssnext": "^2.5.2",
61-
"vue": "latest"
54+
"vue": "^1.0.21",
55+
"vuex": "^0.6.3"
6256
}
6357
}

scripts/devServer.js

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,13 @@
1-
var path = require('path')
2-
var express = require('express')
3-
var webpack = require('webpack')
4-
var config = require('./webpack.config.dev')
5-
6-
var app = express()
7-
var compiler = webpack(config)
8-
if (process.env.HOT) {
9-
// options for dev env
10-
}
11-
12-
app.use(require('webpack-dev-middleware')(compiler, {
13-
publicPath: config.output.publicPath,
14-
stats: {
15-
colors: true
16-
}
17-
}))
18-
19-
app.use(require('webpack-hot-middleware')(compiler))
20-
21-
app.set('port', process.env.VUEPACK_PORT || 3000)
22-
app.listen(app.get('port'), 'localhost', function(err) {
23-
if (err) {
24-
console.log(err)
25-
return
26-
}
27-
console.log('Listening at http://localhost:' + app.get('port'))
1+
'use strict'
2+
const path = require('path')
3+
const server = require('webpack-hot-server')
4+
const config = require('./webpack.config.dev')
5+
6+
const port = process.env.NODE_PORT || 3030
7+
server({
8+
port,
9+
customIndex: path.join(process.cwd(), 'build'),
10+
config
11+
}).then(() => {
12+
console.log(`Running at http://localhost:${port}`)
2813
})

scripts/index.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,5 @@
1616
{% for (var chunk in o.htmlWebpackPlugin.files.chunks) { %}
1717
<script src="{%=o.htmlWebpackPlugin.files.chunks[chunk].entry %}"></script>
1818
{% } %}
19-
{% if (o.webpackConfig.watch) { %}
20-
<script src="https://npmcdn.com/redux-devtools-script"></script>
21-
{% } %}
2219
</body>
2320
</html>

scripts/webpack.config.dev.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@ var webpack = require('webpack')
22
var config = require('./webpack.config')
33
var path = require('path')
44

5-
config.debug = true
6-
config.watch = true
7-
config.output.publicPath = '/'
8-
config.output.path= process.cwd()
95
config.entry.push('webpack-hot-middleware/client')
10-
config.devtool = 'cheap-module-eval-source-map'
6+
config.devtool = 'inline-eval-cheap-source-map'
117
config.plugins = [
128
new webpack.HotModuleReplacementPlugin(),
139
new webpack.NoErrorsPlugin(),

scripts/webpack.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ var HtmlWebpackPlugin = require('html-webpack-plugin')
55
module.exports = {
66
entry: ['./src/main.js'],
77
output: {
8-
path: path.resolve('./build'),
8+
path: path.join(process.cwd(), 'build/assets'),
99
filename: 'bundle.js',
10-
publicPath: '/build/'
10+
publicPath: '/assets/'
1111
},
1212
resolve: {
1313
extensions: ['', '.js', '.vue', '.css']
@@ -32,7 +32,7 @@ module.exports = {
3232
},
3333
plugins: [
3434
new HtmlWebpackPlugin({
35-
filename: './index.html',
35+
filename: path.join(process.cwd(), 'build/index.html'),
3636
title: 'VuePack',
3737
template: __dirname + '/index.html'
3838
})

scripts/webpack.config.prod.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var ExtractTextPlugin = require('extract-text-webpack-plugin')
55

66
config.devtool = 'source-map'
77
config.output.filename = 'bundle.[hash].js'
8-
config.output.publicPath = './'
8+
config.output.publicPath = './assets/'
99
config.plugins = [
1010
new webpack.optimize.OccurenceOrderPlugin(),
1111
new webpack.DefinePlugin({
@@ -17,12 +17,16 @@ config.plugins = [
1717
new webpack.optimize.UglifyJsPlugin({
1818
compressor: {
1919
warnings: false
20-
}
20+
},
21+
comments: false
2122
}),
2223
new ExtractTextPlugin('[name].[contenthash].css')
2324
].concat(config.plugins)
2425
config.vue.loaders = {
25-
css: ExtractTextPlugin.extract('style-loader', 'css-loader')
26+
css: ExtractTextPlugin.extract(
27+
'vue-style-loader',
28+
'css-loader?sourceMap'
29+
)
2630
}
2731

2832
module.exports = config

src/actions/index.js

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

src/actions/todoFilter.js

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

0 commit comments

Comments
 (0)