Skip to content

Commit

Permalink
feat: hmr for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Topvennie committed Mar 23, 2024
1 parent 65ef96e commit ad9e570
Show file tree
Hide file tree
Showing 7 changed files with 692 additions and 1,224 deletions.
3 changes: 3 additions & 0 deletions .dev.env
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ DJANGO_CAS_PORT=8080 # Port for the CAS server. Should be 8080 if DJANGO_DOMAIN_
DJANGO_DB_ENGINE=django.db.backends.sqlite3 # Database engine
DJANGO_REDIS_HOST=${REDIS_IP} # Redis configuration
DJANGO_REDIS_PORT=${REDIS_PORT}

# Vite & Vue
FRONTEND_CMD="" # Command to start the frontend server
14 changes: 12 additions & 2 deletions development.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@

backend=false
frontend=false
windows_hmr=false
build=false

while getopts ":bfc" opt; do
while getopts ":bfcw" opt; do
case ${opt} in
b )
backend=true
;;
f )
frontend=true
;;
w )
windows_hmr=true
;;
c )
build=true
;;
\? )
echo "Usage: $0 [-b] [-f] [-c]"
echo "Usage: $0 [-b] [-f] [-w] [-c]"
exit 1
;;
esac
Expand All @@ -34,6 +38,12 @@ if ! [ -f .env ]; then
echo "Created environment file"
fi

if [ "$windows_hmr" = true ]; then
sed -i "s/^FRONTEND_CMD=.*/FRONTEND_CMD=\"npm run watch\"/" .env
else
sed -i "s/^FRONTEND_CMD=.*/FRONTEND_CMD=\"npm run host\"/" .env
fi

echo "Checking for existing SSL certificates..."

if [ ! -f "data/nginx/ssl/private.key" ] || [ ! -f "data/nginx/ssl/certificate.crt" ]; then
Expand Down
2 changes: 1 addition & 1 deletion development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ services:
build:
context: $FRONTEND_DIR
dockerfile: Dockerfile.dev
command: bash -c "npm install && npm run host"
command: bash -c "npm install && ${FRONTEND_CMD}"
expose:
- 5173
volumes:
Expand Down
Loading

0 comments on commit ad9e570

Please sign in to comment.