From 4aec72c4da361da33777d66258e92693f4872dd1 Mon Sep 17 00:00:00 2001 From: kilyabin <65072190+kilyabin@users.noreply.github.com> Date: Mon, 24 Nov 2025 02:56:59 +0400 Subject: [PATCH] fix: install and update script --- scripts/install.sh | 20 +++++++++++--------- scripts/manage.sh | 18 +++++++++++------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 7308909..24835bc 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -209,22 +209,24 @@ fi echo -e "${YELLOW}Building the application...${NC}" npm run build -# Ensure public directory is accessible in standalone build +# Ensure public directory and static files are accessible in standalone build echo -e "${YELLOW}Setting up static files...${NC}" -# In standalone mode, public should be in the root, which is already copied -# But we need to ensure .next/static is properly linked/copied if [ -d "$INSTALL_DIR/.next/standalone" ]; then - # Copy public to standalone directory if it's not there - if [ ! -d "$INSTALL_DIR/.next/standalone/public" ]; then + # Copy public directory to standalone (always update) + if [ -d "$INSTALL_DIR/public" ]; then + echo -e "${YELLOW}Copying public directory to standalone...${NC}" cp -r "$INSTALL_DIR/public" "$INSTALL_DIR/.next/standalone/public" 2>/dev/null || true fi - # Ensure .next/static is accessible from standalone - if [ ! -d "$INSTALL_DIR/.next/standalone/.next" ]; then + # Copy .next/static to standalone/.next/static (always update) + if [ -d "$INSTALL_DIR/.next/static" ]; then + echo -e "${YELLOW}Copying .next/static to standalone...${NC}" mkdir -p "$INSTALL_DIR/.next/standalone/.next" - fi - if [ ! -d "$INSTALL_DIR/.next/standalone/.next/static" ]; then cp -r "$INSTALL_DIR/.next/static" "$INSTALL_DIR/.next/standalone/.next/static" 2>/dev/null || true + else + echo -e "${RED}Warning: .next/static directory not found!${NC}" fi +else + echo -e "${RED}Warning: .next/standalone directory not found!${NC}" fi # Check if service user exists, create if not diff --git a/scripts/manage.sh b/scripts/manage.sh index 937189b..3509be2 100755 --- a/scripts/manage.sh +++ b/scripts/manage.sh @@ -161,20 +161,24 @@ case "$1" in echo -e "${YELLOW}Building application...${NC}" npm run build - # Ensure public directory is accessible in standalone build + # Ensure public directory and static files are accessible in standalone build echo -e "${YELLOW}Setting up static files...${NC}" if [ -d "$INSTALL_DIR/.next/standalone" ]; then - # Copy public to standalone directory if it's not there - if [ ! -d "$INSTALL_DIR/.next/standalone/public" ]; then + # Copy public directory to standalone (always update) + if [ -d "$INSTALL_DIR/public" ]; then + echo -e "${YELLOW}Copying public directory to standalone...${NC}" cp -r "$INSTALL_DIR/public" "$INSTALL_DIR/.next/standalone/public" 2>/dev/null || true fi - # Ensure .next/static is accessible from standalone - if [ ! -d "$INSTALL_DIR/.next/standalone/.next" ]; then + # Copy .next/static to standalone/.next/static (always update) + if [ -d "$INSTALL_DIR/.next/static" ]; then + echo -e "${YELLOW}Copying .next/static to standalone...${NC}" mkdir -p "$INSTALL_DIR/.next/standalone/.next" - fi - if [ ! -d "$INSTALL_DIR/.next/standalone/.next/static" ]; then cp -r "$INSTALL_DIR/.next/static" "$INSTALL_DIR/.next/standalone/.next/static" 2>/dev/null || true + else + echo -e "${RED}Warning: .next/static directory not found!${NC}" fi + else + echo -e "${RED}Warning: .next/standalone directory not found!${NC}" fi # Set ownership