-
-
Notifications
You must be signed in to change notification settings - Fork 582
/
Copy pathdev
executable file
·46 lines (38 loc) · 1.57 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
#!/usr/bin/env bash
set -e
echo "Running dev (don't forget to 'yarn make-assets' if you've changed GraphiQL / favicon / etc)..."
cd $(dirname $0)/..
npm_bin=$(npm bin)
export POSTGRAPHILE_ENV=development
export BROWSER=none
# Run Nodemon and watch the PostGraphile source code for changes.
if [ "$1" = "--" ]; then
if [ "$DEBUG" = "" ]; then
echo 'You might want to:'
echo
echo ' export DEBUG="postgraphile*,graphile-build:warn,-postgraphile:graphql,-postgraphile:postgres:explain"'
fi
shift
$npm_bin/ts-node --transpile-only src/postgraphile/cli.ts "$@" &
else
export DEBUG=${DEBUG-postgraphile*,graphile-build:warn,-postgraphile:graphql,-postgraphile:postgres:explain}
$npm_bin/nodemon \
--watch ../packages/postgraphile-core/node8plus \
--watch ../packages/graphile-build-pg/node8plus \
--watch ../packages/graphile-build/node8plus \
--watch ../packages/graphile-utils/node8plus \
--watch src \
--ignore __tests__ \
--ignore __mocks__ \
--ignore src/postgraphile/graphiql \
--ext js,ts \
--exec "$npm_bin/ts-node --transpile-only src/postgraphile/cli.ts $* --show-error-stack json --extended-errors hint,detail,errcode" &
fi;
# Ensure forked process is killed even if we die unexpectedly
trap 'trap - SIGINT SIGTERM EXIT; JOBS="$(jobs -p)"; [[ "$JOBS" != "" ]] && kill $JOBS 2>/dev/null || true' SIGINT SIGTERM EXIT
# Run `react-scripts` in the GraphiQL directory as well parallel, but pipe the
# output to `/dev/null`.
#(sleep 1 && cd postgraphiql && PORT=5783 node_modules/.bin/react-scripts start) > /dev/null &
wait %1
kill %2
wait