-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·57 lines (45 loc) · 1.61 KB
/
start.sh
File metadata and controls
executable file
·57 lines (45 loc) · 1.61 KB
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
51
52
53
54
55
56
#!/bin/bash
set -e # exit immediately on error
set -o nounset # abort on unbound variable
set -o pipefail # don't hide errors within pipes
# set -x # for debuging, trace what is being executed.
export RESET="\033[0m"
export DOT="\033[32m\033[1K ● \033[0m"
export CHECK="\033[32m\033[1K ✔ \033[0m"
export ERROR="\033[31m ❌ ERROR \033[0m"
export EMPH="\033[33m"
export LINECLEAR="\033[1G\033[2K" # position to column 1; erase whole line
# Note on the `sed` command:
# On Linux, the -i switch can be used without an extension argument
# On macOS, the -i switch must be followed by an extension argument (which can be empty)
# On Windows, the argument of the -i switch is optional, but if present it must follow it immediately without a space in between
sedi () {
sed --version >/dev/null 2>&1 && sed -i -- "$@" || sed -i "" "$@"
}
export -f sedi
cd "$(dirname "$0")/.."
# Check that correct version of npm and node are installed
npx check-node-version --package
# If no "node_modules" directory, do an install first
if [ ! -d "./node_modules" ]; then
printf "${DOT}Installing dependencies"
npm install
echo -e "${LINECLEAR}${CHECK} Dependencies installed"
fi
# export GIT_VERSION=`git describe --long --dirty`
export SDK_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g' \
| tr -d '[[:space:]]')
# Clean output directories
printf "${LINECLEAR}${DOT} Cleaning output directories"
rm -rf ./dist
rm -rf ./declarations
rm -rf ./build
rm -rf ./coverage
mkdir -p dist
# Do dev build and watch
node ./scripts/start.mjs&
npx tsc --watch --noEmit --preserveWatchOutput