forked from Enterprise-CMCS/macpro-mdct-mcr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev
executable file
·51 lines (41 loc) · 1.59 KB
/
dev
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
#!/bin/bash
set -eu -o pipefail
# this is the entrypoint for development. It wraps up compiling and calling dev.ts
# all arguments, changes, etc. should be found in src/dev.ts
# this script checks for all the prereqs and then calls dev.ts
# check node exists
if ! which node > /dev/null ; then
echo "node not found on the system. Install version in .nvmrc based on instructions in README"
exit 1
fi
# check node version
if ! diff .nvmrc <(node -v) > /dev/null ; then
echo "Uh Oh! The current node version does not match the version required in .nvmrc"
echo "If you have installed nvm, simply running 'nvm use' in this directory should solve the problem"
echo "If you don't have nvm yet, the instructions in the README should sort you."
echo "** Don't forget to add the bit to your shell profile **"
exit 1
fi
# check yarn exists
if ! which yarn > /dev/null ; then
echo "yarn not found on the system. On macOS, you can install it with 'brew install yarn'"
exit 1
fi
# check serverless is installed globally.
if ! which serverless > /dev/null ; then
echo "installing serverless globally"
yarn install -g serverless
fi
# have to ensure that yarn install is up to date.
# we use .yarn_install as a marker for the last time `yarn install` was run. Rerun the command when yarn.lock is updated
if [ "yarn.lock" -nt ".yarn_install" ]; then
yarn install
touch .yarn_install
fi
# if .env doesn't exist, copy .env_example there
if [ ! -f .env ]; then
cp .env_example .env
fi
# build and run dev.ts
# tsc is configured to build what we expect in tsconfig.json
./node_modules/.bin/tsc && node ./build_dev/dev.js "$@"