-
Notifications
You must be signed in to change notification settings - Fork 0
/
go
executable file
·65 lines (58 loc) · 1.67 KB
/
go
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
#!/bin/bash
command_exists () {
type "$1" &> /dev/null ;
}
sync_from_upstream () {
git stash
git remote add upstream https://github.com/twlevelup/watch_edition_gitpod.git
git fetch upstream master --depth=50
git rebase upstream/master
git stash pop
}
show_instructions () {
echo "Usage: ./go <command>"
echo ""
echo "where <command> is one of:"
echo " install installs any required dependencies"
echo " test runs all your unit tests"
echo " test:dev runs all your unit tests in development mode"
echo " pre-commit prepares your changes to be committed"
echo " start runs your local development server at http://localhost:8080"
}
initial_setup () {
echo "It looks like this is your first time trying to run the app."
echo "Before you start, I need to set a few things up for you."
npm -s install
echo "All done! You can now start using the app!"
}
if ! command_exists node || ! command_exists npm; then
echo "You need node and npm to run this!"
echo "You'll need to install these yourself as I can't install them for you :("
echo "Try using NVM https://github.com/creationix/nvm"
exit 1
fi
[[ -d node_modules ]] || initial_setup
if [[ $1 ]]; then
if [[ $1 == "install" ]]; then
npm -s install
elif [[ $1 == "test" ]]; then
npm -s test
exit $?
elif [[ $1 == "test:dev" ]]; then
npm -s run test:dev
exit $?
elif [[ $1 == "pre-commit" ]]; then
npm -s run ci
exit $?
elif [[ $1 == "start" ]]; then
npm -s start
elif [[ $1 == "sync" ]]; then
sync_from_upstream
exit $?
else
echo "Unrecognised command: '$1'"
show_instructions
fi
else
show_instructions
fi