diff --git a/.gitignore b/.gitignore index 91dd14b..7b1fb76 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,4 @@ node_modules coverage /lib/static/client.js -/lib/static/client.js.map.json +/lib/static/client.js.map diff --git a/package.json b/package.json index 5ac3835..5ee185b 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,12 @@ "gemini-gui": "./bin/gemini-gui" }, "scripts": { - "build-client": "browserify lib/client --debug -p [minifyify --compressPath . --map /client.js.map.json --output ./lib/static/client.js.map.json] -t hbsfy -o ./lib/static/client.js", + "build-client": "webpack", "prepublish": "npm run build-client", "test": "istanbul test _mocha --require ./test/setup.js test/*", - "lint": "jshint . && jscs ." + "lint": "jshint . && jscs .", + "precommit": "npm run lint", + "preversion": "npm run lint && npm test" }, "author": "Sergey Tatarintsev (https://github.com/SevInf)", "license": "MIT", @@ -27,17 +29,24 @@ "opener": "^1.4.0", "q": "^1.0.1", "q-io": "^1.11.4", + "react": "^0.14.7", + "react-dom": "^0.14.7", "resolve": "^1.0.0", "semver": "^3.0.1", "temp": "^0.8.1" }, "devDependencies": { - "browserify": "^5.11.1", + "babel-core": "^6.7.2", + "babel-loader": "^6.2.4", + "babel-preset-es2015": "^6.6.0", + "babel-preset-react": "^6.5.0", "chai": "^3.5.0", "chai-as-promised": "^5.2.0", "dirty-chai": "^1.2.2", "gemini": "^2.1.0", + "handlebars-loader": "^1.1.4", "hbsfy": "^2.1.0", + "husky": "^0.11.3", "istanbul": "^0.3.2", "jscs": "^1.6.2", "jshint": "^2.5.6", @@ -46,7 +55,7 @@ "proxyquire": "^1.7.3", "sinon": "^1.17.3", "sinon-chai": "^2.8.0", - "watchify": "^1.0.2" + "webpack": "^1.12.14" }, "directories": { "test": "test" diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..bfd5ce2 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,42 @@ +var webpack = require('webpack'); + +module.exports = { + debug: false, + devtool: 'source-map', + entry: './lib/client', + output: { + path: './lib/static', + filename: 'client.js' + }, + plugins: [ + new webpack.optimize.DedupePlugin(), + new webpack.optimize.OccurenceOrderPlugin(), + new webpack.optimize.UglifyJsPlugin({ + mangle: true, + compress: { + warnings: false // Suppress uglification warnings + } + }), + new webpack.DefinePlugin({ + 'process.env': { + NODE_ENV: JSON.stringify('production') + } + }) + ], + module: { + loaders: [ + { + test: /\.(js|jsx)$/, + loader: 'babel', + include: __dirname + '/lib/client', + query: { + presets: ['es2015', 'react'] + } + }, + { + test: /\.hbs$/, + loader: 'handlebars' + } + ] + } +};