@@ -39,7 +39,13 @@ EOSCRIPT
3939FRONTEND_PATH=" ${APP_DIR} /${FRONTEND_DIR} "
4040FRONTEND_BUILD_DIR=" ${FRONTEND_PATH} /dist/public"
4141
42- if [ -d " ${FRONTEND_PATH} " ]; then
42+ # Check if we have prebuilt assets already
43+ if [ -d " ${FRONTEND_BUILD_DIR} " ]; then
44+ echo " Found prebuilt frontend assets at ${FRONTEND_BUILD_DIR} ."
45+ echo " Skipping npm build since assets are already present."
46+ chown -R " ${APP_USER} :${APP_USER} " " ${FRONTEND_PATH} " 2> /dev/null || true
47+ elif [ -d " ${FRONTEND_PATH} " ]; then
48+ # Frontend source exists but no built assets, need to build
4349 if ! command -v " ${NPM_BIN} " > /dev/null 2>&1 ; then
4450 echo " Error: npm command '${NPM_BIN} ' not found. Install Node.js/npm or set NPM_BIN." >&2
4551 exit 1
@@ -58,16 +64,9 @@ if [ -d "${FRONTEND_PATH}" ]; then
5864
5965 chown -R " ${APP_USER} :${APP_USER} " " ${FRONTEND_PATH} "
6066else
61- # If the source directory is missing, fall back to an already built bundle
62- PREBUILT_DIST=" ${APP_DIR} /CosmoView/dist/public"
63- if [ -d " ${PREBUILT_DIST} " ]; then
64- echo " Frontend source directory not found. Using existing assets at ${PREBUILT_DIST} ."
65- FRONTEND_BUILD_DIR=" ${PREBUILT_DIST} "
66- else
67- echo " Error: Frontend directory ${FRONTEND_PATH} not found and no prebuilt assets present." >&2
68- echo " Ensure the CosmoView frontend is built before deployment or set FRONTEND_DIR." >&2
69- exit 1
70- fi
67+ echo " Error: Frontend directory ${FRONTEND_PATH} not found and no prebuilt assets present." >&2
68+ echo " Ensure the CosmoView frontend is built before deployment or set FRONTEND_DIR." >&2
69+ exit 1
7170fi
7271
7372# Apply capability for port binding if needed (for systemd < 229)
0 commit comments