-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
106 lines (88 loc) · 1.45 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
cd /dagger
install () {
npm install
}
test_install () {
if [ -z "$(ls -A node_modules)" ]; then
install
fi
}
start () {
npm start
}
build () {
npm run-script build
}
lint () {
npx eslint .
}
version () {
RELEASE=`git describe --tags | sed 's|release_||; s|-.*||'`
BRANCH=`git rev-parse --abbrev-ref HEAD`
COMMIT=`git rev-parse --short HEAD`
REVISION_DATE=`git log -n1 --pretty=%at HEAD`
VERSION_STRING="v$RELEASE-$BRANCH.$COMMIT"
}
version
export REACT_APP_VERSION_STRING=$VERSION_STRING
export REACT_APP_REVISION_DATE=`date -d @$REVISION_DATE +"%y.%m.%d"`
development () {
install
start
}
production () {
if [ "$PUBLIC_URL" = "" ]; then
echo 'ERROR: Need to specify a PUBLIC_URL';
fi
install
build
}
package_dev () {
#production
version
NAME="dagger-redux_$VERSION_STRING"
cd build
tar -cf ../$NAME.tar *
cd ..
chmod 777 $NAME.tar
}
package_release () {
#production
version
NAME="dagger-redux_$RELEASE"
cd build
tar -cf ../$NAME.tar *
cd ..
chmod 777 $NAME.tar
}
# Prefer parameters to environment
case $1 in
lint)
test_install
lint
exit;;
bash)
/bin/bash
exit;;
development)
development
exit;;
production)
production
exit;;
package_dev)
package_dev
exit;;
package_release)
package_release
exit;;
esac
case $REACT_APP_ENVIRONMENT in
development)
development
exit;;
production)
production
exit;;
esac