diff --git a/package.json b/package.json index ab4f042..4c1ffee 100644 --- a/package.json +++ b/package.json @@ -20,27 +20,23 @@ }, "homepage": "https://github.com/instructure-react/rackt-cli", "dependencies": { - "browserify": "^6.3.3", - "browserify-shim": "^3.8.0", - "envify": "^3.2.0", - "jsx-loader": "^0.12.2", - "karma": "^0.12.28", - "karma-browserify": "^1.0.0", - "karma-chrome-launcher": "^0.1.6", + "babel-core": "^5.5.6", + "babel-loader": "^5.1.4", + "karma": "^0.12.36", + "karma-browserify": "^4.2.1", + "karma-chrome-launcher": "^0.1.12", "karma-cli": "0.0.4", - "karma-firefox-launcher": "^0.1.3", - "karma-ie-launcher": "^0.1.5", - "karma-mocha": "^0.1.9", + "karma-firefox-launcher": "^0.1.6", + "karma-ie-launcher": "^0.2.0", + "karma-mocha": "^0.1.10", "karma-opera-launcher": "^0.1.0", - "karma-phantomjs-launcher": "^0.1.4", + "karma-phantomjs-launcher": "^0.2.0", "karma-safari-launcher": "^0.1.1", - "minimist": "^1.1.0", - "mocha": "^2.0.1", - "react": "^0.12.1", - "reactify": "^0.17.1", + "minimist": "^1.1.1", + "mocha": "^2.2.5", + "react": "^0.13.3", "rf-release": "^0.4.0", - "uglify-js": "^2.4.15", - "webpack": "^1.4.13", - "webpack-dev-server": "^1.6.6" + "webpack": "^1.9.10", + "webpack-dev-server": "^1.9.0" } } diff --git a/tasks/build b/tasks/build index a8fd86e..e4ebfda 100755 --- a/tasks/build +++ b/tasks/build @@ -1,13 +1,7 @@ -#!/bin/bash +#!/bin/bash -e -mkdir -p dist - -NODE_ENV=production $RACKT_PATH/node_modules/.bin/browserify lib/main.js \ --t reactify \ --t browserify-shim \ --t envify \ ---detect-globals false \ --s $COMPONENT_NAME > dist/$COMPONENT_FILE.js +BUILD="$RACKT_PATH/node_modules/.bin/webpack --devtool source-map --config $RACKT_PATH/webpack.build.js" -$RACKT_PATH/node_modules/.bin/uglifyjs dist/$COMPONENT_FILE.js \ ---compress warnings=false > dist/$COMPONENT_FILE.min.js +mkdir -p dist +eval $BUILD +eval "MINIFY=1 $BUILD" diff --git a/webpack.build.js b/webpack.build.js new file mode 100644 index 0000000..4f46139 --- /dev/null +++ b/webpack.build.js @@ -0,0 +1,26 @@ +var path = require('path'); +var webpack = require('webpack'); +var BASE_DIR = process.cwd(); +var COMPONENT_FILE = process.env.COMPONENT_FILE; +var COMPONENT_NAME = process.env.COMPONENT_NAME; +var plugins = []; + +if (process.env.MINIFY) { + plugins.push( + new webpack.optimize.UglifyJsPlugin() + ); + COMPONENT_FILE += '.min'; +} + +module.exports = { + entry: path.resolve(BASE_DIR, 'lib/main.js'), + output: { + filename: path.resolve(BASE_DIR, 'dist/' + COMPONENT_FILE + '.js'), + library: COMPONENT_NAME, + libraryTarget: 'umd' + }, + externals: { + 'react': 'React' + }, + plugins: plugins +}; diff --git a/webpack.config.js b/webpack.config.js index 1207915..8a49b0a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -33,7 +33,11 @@ module.exports = { module: { loaders: [ - { test: /\.js$/, loader: 'jsx-loader?harmony' } + { + test: /\.js$/, + exclude: /node_modules/, + loader: path.resolve(process.env.RACKT_PATH, 'node_modules/babel-loader') + } ] },