2019-06-04 16:50:29 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
###################################################################################################
|
|
|
|
#
|
|
|
|
# Impure setup (any setup here should be minimized and instead be moved to Nix for a pure setup)
|
|
|
|
#
|
|
|
|
###################################################################################################
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
|
|
|
|
|
|
|
RED='\033[0;31m'
|
|
|
|
GREEN='\033[0;32m'
|
|
|
|
YELLOW='\033[1;33m'
|
|
|
|
NC='\033[0m'
|
2019-09-12 14:30:56 +00:00
|
|
|
PLATFORM_FOLDER="desktop/js_files"
|
2019-06-04 16:50:29 +00:00
|
|
|
|
|
|
|
$GIT_ROOT/scripts/run-environment-check.sh desktop
|
|
|
|
|
2019-09-12 12:38:16 +00:00
|
|
|
if [ ! -f package.json ] || [ $(readlink package.json) != "${PLATFORM_FOLDER}/package.json" ]; then
|
2019-06-04 16:50:29 +00:00
|
|
|
rm -rf node_modules
|
|
|
|
|
2019-09-12 12:38:16 +00:00
|
|
|
echo "Creating link: package.json -> ${PLATFORM_FOLDER}/package.json"
|
|
|
|
ln -sf ${PLATFORM_FOLDER}/package.json package.json
|
2019-06-04 16:50:29 +00:00
|
|
|
|
|
|
|
echo "Creating link: yarn.lock -> ${PLATFORM_FOLDER}/yarn.lock"
|
|
|
|
ln -sf ${PLATFORM_FOLDER}/yarn.lock yarn.lock
|
|
|
|
|
|
|
|
echo "Creating link: metro.config.js -> ${PLATFORM_FOLDER}/metro.config.js"
|
|
|
|
ln -sf ${PLATFORM_FOLDER}/metro.config.js metro.config.js
|
|
|
|
fi
|
|
|
|
|
2019-09-13 13:45:24 +00:00
|
|
|
mkdir -p "$GIT_ROOT/node_modules/"
|
|
|
|
# Leverage flock (file lock) utility to create an exclusive lock on node_modules/ while running 'yarn install'
|
|
|
|
flock "$GIT_ROOT/node_modules/" yarn install --frozen-lockfile
|
2019-06-04 16:50:29 +00:00
|
|
|
|
|
|
|
echo -e "${GREEN}Finished!${NC}"
|