# --- Web App Development ---

.PHONY: web-install web-info web-dev web-build web-lint web-preview web-deploy

WEB_DIR := apps/web

# --- General ---
web-install:
	@echo "--> Installing web frontend dependencies..."
	@cd $(WEB_DIR) && pnpm install

web-info:
	@echo "--> Web App Commands:"
	@echo "  make web-install  - Install dependencies"
	@echo "  make web-dev      - Start dev server"
	@echo "  make web-build    - Build for production (ENV=dev|staging)"
	@echo "  make web-lint     - Run linter"
	@echo "  make web-preview  - Preview production build"
	@echo "  make web-deploy   - Build and deploy (ENV=dev|staging)"

web-dev:
	@echo "--> Starting web frontend development server..."
	@cd $(WEB_DIR) && pnpm dev

web-build:
	@echo "--> Building web frontend for [$(ENV)] environment..."
	@cd $(WEB_DIR) && pnpm build -- --mode $(ENV)

web-lint:
	@echo "--> Linting web frontend..."
	@cd $(WEB_DIR) && pnpm lint

web-preview:
	@echo "--> Previewing web frontend build..."
	@cd $(WEB_DIR) && pnpm preview

web-deploy: web-build
	@echo "--> Deploying Web App to [$(ENV)] environment..."
	@firebase deploy --only hosting:$(HOSTING_TARGET) --project=$(FIREBASE_ALIAS)

# Aliases for root level access
install: web-install
dev: web-dev
build: web-build
deploy-app: web-deploy
