-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathentrypoint.sh
executable file
·47 lines (36 loc) · 1.16 KB
/
entrypoint.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
#!/bin/sh
set -eu
: "${PT_PROJECT_TOKEN:?'You must set the PT_PROJECT_TOKEN secret'}"
YARN_WORKSPACES=$(jq '.workspaces' package.json)
if [ "$YARN_WORKSPACES" != "null" ]; then
echo "Detected yarn workspaces"
fi
if [ -n "${PT_PROJECT_ROOT:-}" ]; then
echo "Custom root directory detected, navigating to: $PT_PROJECT_ROOT"
cd $PT_PROJECT_ROOT
fi
if [ -e yarn.lock ] || [ "$YARN_WORKSPACES" != "null" ]; then
yarn config set ignore-engines true
packager="yarn"
install="add"
elif [ -e package.json ]; then
packager="npm"
install="install"
else
echo "Could not find package.json within $(pwd)" 1>&2
echo 'Try setting a custom root directory with the $PT_PROJECT_ROOT environment variable to set a custom root path.' 1>&2
exit 2
fi
$packager install
CRA_VERSION=$(jq '.dependencies | .["react-scripts"]' package.json)
if [ "$CRA_VERSION" != "null" ]; then
echo "Detected Create React App ($CRA_VERSION)"
echo yes | $packager run eject
export WEBPACK_CONFIG_PATH='./config/webpack.config.js'
fi
$packager $install @packtracker/[email protected]
export NODE_ENV="production"
cp /report.js ./report.js
node ./report.js
git reset --hard HEAD
git clean -fxd