forked from hanabi/hanabi.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·31 lines (25 loc) · 1.11 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
#!/bin/bash
set -e # Exit on any errors
# Get the directory of this script
# https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# Install Python dependencies
pip install -r "$DIR/image-generator/requirements.txt" --quiet
# Reset the internal SECONDS variable so that we can measure how long validation takes
# https://stackoverflow.com/questions/16908084/bash-script-to-calculate-time-elapsed
SECONDS=0
# Test to see if all of the YAML files are valid
# (by manually invoking the "create_svg.py" script on every YAML file)
echo "Testing to see if all of the YAML files are valid..."
YAML_FILES=$(find "$DIR/image-generator/yml" -name '*.yml' -type f)
for YAML_FILE in $YAML_FILES; do
echo $YAML_FILE
python "$DIR/image-generator/create_svg.py" < "$YAML_FILE" > /dev/null
done
echo "All the YAML files are valid. (It took $SECONDS seconds.)"
# Build the website, which will go into the "build" subdirectory
cd "$DIR"
SECONDS=0
rm -rf "$DIR/build"
yarn build
echo "Build successful. (It took $SECONDS seconds.)"