-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_monorepo.sh
More file actions
147 lines (125 loc) Β· 4.26 KB
/
setup_monorepo.sh
File metadata and controls
147 lines (125 loc) Β· 4.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/bash
# Setup script for iMessageUSDC monorepo with EthereumKit
# Run this from your project root directory
set -e # Exit on error
echo "π Setting up iMessageUSDC Monorepo Structure..."
echo ""
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Function to check if file exists
check_file() {
if [ -f "$1" ]; then
echo -e "${GREEN}β${NC} Found: $1"
return 0
else
echo -e "${RED}β${NC} Missing: $1"
return 1
fi
}
echo "π Checking Project Structure..."
echo ""
# Check main project files
check_file "iMessageUSDC.xcodeproj/project.pbxproj" || echo " β Run this script from your project root"
# Check EthereumKit
if [ -d "EthereumKit" ]; then
echo -e "${GREEN}β${NC} Found: EthereumKit/"
check_file "EthereumKit/Package.swift"
check_file "EthereumKit/Sources/EthereumKit/JSONRPCClient.swift"
check_file "EthereumKit/Sources/EthereumKit/EthereumService.swift"
check_file "EthereumKit/Sources/EthereumKit/HexUtils.swift"
else
echo -e "${RED}β${NC} Missing: EthereumKit/"
echo " β Make sure EthereumKit package is in your project root"
fi
echo ""
echo "π Setting up .gitignore files..."
echo ""
# Setup main project .gitignore
if [ ! -f ".gitignore" ]; then
echo "Creating root .gitignore..."
cp MainProject-gitignore.txt .gitignore
echo -e "${GREEN}β${NC} Created .gitignore"
else
echo -e "${YELLOW}β ${NC} .gitignore already exists"
echo " β Review MainProject-gitignore.txt and merge if needed"
fi
# Setup EthereumKit .gitignore
if [ -d "EthereumKit" ]; then
if [ ! -f "EthereumKit/.gitignore" ]; then
echo "Creating EthereumKit/.gitignore..."
cp EthereumKit-gitignore.txt EthereumKit/.gitignore
echo -e "${GREEN}β${NC} Created EthereumKit/.gitignore"
else
echo -e "${YELLOW}β ${NC} EthereumKit/.gitignore already exists"
echo " β Review EthereumKit-gitignore.txt and merge if needed"
fi
fi
echo ""
echo "ποΈ Checking for files that should be ignored..."
echo ""
# Check for files that should be in .gitignore
if [ -d ".build" ]; then
echo -e "${YELLOW}β ${NC} Found .build/ directory (should be ignored)"
fi
if [ -d "DerivedData" ]; then
echo -e "${YELLOW}β ${NC} Found DerivedData/ directory (should be ignored)"
fi
if [ -d "xcuserdata" ]; then
echo -e "${YELLOW}β ${NC} Found xcuserdata/ directory (should be ignored)"
fi
if [ -f ".DS_Store" ]; then
echo -e "${YELLOW}β ${NC} Found .DS_Store files (should be ignored)"
fi
echo ""
echo "π§Ή Cleaning up unnecessary files..."
echo ""
# Remove common files that shouldn't be committed
find . -name ".DS_Store" -delete 2>/dev/null && echo "Removed .DS_Store files" || true
find . -name "*.swp" -delete 2>/dev/null && echo "Removed swap files" || true
echo ""
echo "π¦ Recommended Git Workflow:"
echo ""
echo "1. Initialize git (if not already done):"
echo -e " ${BLUE}git init${NC}"
echo ""
echo "2. Add EthereumKit as part of your repo:"
echo -e " ${BLUE}git add EthereumKit/${NC}"
echo ""
echo "3. Check what will be committed:"
echo -e " ${BLUE}git status${NC}"
echo ""
echo "4. Make your first commit:"
echo -e " ${BLUE}git add .${NC}"
echo -e " ${BLUE}git commit -m \"Initial commit with EthereumKit package\"${NC}"
echo ""
echo "5. Create a repo on GitHub and push:"
echo -e " ${BLUE}git remote add origin https://github.com/yourusername/iMessageUSDC.git${NC}"
echo -e " ${BLUE}git branch -M main${NC}"
echo -e " ${BLUE}git push -u origin main${NC}"
echo ""
echo "β
Setup complete!"
echo ""
echo "π What's in your monorepo:"
echo " β’ Main iMessage app code"
echo " β’ EthereumKit Swift Package (local)"
echo " β’ Shared resources and documentation"
echo ""
echo "π Security Reminder:"
echo " β’ Never commit API keys or secrets"
echo " β’ Use .env files or Config.xcconfig for sensitive data"
echo " β’ Review files before committing: git status"
echo ""
# Check if git is initialized
if [ -d ".git" ]; then
echo "π Current git status:"
echo ""
git status --short
else
echo -e "${YELLOW}β ${NC} Git not initialized. Run 'git init' to start version control."
fi
echo ""
echo "π All done! Your project is ready for version control."