This repository has been archived by the owner on Feb 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
go
executable file
·63 lines (52 loc) · 1.43 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
#!/bin/bash
command_exists () {
type "$1" &> /dev/null ;
}
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 == "--help" || $1 == "-h" ]]; then
show_instructions
fi
if [[ $1 == "install" ]]; then
npm -s install
fi
if [[ $1 == "test" ]]; then
npm -s test
exit $?
fi
if [[ $1 == "test:dev" ]]; then
npm -s run test:dev
exit $?
fi
if [[ $1 == "pre-commit" ]]; then
npm -s run ci
exit $?
fi
if [[ $1 == "start" ]]; then
npm -s start
fi
else
show_instructions
fi