Skip to content

Commit b374bc1

Browse files
committed
Initial commit
0 parents  commit b374bc1

File tree

11 files changed

+4052
-0
lines changed

11 files changed

+4052
-0
lines changed

.babelrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"presets": [
3+
["env", { "modules": false }],
4+
"stage-2"
5+
]
6+
}

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
trim_trailing_whitespace = true
7+
indent_style = space
8+
indent_size = 2
9+
10+
[*.md]
11+
trim_trailing_whitespace = false
12+
indent_size = 4

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/node_modules

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Vuex ORM Examples
2+
3+
The example application to demonstrate the use case of the [Vuex ORM](https://github.com/revolver-app/vuex-orm).

package.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"private": true,
3+
"scripts": {
4+
"dev": "node server.js",
5+
"build": "NODE_ENV=production webpack"
6+
},
7+
"devDependencies": {
8+
"babel-core": "^6.26.0",
9+
"babel-loader": "^7.1.2",
10+
"babel-preset-env": "^1.6.1",
11+
"babel-preset-stage-2": "^6.24.1",
12+
"css-loader": "^0.28.8",
13+
"express": "^4.16.2",
14+
"vue": "^2.5.13",
15+
"vue-loader": "^13.7.0",
16+
"vue-template-compiler": "^2.5.13",
17+
"vuex": "^3.0.1",
18+
"vuex-orm": "^0.15.0",
19+
"webpack": "^3.10.0",
20+
"webpack-dev-middleware": "^2.0.4",
21+
"webpack-hot-middleware": "^2.21.0"
22+
}
23+
}

public/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!doctype html>
2+
<html lang="en_US">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<title>Vuex ORM – ToDo</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
12+
<script src="/js/main.js"></script>
13+
</body>
14+
</html>

server.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const path = require('path')
2+
const express = require('express')
3+
const webpack = require('webpack')
4+
const webpackDevMiddleware = require('webpack-dev-middleware')
5+
const webpackHotMiddleware = require('webpack-hot-middleware')
6+
const WebpackConfig = require('./webpack.config')
7+
8+
const rootDir = path.join(__dirname, '.')
9+
10+
const app = express()
11+
const compiler = webpack(WebpackConfig)
12+
13+
app.use(webpackDevMiddleware(compiler, {
14+
publicPath: '/js',
15+
stats: {
16+
colors: true,
17+
chunks: false
18+
}
19+
}))
20+
21+
app.use(webpackHotMiddleware(compiler))
22+
23+
app.use(express.static('public'))
24+
25+
module.exports = app.listen(3000, () => {
26+
console.log(`Server listening on http://localhost:3000, Ctrl+C to stop`)
27+
})

src/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('Hello, world!')

webpack.config.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
const path = require('path')
2+
const webpack = require('webpack')
3+
4+
const rootDir = path.join(__dirname, '.')
5+
6+
const config = {
7+
devtool: 'inline-source-map',
8+
9+
entry: {
10+
main: ['webpack-hot-middleware/client', `${rootDir}/src/app.js`]
11+
},
12+
13+
output: {
14+
path: `${rootDir}/js`,
15+
filename: '[name].js',
16+
publicPath: '/public/js/'
17+
},
18+
19+
module: {
20+
rules: [
21+
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' },
22+
{ test: /\.vue$/, exclude: /node_modules/, loader: 'vue-loader' }
23+
]
24+
},
25+
26+
plugins: [
27+
new webpack.DefinePlugin({
28+
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
29+
})
30+
]
31+
}
32+
33+
if (process.env.NODE_ENV === 'production') {
34+
config.entry.main.shift()
35+
config.output.path = `${rootDir}/public/js`
36+
37+
config.plugins.push(
38+
new webpack.optimize.UglifyJsPlugin({
39+
compress: { warnings: false }
40+
})
41+
)
42+
} else {
43+
config.plugins.push(new webpack.HotModuleReplacementPlugin())
44+
config.plugins.push(new webpack.NoEmitOnErrorsPlugin())
45+
}
46+
47+
module.exports = config

0 commit comments

Comments
 (0)