Skip to content

Commit

Permalink
feat: update build api process
Browse files Browse the repository at this point in the history
  • Loading branch information
tanhongit committed Nov 5, 2024
1 parent d2bee6a commit 3952463
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ WORKER_NAME="CSlant Home"

# add the env to choose "npm" or "yarn" as the installer
INSTALLER=yarn
PORT=3000

# App Config
# E.g: prod, dev
Expand Down
1 change: 1 addition & 0 deletions runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ case "$1" in
all | a)
home_sync all
build_fe install
build_api install
worker
;;

Expand Down
28 changes: 27 additions & 1 deletion setup/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build_fe() {

BUILD_TYPE="$1"

cd "$HOME_DIR" || exit
cd "$HOME_FE_DIR" || exit

if [ ! -f "$HOME_FE_DIR/.env" ]; then
echo ' ∟ .env file missing, copying from .env.example...'
Expand Down Expand Up @@ -71,3 +71,29 @@ node_runner() {
fi
echo ''
}

# ========================================

build_api() {
echo '⚙ Building home API (Laravel)...'

if [ "$1" == "install" ]; then
COMPOSER_COMMAND="install"
else
COMPOSER_COMMAND="update"
fi

cd "$HOME_API_DIR" || exit

if [ ! -f "$HOME_API_DIR/.env" ]; then
echo ' ∟ .env file missing, copying from .env.example...'
cp "$HOME_API_DIR/.env.example" "$HOME_API_DIR/.env"
composer $COMPOSER_COMMAND
php artisan key:generate
else
composer $COMPOSER_COMMAND
fi

echo ''
}

1 change: 1 addition & 0 deletions setup/variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CURRENT_DIR=$(pwd)
SOURCE_DIR=$(readlink -f "$SOURCE_DIR")
HOME_DIR="$SOURCE_DIR/$HOME_NAME"
HOME_FE_DIR="$HOME_DIR/home-fe"
HOME_API_DIR="$HOME_DIR/home-api"
ENV=${ENV:-prod}
GIT_SSH_URL=${GIT_SSH_URL:-git@github.com:cslant}
USE_SUBMODULES=${USE_SUBMODULES:-false}

0 comments on commit 3952463

Please sign in to comment.