-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-release.sh
55 lines (45 loc) · 1.3 KB
/
build-release.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
#!/bin/bash
# First let's find out if the user has NPM installed
command -v npm >/dev/null 2>&1 || {
echo >&2 "I require NPM but it's not installed. Aborting.";
exit 1;
}
# Ask if the user wants to remove the current release directory
if [ -d "release" ]; then
while true; do
read -p "Do you want to remove the current release?" yn
case $yn in
[Yy]* ) rm -R release ;;
[Nn]* ) ;;
* ) echo "Please answer with yes or no.";;
esac
done
fi
# Create a release directory if it doesn't exist yet
if [ -d "release" ]; then
mkdir release
fi
# Running the SCSS compiler
echo "Compiling SCSS files to CSS files"
npm run build >> /dev/null
# Copy all the necesarry HTML files
echo "Copying HTML files ...";
cp index.html ./release/
# Fix the paths for the CSS and JS files
echo "Setting paths for the JavaScript, CSS and image files";
# Copy all the assests (like JS, CSS and image files)
echo "Copying JavaScript files ...";
# Create the JS directoy if doesnt exist, then create it
if [ -d "/release/js" ]; then
mkdir release/js
if
# Create the CSS directoy if doesnt exist, then create it
echo "Copying CSS files";
if [ -d "release/css" ]; then
mkdir release/css
fi
# Create the images directoy if doesnt exist, then create it
echo "Copying images";
if [ -d "release/images" ]; then
mkdir release/images
fi