-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbuild.sh
executable file
·59 lines (44 loc) · 1.13 KB
/
build.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
#!/bin/bash
# Welcome to the orlando devs build script
# I don't write much bash so bear with me
# install npm deps if need be
# default assumes that the deps are installed
checkInstall() {
if [ -e node_modules/.bin/metalsmith ]; then
build;
else
installDeps;
fi
}
# Do the build
build() {
# This should probs go away?
echo -e "---\ntemplate: index.html\n---\n" > src/index.md
cat readme.md >> src/index.md
./node_modules/.bin/metalsmith
}
# ask the user to install the npm deps if the terminal is a tty
# else just bail
installDeps() {
# -t being 1 means stdout is a tty
if [ -t 1 ]; then
echo "looks like you need to npm install"
echo "would you like us to do that for you? (y,n)"
read doinstall
# do pattern matching cause people may use 'yes' or 'y'
if [[ $doinstall == y* ]]; then
printf "great, installing npm deps for you, this may take a moment\n"
npm install
build;
exit 0;
else
echo "bailing since you chose not to install the deps"
exit 0;
fi
else
echo "you are not a tty, peace"
exit 1;
fi
}
# start things off
checkInstall