Last active
May 15, 2017 15:50
-
-
Save hasantayyar/f063fb6c3bbfdce2e758ee50bcee90d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# USAGE | |
# 1. Run this script in v2 root folder | |
# 2. No need to pass the parameters. The feault values are | |
# - Build directory : '../../../build' | |
# - Architecture : null (means the same that this script is running) | |
# 3. Running by samples | |
# - sh bin/build-staging.sh | |
# - sh bin/build-staging.sh /tmp/build-dir | |
# - sh bin/build-staging.sh /home/www/build os.linux.x86_64 | |
set -x | |
set -e | |
BUILD_DIR=${1:-../../../build} | |
# for linux : os.linux.x86_64 | |
ARCH=${2-''} | |
# if ARCH set to non-empty string then prepare the paramter for meteor build | |
if [ -n "${ARCH}" ]; then | |
ARCH="--architecture $ARCH" | |
fi | |
# settings file location | |
SETTINGS_FILE=${3-'private/settings/dev.json'} | |
BUILD_DIR=" $BUILD_DIR" | |
meteor build --directory $BUILD_DIR --server-only $ARCH | |
echo "Build Completed." | |
echo "Copy settings" | |
cp $SETTINGS_FILE $BUILD_DIR/bundle/settings.json | |
chmod +w $BUILD_DIR/bundle/main.js | |
echo "process.env.METEOR_SETTINGS = require('fs').readFileSync('settings.json', 'utf8');\n$(cat $BUILD_DIR/bundle/main.js)" > $BUILD_DIR/bundle/main.js | |
echo "Export meteor settings as environment variables" | |
export METEOR_SETTINGS=$(cat $SETTINGS_FILE) | |
echo "Building app completed." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment