Skip to content
This repository was archived by the owner on Oct 2, 2020. It is now read-only.

Commit d922448

Browse files
committed
make build
1 parent 4450de3 commit d922448

12 files changed

+274
-43
lines changed

.babelrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"presets": ["es2015", "stage-2"],
3+
"plugins": ["transform-runtime"],
4+
"comments": false
5+
}

.eslintrc.js

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
module.exports = {
2+
root: true,
3+
"env": {
4+
"browser": true,
5+
"commonjs": true,
6+
"es6": true,
7+
"jquery": false,
8+
mocha: true
9+
},
10+
"extends": "eslint:recommended",
11+
"parserOptions": {
12+
"sourceType": "module"
13+
},
14+
"plugins": [
15+
"html"
16+
],
17+
"rules": {
18+
"indent": [
19+
"warn",
20+
"tab"
21+
],
22+
"quotes": [
23+
"warn",
24+
"double"
25+
],
26+
"semi": [
27+
"error",
28+
"always"
29+
],
30+
"no-var": [
31+
"error"
32+
],
33+
"no-console": [
34+
"off"
35+
],
36+
"no-unused-vars": [
37+
"warn"
38+
]
39+
}
40+
};

.gitignore

+9-37
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,9 @@
1-
# Logs
2-
logs
3-
*.log
4-
npm-debug.log*
5-
6-
# Runtime data
7-
pids
8-
*.pid
9-
*.seed
10-
11-
# Directory for instrumented libs generated by jscoverage/JSCover
12-
lib-cov
13-
14-
# Coverage directory used by tools like istanbul
15-
coverage
16-
17-
# nyc test coverage
18-
.nyc_output
19-
20-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
21-
.grunt
22-
23-
# node-waf configuration
24-
.lock-wscript
25-
26-
# Compiled binary addons (http://nodejs.org/api/addons.html)
27-
build/Release
28-
29-
# Dependency directories
30-
node_modules
31-
jspm_packages
32-
33-
# Optional npm cache directory
34-
.npm
35-
36-
# Optional REPL history
37-
.node_repl_history
1+
.DS_Store
2+
node_modules/
3+
coverage/
4+
docs/_book/
5+
npm-debug.log
6+
selenium-debug.log
7+
test/unit/coverage
8+
test/e2e/reports
9+
stats.json

.npmignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build
2+
docs
3+
bower.json

.travis.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
language: node_js
2+
cache:
3+
directories:
4+
- node_modules
5+
node_js:
6+
- "6"
7+
- "5"
8+
- "4"
9+
after_success:
10+
- npm run coverall

README.md

+35
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
# vue-websocket
22
Websocket plugin for VueJS. Support namespaces.
33

4+
## Install
5+
### NPM
6+
You can install it via [NPM](http://npmjs.org/).
7+
```
8+
$ npm install vue-websocket
9+
```
10+
### Manual
11+
Download zip package and unpack and add the `vue-websocket.js` file to your project from dist folder.
12+
```
13+
https://github.com/icebob/vue-websocket/archive/master.zip
14+
```
15+
416
## Usage
517
Register the plugin
618
```js
@@ -60,3 +72,26 @@ Use it in your components:
6072
6173
</script>
6274
```
75+
76+
## Build
77+
This command will build a distributable version in the `dist` directory.
78+
```bash
79+
npm run build
80+
```
81+
82+
## Test
83+
```bash
84+
npm test
85+
```
86+
87+
## Contribution
88+
Please send pull requests improving the usage and fixing bugs, improving documentation and providing better examples, or providing some testing, because these things are important.
89+
90+
## License
91+
vue-touch-keyboard is available under the [MIT license](https://tldrlegal.com/license/mit-license).
92+
93+
## Contact
94+
95+
Copyright (C) 2016 Icebob
96+
97+
[![@icebob](https://img.shields.io/badge/github-icebob-green.svg)](https://github.com/icebob) [![@icebob](https://img.shields.io/badge/twitter-Icebobcsi-blue.svg)](https://twitter.com/Icebobcsi)

dist/vue-websocket.js

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue-websocket.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"name": "vue-websocket",
3+
"version": "0.1.0",
4+
"description": "Websocket handler for Vue.js",
5+
"homepage": "https://github.com/icebob/vue-websocket",
6+
"main": "dist/vue-websocket.js",
7+
"scripts": {
8+
"_prebuild": "npm run test",
9+
"build": "webpack --progress -p --hide-modules --config webpack.build.config.js",
10+
"lint": "eslint --ext=.js,.vue src test/unit/specs",
11+
"coverall": "cat ./test/unit/coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
12+
"coverage": "npm run test && npm run coverall",
13+
"changelog": "conventional-changelog -i CHANGELOG.md -s",
14+
"unit": "karma start test/unit/karma.conf.js",
15+
"pretest": "npm run lint",
16+
"test": "npm run unit",
17+
"ci": "karma start test/unit/karma.conf.js --auto-watch --no-single-run --reporters=dots --port=9877"
18+
},
19+
"keywords": [
20+
"vue",
21+
"websocket",
22+
"socket",
23+
"socket.io"
24+
],
25+
"repository": {
26+
"type": "git",
27+
"url": "https://github.com/icebob/vue-websocket.git"
28+
},
29+
"files": [
30+
"dist",
31+
"src"
32+
],
33+
"author": "Icebob",
34+
"license": "MIT",
35+
"devDependencies": {
36+
"babel-core": "6.14.0",
37+
"babel-loader": "6.2.5",
38+
"babel-plugin-transform-runtime": "6.15.0",
39+
"babel-preset-es2015": "6.14.0",
40+
"babel-preset-stage-2": "6.5.0",
41+
"chai": "3.5.0",
42+
"conventional-changelog-cli": "1.2.0",
43+
"coveralls": "2.11.14",
44+
"eslint": "3.6.1",
45+
"eslint-friendly-formatter": "2.0.6",
46+
"eslint-loader": "1.5.0",
47+
"eslint-plugin-html": "1.5.3",
48+
"eslint-plugin-vue": "0.1.1",
49+
"isparta-loader": "2.0.0",
50+
"karma": "1.3.0",
51+
"karma-chai": "0.1.0",
52+
"karma-chrome-launcher": "1.0.1",
53+
"karma-coverage": "1.1.1",
54+
"karma-coveralls": "1.1.2",
55+
"karma-mocha": "1.2.0",
56+
"karma-phantomjs-launcher": "1.0.2",
57+
"karma-sinon-chai": "1.2.4",
58+
"karma-sourcemap-loader": "0.3.7",
59+
"karma-spec-reporter": "0.0.26",
60+
"karma-webpack": "1.8.0",
61+
"lodash": "4.16.2",
62+
"lolex": "1.5.1",
63+
"mocha": "2.5.3",
64+
"mocha-generators": "1.2.0",
65+
"mocha-loader": "0.7.1",
66+
"phantomjs-prebuilt": "2.1.12",
67+
"sinon": "1.17.6",
68+
"sinon-chai": "2.8.0",
69+
"vue-hot-reload-api": "1.3.2",
70+
"vue-loader": "8.5.4",
71+
"webpack": "1.13.2",
72+
"webpack-dev-middleware": "1.8.3",
73+
"webpack-dev-server": "1.16.1",
74+
"webpack-merge": "0.14.1"
75+
},
76+
"dependencies": {
77+
"babel-runtime": "6.11.6",
78+
"socket.io-client": "1.5.1",
79+
"vue": "1.0.27"
80+
}
81+
}

src/index.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import Vue from "vue";
21
import IO from "socket.io-client";
32

43
export default {
@@ -16,7 +15,7 @@ export default {
1615

1716
let addListeners = function() {
1817
if (this.$options.hasOwnProperty("socket")) {
19-
var conf = this.$options.socket;
18+
let conf = this.$options.socket;
2019
if (conf.namespace) {
2120
this.$socket = IO(conf.namespace, conf.options);
2221
}
@@ -30,11 +29,11 @@ export default {
3029
});
3130
}
3231
}
33-
}
32+
};
3433

3534
let removeListeners = function() {
3635
if (this.$options.hasOwnProperty("socket")) {
37-
var conf = this.$options.socket;
36+
let conf = this.$options.socket;
3837

3938
if (conf.namespace) {
4039
this.$socket.disconnect();
@@ -47,7 +46,7 @@ export default {
4746
});
4847
}
4948
}
50-
}
49+
};
5150

5251
Vue.mixin({
5352
beforeCompile: addListeners,
@@ -56,4 +55,4 @@ export default {
5655

5756
}
5857

59-
}
58+
};

webpack.build.config.js

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
var webpack = require("webpack");
2+
var version = require("./package.json").version;
3+
var banner = "/**\n" + " * vue-websocket v" + version + "\n" + " * https://github.com/icebob/vue-websocket\n" + " * Released under the MIT License.\n" + " */\n";
4+
5+
module.exports = [
6+
{
7+
devtool: "source-map",
8+
entry: "./src/index",
9+
output: {
10+
path: "./dist",
11+
filename: "vue-websocket.js",
12+
library: "VueWebsocket",
13+
libraryTarget: "umd"
14+
},
15+
16+
plugins: [
17+
new webpack.DefinePlugin({
18+
"process.env" : {
19+
NODE_ENV : JSON.stringify("production")
20+
}
21+
}),
22+
new webpack.optimize.UglifyJsPlugin({
23+
compress: {
24+
warnings: false
25+
}
26+
}),
27+
new webpack.optimize.DedupePlugin(),
28+
new webpack.BannerPlugin(banner, {
29+
raw: true
30+
})
31+
],
32+
33+
module: {
34+
loaders: [
35+
{
36+
"test": /\.js?$/,
37+
"exclude": /node_modules/,
38+
"loader": "babel"
39+
},
40+
{
41+
"test": /\.vue$/,
42+
"loader": "vue"
43+
}
44+
]
45+
}
46+
}
47+
48+
];

webpack.dev.config.js

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
var path = require("path");
2+
var webpack = require("webpack");
3+
4+
module.exports = {
5+
devtool: "eval-source-map",
6+
7+
entry: {
8+
app: path.resolve("dev", "main.js")
9+
},
10+
11+
output: {
12+
path: path.resolve("dev"),
13+
filename: "[name].js",
14+
publicPath: "/"
15+
},
16+
17+
plugins: [
18+
],
19+
20+
module: {
21+
loaders: [
22+
{
23+
"test": /\.js?$/,
24+
"exclude": /node_modules/,
25+
"loader": "babel"
26+
},
27+
{
28+
"test": /\.vue?$/,
29+
"loader": "vue"
30+
}
31+
]
32+
}
33+
};

0 commit comments

Comments
 (0)