mirror of
https://github.com/Lifeforge-app/lifeforge.git
synced 2026-06-28 06:46:24 +00:00
Former-commit-id: a504d4826bc1d8ec9229c4b95aa0504bddd8fa47 [formerly 8dd5c21431551bdad758f3076a04f4afd6001ecb] [formerly 9e73b6b92f5a786d594ec42da2374087749a8ddb [formerly 01479e4612806cbd58f60fc91e1f1897be418715]] Former-commit-id: 198e32ab33620783d5db20ce00d7318781f33dc7 [formerly 0e462d80f7a1358ca5f0d5f26c18171b6f872f09] Former-commit-id: 44225f3ba5f6e535c893eb8d499ba290066e098b
87 lines
2.5 KiB
Bash
Executable File
87 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Script to loop through all modules in apps directory and commit changes
|
|
# Usage: ./scripts/commit-all-modules.sh
|
|
|
|
set -e # Exit on any error
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
echo -e "${YELLOW}Starting git operations for all modules in apps directory...${NC}"
|
|
|
|
# Get the script directory and navigate to project root
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
|
cd "$PROJECT_ROOT"
|
|
|
|
# Counter for tracking progress
|
|
total_modules=0
|
|
successful_modules=0
|
|
failed_modules=()
|
|
|
|
# First, count total modules (excluding non-directories)
|
|
for module_dir in apps/*/; do
|
|
if [ -d "$module_dir" ]; then
|
|
((total_modules++))
|
|
fi
|
|
done
|
|
|
|
echo -e "${YELLOW}Found $total_modules modules to process${NC}"
|
|
echo ""
|
|
|
|
# Loop through each directory in apps/
|
|
for module_dir in apps/*/; do
|
|
if [ -d "$module_dir" ]; then
|
|
module_name=$(basename "$module_dir")
|
|
|
|
# Skip .DS_Store and other hidden files/directories
|
|
if [[ "$module_name" == .* ]]; then
|
|
continue
|
|
fi
|
|
|
|
echo -e "${YELLOW}Processing module: $module_name${NC}"
|
|
|
|
# Navigate to the module directory
|
|
cd "$module_dir"
|
|
|
|
# Check if there are any changes to commit
|
|
if git diff --quiet && git diff --cached --quiet; then
|
|
echo -e " ${GREEN}✓${NC} No changes to commit in $module_name"
|
|
else
|
|
# Execute git commands
|
|
if git add . && \
|
|
git commit -m "chore: add package.json and update dependencies" && \
|
|
git push origin main; then
|
|
echo -e " ${GREEN}✓${NC} Successfully committed and pushed changes for $module_name"
|
|
((successful_modules++))
|
|
else
|
|
echo -e " ${RED}✗${NC} Failed to process $module_name"
|
|
failed_modules+=("$module_name")
|
|
fi
|
|
fi
|
|
|
|
# Navigate back to project root
|
|
cd "$PROJECT_ROOT"
|
|
echo ""
|
|
fi
|
|
done
|
|
|
|
# Summary
|
|
echo -e "${YELLOW}=== Summary ===${NC}"
|
|
echo -e "Total modules processed: $total_modules"
|
|
echo -e "${GREEN}Successful: $successful_modules${NC}"
|
|
|
|
if [ ${#failed_modules[@]} -gt 0 ]; then
|
|
echo -e "${RED}Failed: ${#failed_modules[@]}${NC}"
|
|
echo -e "${RED}Failed modules:${NC}"
|
|
for failed_module in "${failed_modules[@]}"; do
|
|
echo -e " - $failed_module"
|
|
done
|
|
exit 1
|
|
else
|
|
echo -e "${GREEN}All modules processed successfully!${NC}"
|
|
fi |