chore: Refactor mobile build scripts to use Melos
Updated Makefile, mobile.mk, and melos.yaml to centralize mobile app build, start, and code generation commands using Melos scripts. Added info and install-melos commands for easier onboarding and workspace setup. Documentation updated to reflect staff app naming and new command structure.
This commit is contained in:
13
Makefile
13
Makefile
@@ -28,18 +28,19 @@ help:
|
||||
@echo " make launchpad-dev - Starts the local launchpad server (Firebase Hosting emulator)."
|
||||
@echo ""
|
||||
@echo " --- MOBILE APP DEVELOPMENT ---"
|
||||
@echo " make mobile-client-install - Install dependencies for client app"
|
||||
@echo " make mobile-client-dev - Run client app in dev mode"
|
||||
@echo " make mobile-client-build - Build client app (requires ENV & PLATFORM)"
|
||||
@echo " make mobile-staff-install - Install dependencies for staff app"
|
||||
@echo " make mobile-staff-dev - Run staff app in dev mode"
|
||||
@echo " make mobile-staff-build - Build staff app (requires ENV & PLATFORM)"
|
||||
@echo " make mobile-install - Bootstrap the mobile workspace (Melos)."
|
||||
@echo " make mobile-info - List custom mobile development commands."
|
||||
@echo " make mobile-client-dev-android - Run client app in dev mode (Android)."
|
||||
@echo " make mobile-client-build PLATFORM=apk - Build client app for specified platform."
|
||||
@echo " make mobile-staff-dev-android - Run staff app in dev mode (Android)."
|
||||
@echo " make mobile-staff-build PLATFORM=apk - Build staff app for specified platform."
|
||||
@echo ""
|
||||
@echo " --- DEPLOYMENT ---"
|
||||
@echo " make deploy-launchpad-hosting - Deploys internal launchpad to Firebase Hosting."
|
||||
@echo " make deploy-app [ENV=staging] - Builds and deploys the main web app (default: dev)."
|
||||
@echo ""
|
||||
@echo " --- DEVELOPMENT TOOLS ---"
|
||||
@echo " make install-melos - Installs Melos globally if not already present."
|
||||
@echo " make install-git-hooks - Installs git pre-push hook to protect main/dev branches."
|
||||
@echo " make sync-prototypes - Builds and copies prototypes from adjacent 'client-krow-poc' repo."
|
||||
@echo ""
|
||||
|
||||
@@ -9,6 +9,27 @@ command:
|
||||
usePubspecOverrides: true
|
||||
|
||||
scripts:
|
||||
info:
|
||||
run: |
|
||||
echo " 🚀 KROW WORKFORCE CUSTOM COMMANDS 🚀"
|
||||
echo "============================================================"
|
||||
echo " BUILD COMMANDS:"
|
||||
echo " - melos run build:client : Build Client App (APK)"
|
||||
echo " - melos run build:staff : Build Staff App (APK)"
|
||||
echo " - melos run build:design-system : Build Design System Viewer"
|
||||
echo ""
|
||||
echo " DEBUG/START COMMANDS:"
|
||||
echo " - melos run start:client -- -d <ID> : Run Client App"
|
||||
echo " - melos run start:staff -- -d <ID> : Run Staff App"
|
||||
echo " - melos run start:design-system : Run DS Viewer"
|
||||
echo " (e.g., melos run start:client -- -d chrome)"
|
||||
echo ""
|
||||
echo " CODE GENERATION:"
|
||||
echo " - melos run gen:l10n : Generate Slang l10n"
|
||||
echo " - melos run gen:build : Run build_runner"
|
||||
echo "============================================================"
|
||||
description: "Display information about available custom Melos commands."
|
||||
|
||||
gen:l10n:
|
||||
exec: dart run slang
|
||||
description: "Generate localization files using Slang across all packages."
|
||||
@@ -20,3 +41,33 @@ scripts:
|
||||
description: "Run build_runner build across all packages."
|
||||
packageFilters:
|
||||
dependsOn: build_runner
|
||||
|
||||
build:client:
|
||||
run: |
|
||||
melos run gen:l10n --filter="core_localization"
|
||||
melos run gen:build --filter="core_localization"
|
||||
melos exec --scope="krowwithus_client" -- "flutter build apk"
|
||||
description: "Build the Client app (Android APK by default)."
|
||||
|
||||
build:staff:
|
||||
run: |
|
||||
melos run gen:l10n --filter="core_localization"
|
||||
melos run gen:build --filter="core_localization"
|
||||
melos exec --scope="krowwithus_staff" -- "flutter build apk"
|
||||
description: "Build the Staff app (Android APK by default)."
|
||||
|
||||
build:design-system-viewer:
|
||||
run: melos exec --scope="design_system_viewer" -- "flutter build apk"
|
||||
description: "Build the Design System Viewer app (Android APK by default)."
|
||||
|
||||
start:client:
|
||||
run: melos exec --scope="krowwithus_client" -- "flutter run"
|
||||
description: "Start the Client app. Pass platform using -- -d <platform>, e.g. -d chrome"
|
||||
|
||||
start:staff:
|
||||
run: melos exec --scope="krowwithus_staff" -- "flutter run"
|
||||
description: "Start the Staff app. Pass platform using -- -d <platform>, e.g. -d chrome"
|
||||
|
||||
start:design-system-viewer:
|
||||
run: melos exec --scope="design_system_viewer" -- "flutter run"
|
||||
description: "Start the Design System Viewer app. Pass platform using -- -d <platform>, e.g. -d chrome"
|
||||
|
||||
@@ -20,3 +20,68 @@ workspace:
|
||||
|
||||
dev_dependencies:
|
||||
melos: ^7.3.0
|
||||
|
||||
melos:
|
||||
scripts:
|
||||
info:
|
||||
run: |
|
||||
echo " 🚀 KROW WORKFORCE CUSTOM COMMANDS 🚀"
|
||||
echo "============================================================"
|
||||
echo " BUILD COMMANDS:"
|
||||
echo " - melos run build:client : Build Client App (APK)"
|
||||
echo " - melos run build:staff : Build Staff App (APK)"
|
||||
echo " - melos run build:design-system : Build Design System Viewer"
|
||||
echo ""
|
||||
echo " DEBUG/START COMMANDS:"
|
||||
echo " - melos run start:client -- -d <ID> : Run Client App"
|
||||
echo " - melos run start:staff -- -d <ID> : Run Staff App"
|
||||
echo " - melos run start:design-system : Run DS Viewer"
|
||||
echo " (e.g., melos run start:client -- -d chrome)"
|
||||
echo ""
|
||||
echo " CODE GENERATION:"
|
||||
echo " - melos run gen:l10n : Generate Slang l10n"
|
||||
echo " - melos run gen:build : Run build_runner"
|
||||
echo "============================================================"
|
||||
description: "Display information about available custom Melos commands."
|
||||
|
||||
gen:l10n:
|
||||
exec: dart run slang
|
||||
description: "Generate localization files using Slang across all packages."
|
||||
packageFilters:
|
||||
dependsOn: slang
|
||||
|
||||
gen:build:
|
||||
exec: dart run build_runner build --delete-conflicting-outputs
|
||||
description: "Run build_runner build across all packages."
|
||||
packageFilters:
|
||||
dependsOn: build_runner
|
||||
|
||||
build:client:
|
||||
run: |
|
||||
melos run gen:l10n --filter="core_localization"
|
||||
melos run gen:build --filter="core_localization"
|
||||
melos exec --scope="krowwithus_client" -- "flutter build apk"
|
||||
description: "Build the Client app (Android APK by default)."
|
||||
|
||||
build:staff:
|
||||
run: |
|
||||
melos run gen:l10n --filter="core_localization"
|
||||
melos run gen:build --filter="core_localization"
|
||||
melos exec --scope="krowwithus_staff" -- "flutter build apk"
|
||||
description: "Build the Staff app (Android APK by default)."
|
||||
|
||||
build:design-system:
|
||||
run: melos exec --scope="design_system_viewer" -- "flutter build apk"
|
||||
description: "Build the Design System Viewer app (Android APK by default)."
|
||||
|
||||
start:client:
|
||||
run: melos exec --scope="krowwithus_client" -- "flutter run"
|
||||
description: "Start the Client app. Pass platform using -- -d <platform>, e.g. -d chrome"
|
||||
|
||||
start:staff:
|
||||
run: melos exec --scope="krowwithus_staff" -- "flutter run"
|
||||
description: "Start the Staff app. Pass platform using -- -d <platform>, e.g. -d chrome"
|
||||
|
||||
start:design-system:
|
||||
run: melos exec --scope="design_system_viewer" -- "flutter run"
|
||||
description: "Start the Design System Viewer app. Pass platform using -- -d <platform>, e.g. -d chrome"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# KROW Workforce Platform - Project Onboarding Master Document
|
||||
|
||||
> **Version:** 1.0
|
||||
> **Last Updated:** 2026-01-11
|
||||
> **Version:** 1.1
|
||||
> **Last Updated:** 2026-01-22
|
||||
> **Purpose:** Source of Truth for Team Onboarding & Sprint Planning
|
||||
|
||||
---
|
||||
@@ -173,7 +173,7 @@ graph TB
|
||||
│ ├── mobile/
|
||||
| | ├── apps/
|
||||
| | │ ├── client/ # Flutter (business app)
|
||||
| | │ └── worker/ # Flutter (worker app)
|
||||
| | │ └── staff/ # Flutter (staff app)
|
||||
├── backend/
|
||||
│ ├── dataconnect/ # Firebase Data Connect schemas
|
||||
│ └── functions/ # Cloud Functions
|
||||
@@ -312,7 +312,7 @@ sequenceDiagram
|
||||
participant Client as Client App
|
||||
participant API as Backend API
|
||||
participant Admin as Admin
|
||||
participant Staff as Worker App
|
||||
participant Staff as Staff App
|
||||
|
||||
Note over Client,API: 1. Event Creation
|
||||
Client->>API: Create Event with Shifts & Positions
|
||||
@@ -706,9 +706,9 @@ These **must be ported** from legacy:
|
||||
|
||||
---
|
||||
|
||||
#### 4.7.2 Mobile Worker App (Flutter)
|
||||
#### 4.7.2 Mobile Staff App (Flutter)
|
||||
|
||||
**Location:** `internal/launchpad/prototypes-src/mobile/apps/worker/`
|
||||
**Location:** `internal/launchpad/prototypes-src/mobile/apps/staff/`
|
||||
|
||||
**Routes (35+ screens):**
|
||||
|
||||
|
||||
@@ -1,68 +1,44 @@
|
||||
# --- Mobile App Development ---
|
||||
|
||||
.PHONY: mobile-client-install mobile-client-dev mobile-client-build mobile-staff-install mobile-staff-dev mobile-staff-build
|
||||
.PHONY: mobile-install mobile-info mobile-client-dev-android mobile-staff-dev-android mobile-client-build mobile-staff-build
|
||||
|
||||
FLAVOR :=
|
||||
ifeq ($(ENV),dev)
|
||||
FLAVOR := dev
|
||||
else ifeq ($(ENV),staging)
|
||||
FLAVOR := staging
|
||||
else ifeq ($(ENV),prod)
|
||||
FLAVOR := production
|
||||
endif
|
||||
MOBILE_DIR := apps/mobile
|
||||
|
||||
BUILD_TYPE ?= appbundle
|
||||
# --- General ---
|
||||
mobile-install: install-melos
|
||||
@echo "--> Bootstrapping mobile workspace (Melos)..."
|
||||
@cd $(MOBILE_DIR) && melos bootstrap
|
||||
|
||||
mobile-info:
|
||||
@echo "--> Fetching mobile command info..."
|
||||
@cd $(MOBILE_DIR) && melos run info
|
||||
|
||||
# --- Client App ---
|
||||
mobile-client-install:
|
||||
@echo "--> Installing Flutter dependencies for client app..."
|
||||
@cd apps/mobile-client && $(FLUTTER) pub get
|
||||
|
||||
mobile-client-dev:
|
||||
@echo "--> Running client app in dev mode..."
|
||||
@echo "--> If using VS code, use the debug configurations"
|
||||
@cd apps/mobile-client && $(FLUTTER) run --flavor dev -t lib/main_dev.dart
|
||||
mobile-client-dev-android:
|
||||
@echo "--> Running client app on Android..."
|
||||
@cd $(MOBILE_DIR) && melos run start:client -- -d android
|
||||
|
||||
mobile-client-build:
|
||||
@if [ "$(ENV)" != "dev" ] && [ "$(ENV)" != "staging" ] && [ "$(ENV)" != "prod" ]; then \
|
||||
echo "ERROR: ENV must be one of dev, staging, or prod."; exit 1; \
|
||||
@if [ -z "$(PLATFORM)" ]; then \
|
||||
echo "ERROR: PLATFORM is required (e.g. make mobile-client-build PLATFORM=apk)"; exit 1; \
|
||||
fi
|
||||
@if [ "$(PLATFORM)" != "android" ] && [ "$(PLATFORM)" != "ios" ]; then \
|
||||
echo "ERROR: PLATFORM must be either android or ios."; exit 1; \
|
||||
fi
|
||||
@echo "--> Building client app for $(PLATFORM) with flavor $(FLAVOR)..."
|
||||
@cd apps/mobile-client && \
|
||||
$(FLUTTER) pub get && \
|
||||
$(FLUTTER) pub run build_runner build --delete-conflicting-outputs && \
|
||||
if [ "$(PLATFORM)" = "android" ]; then \
|
||||
$(FLUTTER) build $(BUILD_TYPE) --flavor $(FLAVOR); \
|
||||
elif [ "$(PLATFORM)" = "ios" ]; then \
|
||||
$(FLUTTER) build ipa --flavor $(FLAVOR); \
|
||||
fi
|
||||
@echo "--> Building client app for $(PLATFORM)..."
|
||||
@cd $(MOBILE_DIR) && \
|
||||
melos run gen:l10n --filter="core_localization" && \
|
||||
melos run gen:build --filter="core_localization" && \
|
||||
melos exec --scope="krowwithus_client" -- "flutter build $(PLATFORM)"
|
||||
|
||||
# --- Staff App ---
|
||||
mobile-staff-install:
|
||||
@echo "--> Installing Flutter dependencies for staff app..."
|
||||
@cd apps/mobile-staff && $(FLUTTER) pub get
|
||||
|
||||
mobile-staff-dev:
|
||||
@echo "--> Running staff app in dev mode..."
|
||||
@echo "--> If using VS code, use the debug configurations"
|
||||
@cd apps/mobile-staff && $(FLUTTER) run --flavor dev -t lib/main_dev.dart
|
||||
mobile-staff-dev-android:
|
||||
@echo "--> Running staff app on Android..."
|
||||
@cd $(MOBILE_DIR) && melos run start:staff -- -d android
|
||||
|
||||
mobile-staff-build:
|
||||
@if [ "$(ENV)" != "dev" ] && [ "$(ENV)" != "staging" ] && [ "$(ENV)" != "prod" ]; then \
|
||||
echo "ERROR: ENV must be one of dev, staging, or prod."; exit 1; \
|
||||
@if [ -z "$(PLATFORM)" ]; then \
|
||||
echo "ERROR: PLATFORM is required (e.g. make mobile-staff-build PLATFORM=apk)"; exit 1; \
|
||||
fi
|
||||
@if [ "$(PLATFORM)" != "android" ] && [ "$(PLATFORM)" != "ios" ]; then \
|
||||
echo "ERROR: PLATFORM must be either android or ios."; exit 1; \
|
||||
fi
|
||||
@echo "--> Building staff app for $(PLATFORM) with flavor $(FLAVOR)..."
|
||||
@cd apps/mobile-staff && \
|
||||
$(FLUTTER) pub get && \
|
||||
$(FLUTTER) pub run build_runner build --delete-conflicting-outputs && \
|
||||
if [ "$(PLATFORM)" = "android" ]; then \
|
||||
$(FLUTTER) build $(BUILD_TYPE) --flavor $(FLAVOR); \
|
||||
elif [ "$(PLATFORM)" = "ios" ]; then \
|
||||
$(FLUTTER) build ipa --flavor $(FLAVOR); \
|
||||
fi
|
||||
@echo "--> Building staff app for $(PLATFORM)..."
|
||||
@cd $(MOBILE_DIR) && \
|
||||
melos run gen:l10n --filter="core_localization" && \
|
||||
melos run gen:build --filter="core_localization" && \
|
||||
melos exec --scope="krowwithus_staff" -- "flutter build $(PLATFORM)"
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
# --- Development Tools ---
|
||||
|
||||
.PHONY: install-git-hooks sync-prototypes
|
||||
.PHONY: install-git-hooks sync-prototypes install-melos
|
||||
|
||||
install-melos:
|
||||
@if ! command -v melos >/dev/null 2>&1; then \
|
||||
echo "--> Melos not found. Installing globally via dart pub..."; \
|
||||
dart pub global activate melos; \
|
||||
else \
|
||||
echo "✅ Melos is already installed."; \
|
||||
fi
|
||||
|
||||
install-git-hooks:
|
||||
@echo "--> Installing Git hooks..."
|
||||
|
||||
Reference in New Issue
Block a user