Skip to content

Commit 449494f

Browse files
committedJan 10, 2018
cleanup client build setup
1 parent 6689cb8 commit 449494f

18 files changed

+273
-14
lines changed
 

‎.babelrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["env"]
3+
}

‎.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web_modules

‎.gitignore

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
npm-debug.log
22
node_modules
3-
/client/live.bundle.js
4-
/client/index.bundle.js
5-
/client/sockjs.bundle.js
3+
/client
64
/coverage
75
/ssl/*.pem
86
.idea/
File renamed without changes.
File renamed without changes.
File renamed without changes.

‎client-src/default/webpack.config.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict';
2+
3+
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
4+
5+
module.exports = {
6+
module: {
7+
rules: [
8+
{
9+
test: /\.js$/,
10+
exclude: /node_modules|web_modules/,
11+
use: [
12+
{
13+
loader: 'babel-loader'
14+
}
15+
]
16+
}
17+
]
18+
},
19+
plugins: [
20+
new UglifyJSPlugin()
21+
]
22+
};

‎client/live.js ‎client-src/live/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
const $ = require('jquery');
66
const stripAnsi = require('strip-ansi');
7-
const socket = require('./socket');
7+
const socket = require('../default/socket');
88
require('./style.css');
99

1010
let hot = false;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

‎client/webpack.config.js ‎client-src/live/webpack.config.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use strict';
22

3+
const path = require('path');
34
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
5+
const CopyPlugin = require('copy-webpack-plugin');
46

57
module.exports = {
68
module: {
@@ -10,10 +12,7 @@ module.exports = {
1012
exclude: /node_modules|web_modules/,
1113
use: [
1214
{
13-
loader: 'babel-loader',
14-
options: {
15-
presets: ['env']
16-
}
15+
loader: 'babel-loader'
1716
}
1817
]
1918
},
@@ -33,6 +32,10 @@ module.exports = {
3332
]
3433
},
3534
plugins: [
36-
new UglifyJSPlugin()
35+
new UglifyJSPlugin(),
36+
new CopyPlugin([{
37+
from: path.resolve(__dirname, 'live.html'),
38+
to: path.resolve(__dirname, '../../client/live.html')
39+
}])
3740
]
3841
};
File renamed without changes.
File renamed without changes.

‎package-lock.json

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

‎package.json

+8-5
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@
2222
"beautify": "npm run lint -- --fix",
2323
"ci": "npm run cover -- --report lcovonly && npm run test",
2424
"cover": "istanbul cover node_modules/mocha/bin/_mocha",
25-
"lint": "eslint bin lib test examples client/{index,live,socket,sockjs,overlay,webpack.config}.js",
25+
"lint": "eslint bin lib test examples client-src",
2626
"mocha": "mocha --full-trace --check-leaks",
27-
"prepublish": "(rm ssl/*.pem || true) && npm run -s build:live && npm run -s build:index && npm run -s build:sockjs",
27+
"prepare": "(rm ssl/*.pem || true) && npm run -s transpile:index && npm run -s build:live && npm run -s build:index && npm run -s build:sockjs",
2828
"test": "npm run lint && npm run mocha",
29-
"build:live": "webpack ./client/live.js client/live.bundle.js --color --config client/webpack.config.js",
30-
"build:index": "webpack ./client/index.js client/index.bundle.js --color --config client/webpack.config.js",
31-
"build:sockjs": "webpack ./client/sockjs.js client/sockjs.bundle.js --color --config client/webpack.sockjs.config.js",
29+
"transpile:index": "babel client-src/default --out-dir client --ignore *.config.js",
30+
"build:index": "webpack ./client-src/default/index.js client/index.bundle.js --color --config client-src/default/webpack.config.js",
31+
"build:live": "webpack ./client-src/live/index.js client/live.bundle.js --color --config client-src/live/webpack.config.js",
32+
"build:sockjs": "webpack ./client-src/sockjs/index.js client/sockjs.bundle.js --color --config client-src/sockjs/webpack.config.js",
3233
"webpack-dev-server": "cd $INIT_CWD && node ../../../bin/webpack-dev-server.js"
3334
},
3435
"files": [
@@ -70,10 +71,12 @@
7071
"yargs": "6.6.0"
7172
},
7273
"devDependencies": {
74+
"babel-cli": "^6.26.0",
7375
"babel-core": "^6.26.0",
7476
"babel-loader": "^7.1.2",
7577
"babel-preset-env": "^1.6.1",
7678
"codecov.io": "^0.1.6",
79+
"copy-webpack-plugin": "^4.3.1",
7780
"css-loader": "^0.28.5",
7881
"eslint": "^4.5.0",
7982
"eslint-config-webpack": "^1.2.5",

0 commit comments

Comments
 (0)