diff --git a/clients/crunchbase/ui/package.json b/clients/crunchbase/ui/package.json index b976c5fa44..0337620cf4 100644 --- a/clients/crunchbase/ui/package.json +++ b/clients/crunchbase/ui/package.json @@ -10,7 +10,6 @@ "babel-cli": "^6.3.15", "babel-core": "^6.3.15", "babel-eslint": "^4.1.5", - "babel-generator": "^6.4.2", "babel-loader": "^6.2.1", "babel-plugin-syntax-async-functions": "^6.3.13", "babel-plugin-syntax-flow": "^6.3.13", diff --git a/clients/tagshow/.npm_build_helper.sh b/clients/tagshow/.npm_build_helper.sh index ce9a7c545d..95bb522053 100755 --- a/clients/tagshow/.npm_build_helper.sh +++ b/clients/tagshow/.npm_build_helper.sh @@ -1,10 +1,7 @@ -SRC="node_modules/babel-regenerator-runtime/runtime.js main.js" +SRC="babel-regenerator-runtime src/main.js" OUT="tagshow.js" -export NODE_ENV=production -export BABEL_ENV=production +export NODE_ENV=$1 +export BABEL_ENV=$1 -node_modules/.bin/browserify \ - -p bundle-collapser/plugin \ - $SRC \ - | node_modules/.bin/uglifyjs -c -m > $OUT +node_modules/.bin/webpack --progress $SRC $OUT diff --git a/clients/tagshow/package.json b/clients/tagshow/package.json index 5503d9589e..de57bf1ce5 100644 --- a/clients/tagshow/package.json +++ b/clients/tagshow/package.json @@ -9,7 +9,7 @@ "babel-cli": "^6.3.15", "babel-core": "^6.3.15", "babel-eslint": "^4.1.5", - "babel-generator": "^6.4.2", + "babel-loader": "^6.2.1", "babel-plugin-syntax-async-functions": "^6.3.13", "babel-plugin-syntax-flow": "^6.3.13", "babel-plugin-transform-async-to-generator": "^6.3.13", @@ -20,28 +20,17 @@ "babel-polyfill": "^6.3.14", "babel-preset-es2015": "^6.3.13", "babel-preset-react": "^6.3.13", - "babelify": "^7.2.0", - "browserify": "^12.0.1", - "bundle-collapser": "^1.2.1", "chai": "^3.2.0", - "envify": "^3.4.0", "eslint": "^1.9.0", "eslint-plugin-react": "^3.8.0", "flow-bin": "^0.19.1", "mocha": "^2.3.0", - "uglify-js": "^2.6.1", - "watchify": "^3.6" + "webpack": "^1.12.11" }, "scripts": { - "start": "watchify -o tagshow.js -t babelify -v -d node_modules/babel-regenerator-runtime/runtime.js main.js", - "build": "./.npm_build_helper.sh", - "pretest": "rm -f tagshow.js && eslint *.js && flow", - "test": "mocha --ui tdd --reporter dot --compilers js:babel-core/register ./*_test.js" - }, - "browserify": { - "transform": [ - "babelify", - "envify" - ] + "start": "./.npm_build_helper.sh development", + "build": "./.npm_build_helper.sh production", + "pretest": "eslint src/ && flow src/", + "test": "mocha --ui tdd --reporter dot --compilers js:babel-core/register src/*_test.js" } } diff --git a/clients/tagshow/datasetpicker.js b/clients/tagshow/src/datasetpicker.js similarity index 100% rename from clients/tagshow/datasetpicker.js rename to clients/tagshow/src/datasetpicker.js diff --git a/clients/tagshow/eq.js b/clients/tagshow/src/eq.js similarity index 100% rename from clients/tagshow/eq.js rename to clients/tagshow/src/eq.js diff --git a/clients/tagshow/eq_test.js b/clients/tagshow/src/eq_test.js similarity index 100% rename from clients/tagshow/eq_test.js rename to clients/tagshow/src/eq_test.js diff --git a/clients/tagshow/main.js b/clients/tagshow/src/main.js similarity index 100% rename from clients/tagshow/main.js rename to clients/tagshow/src/main.js diff --git a/clients/tagshow/photo.js b/clients/tagshow/src/photo.js similarity index 100% rename from clients/tagshow/photo.js rename to clients/tagshow/src/photo.js diff --git a/clients/tagshow/preview.js b/clients/tagshow/src/preview.js similarity index 100% rename from clients/tagshow/preview.js rename to clients/tagshow/src/preview.js diff --git a/clients/tagshow/root.js b/clients/tagshow/src/root.js similarity index 100% rename from clients/tagshow/root.js rename to clients/tagshow/src/root.js diff --git a/clients/tagshow/slideshow.js b/clients/tagshow/src/slideshow.js similarity index 100% rename from clients/tagshow/slideshow.js rename to clients/tagshow/src/slideshow.js diff --git a/clients/tagshow/tagchooser.js b/clients/tagshow/src/tagchooser.js similarity index 100% rename from clients/tagshow/tagchooser.js rename to clients/tagshow/src/tagchooser.js diff --git a/clients/tagshow/taglist.js b/clients/tagshow/src/taglist.js similarity index 100% rename from clients/tagshow/taglist.js rename to clients/tagshow/src/taglist.js diff --git a/clients/tagshow/webpack.config.js b/clients/tagshow/webpack.config.js new file mode 100644 index 0000000000..cbea9f3f0e --- /dev/null +++ b/clients/tagshow/webpack.config.js @@ -0,0 +1,49 @@ +'use strict'; + +const path = require('path'); +const webpack = require('webpack'); + +const devMode = process.env.NODE_ENV !== 'production'; + +// Replaces all process.env.foo with the value of the enviroment variable. +function replaceEnv() { + const replacements = {}; + for (const key in process.env) { + replacements[`process.env.${key}`] = JSON.stringify(process.env[key]); + } + return new webpack.DefinePlugin(replacements); +} + +const plugins = [replaceEnv()]; + +if (!devMode) { + plugins.push(new webpack.optimize.UglifyJsPlugin({ + compress: { + warnings: false + } + })); +} + +module.exports = { + module: { + loaders: [ + { + test: /\.js$/, + exclude: /node_modules/, + loader: 'babel-loader' + } + ] + }, + + plugins, + + resolve: { + alias: { + // Make sure all of these instances are using the same copy. + 'react': path.resolve('./node_modules/react') + } + }, + + devtool: devMode ? '#inline-source-map' : '', + watch: devMode +};