This commit introduces Firebase configuration files (.firebaserc, firebase.json) and updates the Makefile to include deployment commands for different environments (dev, staging). The .firebaserc file defines Firebase projects for development and staging, along with hosting targets. The firebase.json file configures hosting settings, including rewrites and ignores. It defines hosting targets for the main app in dev and staging, and a separate target for an internal launchpad. The Makefile is updated to include: - GCP project IDs for dev and staging. - Environment detection (ENV variable). - Conditional variables based on the environment (GCP_PROJECT_ID, FIREBASE_ALIAS, HOSTING_TARGET). - Deployment commands for the launchpad and the main app. - The build command now passes the environment variable to the frontend build process. The internal launchpad is added to firebase/internal-launchpad/index.html to provide quick access to application URLs and Firebase/GCP consoles for different environments. A patch script is added to inject the environment label into the Dashboard page. The index.html title is changed to KROW. These changes enable streamlined deployment and environment management for the KROW application.
123 lines
4.7 KiB
Makefile
123 lines
4.7 KiB
Makefile
# KROW Workforce Project Makefile
|
|
# -------------------------------
|
|
# This Makefile provides a central place for common project commands.
|
|
# It is designed to be the main entry point for developers.
|
|
|
|
# Use .PHONY to declare targets that are not files, to avoid conflicts.
|
|
.PHONY: install dev build prepare-export help deploy-launchpad deploy-app
|
|
|
|
# The default command to run if no target is specified (e.g., just 'make').
|
|
.DEFAULT_GOAL := help
|
|
|
|
# --- Firebase & GCP Configuration ---
|
|
GCP_DEV_PROJECT_ID := krow-workforce-dev
|
|
GCP_STAGING_PROJECT_ID := krow-workforce-staging
|
|
|
|
# --- Environment Detection ---
|
|
ENV ?= dev
|
|
|
|
# --- Conditional Variables by Environment ---
|
|
ifeq ($(ENV),staging)
|
|
GCP_PROJECT_ID := $(GCP_STAGING_PROJECT_ID)
|
|
FIREBASE_ALIAS := staging
|
|
HOSTING_TARGET := app-staging
|
|
else
|
|
GCP_PROJECT_ID := $(GCP_DEV_PROJECT_ID)
|
|
FIREBASE_ALIAS := dev
|
|
HOSTING_TARGET := app-dev
|
|
endif
|
|
|
|
# Installs all project dependencies using npm.
|
|
install:
|
|
@echo "--> Installing web frontend dependencies..."
|
|
@cd frontend-web && npm install
|
|
|
|
# Starts the local development server.
|
|
dev:
|
|
@echo "--> Ensuring web frontend dependencies are installed..."
|
|
@cd frontend-web && npm install
|
|
@echo "--> Starting web frontend development server on http://localhost:5173 ..."
|
|
@cd frontend-web && npm run dev
|
|
|
|
# Builds the application for production.
|
|
build:
|
|
@echo "--> Building web frontend for production..."
|
|
@cd frontend-web && VITE_APP_ENV=$(ENV) npm run build
|
|
|
|
# Integrates a new Base44 export into the current project.
|
|
# It replaces the src directory and the index.html file in the frontend-web directory.
|
|
# Prerequisite: The new export must be in a folder named '../krow-workforce-export-latest'.
|
|
integrate-export:
|
|
@echo "--> Integrating new Base44 export into frontend-web/..."
|
|
@if [ ! -d "../krow-workforce-export-latest" ]; then \
|
|
echo "❌ Error: Export directory '../krow-workforce-export-latest' not found."; \
|
|
exit 1; \
|
|
fi
|
|
@echo " - Removing old src directory..."
|
|
@rm -rf frontend-web/src
|
|
@echo " - Copying new src directory..."
|
|
@cp -R ../krow-workforce-export-latest/src ./frontend-web/src
|
|
@echo " - Copying new index.html..."
|
|
@cp ../krow-workforce-export-latest/index.html ./frontend-web/index.html
|
|
@echo " - Patching base44Client.js for local development..."
|
|
@node scripts/patch-base44-client.js
|
|
@echo " - Patching queryKey in Layout.jsx for local development..."
|
|
@node scripts/patch-layout-query-key.js
|
|
@echo " - Patching Dashboard.jsx for environment label..."
|
|
@node scripts/patch-dashboard-for-env-label.js
|
|
@echo "--> Integration complete. Next step: 'make prepare-export'."
|
|
|
|
# Applies all necessary patches to a fresh Base44 export to run it locally.
|
|
# This is the main command for the hybrid workflow.
|
|
prepare-export:
|
|
@echo "--> Preparing fresh Base44 export for local development..."
|
|
@node scripts/prepare-export.js
|
|
@echo "--> Preparation complete. You can now run 'make dev'."
|
|
|
|
# --- Firebase Deployment ---
|
|
deploy-launchpad:
|
|
@echo "--> Deploying Internal Launchpad to DEV project..."
|
|
@firebase deploy --only hosting:launchpad --project=dev
|
|
|
|
deploy-app: build
|
|
@echo "--> Deploying Frontend Web App to [$(ENV)] environment..."
|
|
@firebase deploy --only hosting:$(HOSTING_TARGET) --project=$(FIREBASE_ALIAS)
|
|
|
|
# Shows this help message.
|
|
help:
|
|
@echo "--------------------------------------------------"
|
|
@echo " KROW Workforce - Available Makefile Commands"
|
|
@echo "--------------------------------------------------"
|
|
@echo " make install - Installs web frontend dependencies."
|
|
@echo " make dev - Starts the local web frontend server."
|
|
@echo " make build - Builds the web frontend for production."
|
|
@echo " make integrate-export - Integrates a new Base44 export from '../krow-workforce-export-latest'."
|
|
@echo " make prepare-export - Prepares a fresh Base44 export for local use."
|
|
@echo ""
|
|
@echo " --- DEPLOYMENT ---"
|
|
@echo " make deploy-launchpad - Deploys the internal launchpad (always to dev)."
|
|
@echo " make deploy-app [ENV=staging] - Builds and deploys the main web app (default: dev)."
|
|
@echo ""
|
|
@echo " make help - Shows this help message."
|
|
@echo "--------------------------------------------------"
|
|
|
|
# --- Project Management ---
|
|
setup-labels:
|
|
@echo "--> Setting up GitHub labels..."
|
|
@./scripts/setup-github-labels.sh
|
|
|
|
export-issues:
|
|
@echo "--> Exporting GitHub issues to documentation..."
|
|
@./scripts/export_issues.sh
|
|
|
|
create-issues-from-file:
|
|
@echo "--> Creating GitHub issues from file..."
|
|
@./scripts/create_issues.py
|
|
|
|
# --- Development Tools ---
|
|
install-git-hooks:
|
|
@echo "--> Installing Git hooks..."
|
|
@ln -sf ../../scripts/git-hooks/pre-push .git/hooks/pre-push
|
|
@echo "✅ pre-push hook installed successfully. Direct pushes to 'main' and 'dev' are now blocked."
|
|
|