-
Notifications
You must be signed in to change notification settings - Fork 3
/
dev
executable file
·46 lines (38 loc) · 1.49 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
#!/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 pnpm exists
if ! which pnpm > /dev/null ; then
echo "pnpm not found on the system. Please see: https://pnpm.io/installation"
exit 1
fi
# check serverless is installed globally.
if ! which serverless > /dev/null ; then
echo "installing serverless globally"
pnpm global add serverless
fi
# have to ensure that pnpm install is up to date.
# we use .pnpm_install as a marker for the last time `pnpm install` was run. Rerun the command when pnpm-lock.yaml is updated
if [ "pnpm-lock.yaml" -nt ".pnpm_install" ]; then
pnpm install
touch .pnpm_install
fi
# build and run dev.ts
# tsc is configured to build what we expect in tsconfig.json
pnpm run -r build:dev
node ./dev_tool/build/dev.js "$@"