-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·50 lines (39 loc) · 1.15 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# if .env file does not exist, copy if from .env.default
if [ ! -f .env ]; then
cp .env.default .env
fi
# set local environment variables from .env file
export $(cat .env | xargs)
PACKAGES=("ecs" "hyperflux")
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo SCRIPT_DIR $SCRIPT_DIR
# @todo this breaks vitest
# cd package-test-template
# npm i
# rm -rf package-lock.json
# cd $SCRIPT_DIR
# get around sed being different between macos and linux...
if [[ $(uname) == "Darwin" ]]; then
SP=" " # Needed for portability with sed
fi
# remove existing links
rm -rf ./packages/
for PACKAGE in ${PACKAGES[@]}; do
echo "Setting up $PACKAGE"
cd $ENGINE_PATH/packages/$PACKAGE
npm run build
cd ./dist
npm link
cd $SCRIPT_DIR
mkdir -p packages-temp
cp -r package-test-template/ packages-temp/$PACKAGE
# write package name to package.json
sed -i${SP}"" -e "s/TEMPLATE/test-$PACKAGE/g" packages-temp/$PACKAGE/package.json
cp tests/$PACKAGE.test.ts packages-temp/$PACKAGE/$PACKAGE.test.ts
cd packages-temp/$PACKAGE
npm link @ir-engine/$PACKAGE
npm i
cd $SCRIPT_DIR
done
mv packages-temp/ packages/