Skip to content

Commit 7266829

Browse files
committed
Update eslint/webpack config + remove unused dependency
1 parent 85f8b35 commit 7266829

File tree

3 files changed

+36
-22
lines changed

3 files changed

+36
-22
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"key-spacing": [2, { "beforeColon": false, "afterColon": true }],
5555
"linebreak-style": 0,
5656
"max-depth": 0,
57-
"max-len": [2, 120, 4],
57+
"max-len": [2, 160, 4],
5858
"max-nested-callbacks": 0,
5959
"max-params": 0,
6060
"max-statements": 0,

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
"description": "Parse Java stack traces and transform them into comprehensive JS objects",
55
"main": "lib/java-stack-parser.js",
66
"scripts": {
7-
"build": "webpack --mode=build",
8-
"dev": "webpack --progress --colors --watch --mode=dev",
7+
"build": "webpack --bail",
98
"test": "mocha --compilers js:babel-core/register --colors src/*.spec.js",
109
"coverage": "istanbul cover node_modules/mocha/bin/_mocha -- --compilers js:babel-core/register --colors --reporter dot src/*.spec.js"
1110
},
@@ -37,7 +36,6 @@
3736
"eslint-loader": "^1.6.0",
3837
"istanbul": "^1.0.0-alpha.2",
3938
"mocha": "^3.1.2",
40-
"webpack": "^1.13.2",
41-
"yargs": "^6.3.0"
39+
"webpack": "^1.13.2"
4240
}
4341
}

webpack.config.js

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
var webpack = require('webpack');
2-
var UglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
1+
var env = process.env.NODE_ENV || 'development';
32
var path = require('path');
4-
var env = require('yargs').argv.mode;
53
var pkg = require('./package.json');
4+
var webpack = require('webpack');
5+
var UglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
66

7-
var plugins = [], outputFile;
8-
9-
if (env === 'build') {
10-
plugins.push(new UglifyJsPlugin({ minimize: true }));
11-
outputFile = pkg.name + '.min.js';
12-
} else {
13-
outputFile = pkg.name + '.js';
14-
}
7+
var banner = [
8+
pkg.name + ' by ' + pkg.author,
9+
pkg.homepage,
10+
'Version: ' + pkg.version + ' - ' + new Date().getTime(),
11+
'License: ' + pkg.license
12+
].join('\n');
1513

1614
var config = {
1715
entry: __dirname + '/src/index.js',
1816
devtool: 'source-map',
1917
output: {
2018
path: __dirname + '/lib',
21-
filename: outputFile,
19+
filename: pkg.name + (env === 'production' ? '.min' : '') + '.js',
2220
library: pkg.name,
2321
libraryTarget: 'umd',
2422
umdNamedDefine: true
2523
},
2624
module: {
27-
loaders: [
25+
preLoaders: [
2826
{
2927
test: /\.js$/,
30-
loader: 'babel',
28+
loader: 'eslint',
3129
exclude: /node_modules/
32-
},
30+
}
31+
],
32+
loaders: [
3333
{
3434
test: /\.js$/,
35-
loader: "eslint-loader",
35+
loader: 'babel',
3636
exclude: /node_modules/
3737
}
3838
]
@@ -41,7 +41,23 @@ var config = {
4141
root: path.resolve('./src'),
4242
extensions: ['', '.js']
4343
},
44-
plugins: plugins
44+
plugins: [
45+
new webpack.BannerPlugin(banner)
46+
]
4547
};
4648

49+
if (env === 'production') {
50+
config.plugins.push(new UglifyJsPlugin({
51+
mangle: true,
52+
compress: {
53+
drop_console: true,
54+
drop_debugger: true,
55+
warnings: false
56+
}
57+
}));
58+
outputFile = pkg.name + '.min.js';
59+
} else {
60+
config.watch = true;
61+
}
62+
4763
module.exports = config;

0 commit comments

Comments
 (0)