aboutsummaryrefslogtreecommitdiffstats
path: root/config/build.sh
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-02-20 16:11:50 +0100
committerArmand Philippot <git@armandphilippot.com>2022-02-20 16:15:08 +0100
commit73a5c7fae9ffbe9ada721148c8c454a643aceebe (patch)
treec8fad013ed9b5dd589add87f8d45cf02bbfc6e91 /config/build.sh
parentb01239fbdcc5bbc5921f73ec0e8fee7bedd5c8e8 (diff)
chore!: restructure repo
I separated public files from the config/dev files. It improves repo readability. I also moved dotenv helper to public/inc directory and extract the Matomo tracker in the same directory.
Diffstat (limited to 'config/build.sh')
-rwxr-xr-xconfig/build.sh30
1 files changed, 18 insertions, 12 deletions
diff --git a/config/build.sh b/config/build.sh
index 4277143..60f4ccb 100755
--- a/config/build.sh
+++ b/config/build.sh
@@ -4,7 +4,13 @@
# Build all Angular & React projects.
###############################################################################
-# 1.0. Helpers
+# 1.0. Config
+###############################################################################
+_ANGULAR_PROJECTS="projects/angular-small-apps"
+_REACT_PROJECTS="projects/react-small-apps"
+
+###############################################################################
+# 2.0. Helpers
###############################################################################
_COLOR_RESET=$(printf '\e[0m')
_COLOR_BLUE=$(printf '\e[34m')
@@ -45,17 +51,17 @@ error_unexpected() {
}
###############################################################################
-# 2.0. Angular
+# 3.0. Angular
###############################################################################
install_angular_dependencies() {
- if [ ! -d "./projects/angular-small-apps" ]; then
+ if [ ! -d "./public/${_ANGULAR_PROJECTS}" ]; then
error "Angular projects are missing."
printf "Exit.\n"
exit 1
fi
- cd "./projects/angular-small-apps" || exit
+ cd "./public/${_ANGULAR_PROJECTS}" || exit
yarn
cd "$OLDPWD" || exit
}
@@ -63,8 +69,8 @@ install_angular_dependencies() {
build_angular_app() {
[ $# -ne 1 ] && error_unexpected
- cd "./projects/angular-small-apps/" || exit
- yarn --cwd "apps/${1}" run build --base-href="/projects/angular-small-apps/apps/${1}/dist/${1}/"
+ cd "./public/${_ANGULAR_PROJECTS}" || exit
+ yarn --cwd "apps/${1}" run build --base-href="/${_ANGULAR_PROJECTS}/apps/${1}/dist/${1}/"
info "${1} built."
cd "$OLDPWD" || exit
}
@@ -76,17 +82,17 @@ setup_angular_projects() {
}
###############################################################################
-# 3.0. React
+# 4.0. React
###############################################################################
install_react_dependencies() {
- if [ ! -d "./projects/react-small-apps" ]; then
+ if [ ! -d "./public/${_REACT_PROJECTS}" ]; then
error "React projects are missing."
printf "Exit.\n"
exit 1
fi
- cd "./projects/react-small-apps" || exit
+ cd "./public/${_REACT_PROJECTS}" || exit
yarn
cd "$OLDPWD" || exit
}
@@ -94,8 +100,8 @@ install_react_dependencies() {
build_react_app() {
[ $# -ne 1 ] && error_unexpected
- cd "./projects/react-small-apps/" || exit
- PUBLIC_URL="/projects/react-small-apps/apps/${1}/build/" yarn --cwd "apps/${1}" run build
+ cd "./public/${_REACT_PROJECTS}" || exit
+ PUBLIC_URL="/${_REACT_PROJECTS}/apps/${1}/build/" yarn --cwd "apps/${1}" run build
info "${1} built."
cd "$OLDPWD" || exit
}
@@ -109,7 +115,7 @@ setup_react_projects() {
}
###############################################################################
-# 4.0. Main
+# 5.0. Main
###############################################################################
# Check if Yarn is installed.