2016-07-07 20:10:55 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#? Package the app
|
|
|
|
|
2016-08-23 19:27:46 +00:00
|
|
|
set -e
|
|
|
|
|
2016-09-03 04:32:45 +00:00
|
|
|
NODE_VERSION="$(node --version)"
|
|
|
|
if [ "$NODE_VERSION" != "v5.1.1" ]; then
|
|
|
|
echo "ERROR: Node version should be 5.1.1, got $NODE_VERSION instead"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-07-18 20:10:18 +00:00
|
|
|
BUILD_DIR='./build'
|
|
|
|
|
2016-07-07 20:10:55 +00:00
|
|
|
echo "-- REMOVING DIST FOLDER --"
|
2016-08-23 19:31:26 +00:00
|
|
|
if [ -d "$BUILD_DIR" ]; then
|
|
|
|
rm -r "$BUILD_DIR"
|
|
|
|
fi
|
2016-07-07 20:10:55 +00:00
|
|
|
|
|
|
|
echo "-- BUILDING PRODUCTION APP --"
|
2016-08-23 19:47:38 +00:00
|
|
|
cross-env NODE_ENV=production webpack --config ./webpack/webpack.config.production.babel.js
|
2016-07-07 20:10:55 +00:00
|
|
|
|
|
|
|
echo "-- COPYING REMAINING FILES --"
|
|
|
|
|
2016-07-19 16:59:26 +00:00
|
|
|
# Copy package JSON
|
2016-09-15 22:45:08 +00:00
|
|
|
cp app/package.json "$BUILD_DIR"
|
2016-07-19 16:59:26 +00:00
|
|
|
|
2016-07-07 20:10:55 +00:00
|
|
|
# Copy some things
|
2016-09-17 05:46:44 +00:00
|
|
|
cp -r app/ui/external assets/* app/main.js "$BUILD_DIR/"
|
2016-07-07 20:10:55 +00:00
|
|
|
|
|
|
|
echo "-- INSTALLING PACKAGES --"
|
|
|
|
|
2016-07-18 20:10:18 +00:00
|
|
|
cd "$BUILD_DIR"/
|
2016-08-23 18:54:22 +00:00
|
|
|
cross-env NODE_ENV=production npm install
|
2016-07-07 20:10:55 +00:00
|
|
|
|
2016-07-18 19:44:46 +00:00
|
|
|
echo "-- BUILD COMPLETE --"
|