Repository navigation
Expand file tree
/
Copy pathinit-new-project.sh
More file actions
executable file
·185 lines (156 loc) · 5.5 KB
/
Copy pathinit-new-project.sh
File metadata and controls
executable file
·185 lines (156 loc) · 5.5 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#!/bin/bash
# =============================================================================
# RepStack - New Project Initialization Script
# =============================================================================
# This script prepares a cloned RepStack template for a new project by:
# 1. Removing git history and starting fresh
# 2. Creating environment files from examples
# 3. Updating project name placeholders (uses current directory name)
# 4. Configuring admin console
# =============================================================================
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Print colored output
print_step() {
echo -e "${BLUE}==>${NC} $1"
}
print_success() {
echo -e "${GREEN}✓${NC} $1"
}
print_warning() {
echo -e "${YELLOW}!${NC} $1"
}
print_error() {
echo -e "${RED}✗${NC} $1"
}
# Header
echo ""
echo "=============================================="
echo " RepStack - New Project Setup"
echo "=============================================="
echo ""
# Get project name from current directory
PROJECT_NAME=$(basename "$(pwd)")
echo "Project name (from directory): $PROJECT_NAME"
echo ""
# Check if we're in a git repository
if [ ! -d ".git" ]; then
print_warning "No .git directory found. Initializing new repository..."
git init
print_success "Git repository initialized"
else
# Step 1: Remove existing git history and start fresh
print_step "Step 1: Removing git history and starting fresh..."
rm -rf .git
git init
print_success "Git history removed and new repository initialized"
fi
echo ""
# Make all shell scripts executable
print_step "Making all shell scripts executable..."
find . -name "*.sh" -type f -exec chmod +x {} \;
print_success "All .sh files are now executable"
# Make Python scripts in scripts/ executable
print_step "Making Python scripts executable..."
find ./scripts -name "*.py" -type f -exec chmod +x {} \;
print_success "All Python scripts in scripts/ are now executable"
echo ""
# Step 2: Create environment file
print_step "Step 2: Creating environment file from example..."
if [ -f ".env.example" ]; then
cp .env.example .env
print_success "Created .env (unified environment file)"
else
print_warning ".env.example not found"
fi
echo ""
# Step 3: Update project name
print_step "Step 3: Updating project name to '$PROJECT_NAME'..."
# Update common files
if [ -f "frontend/app/layout.tsx" ]; then
sed -i '' "s/Template App/$PROJECT_NAME/g" frontend/app/layout.tsx 2>/dev/null || \
sed -i "s/Template App/$PROJECT_NAME/g" frontend/app/layout.tsx
print_success "Updated frontend/app/layout.tsx"
fi
if [ -f "frontend/components/Navbar.tsx" ]; then
sed -i '' "s/Template App/$PROJECT_NAME/g" frontend/components/Navbar.tsx 2>/dev/null || \
sed -i "s/Template App/$PROJECT_NAME/g" frontend/components/Navbar.tsx
print_success "Updated frontend/components/Navbar.tsx"
fi
if [ -f "frontend/app/page.tsx" ]; then
sed -i '' "s/Template App/$PROJECT_NAME/g" frontend/app/page.tsx 2>/dev/null || \
sed -i "s/Template App/$PROJECT_NAME/g" frontend/app/page.tsx
print_success "Updated frontend/app/page.tsx"
fi
if [ -f ".env" ]; then
sed -i '' "s/Template API/$PROJECT_NAME API/g" .env 2>/dev/null || \
sed -i "s/Template API/$PROJECT_NAME API/g" .env
print_success "Updated .env"
fi
if [ -f "README.md" ]; then
sed -i '' "s/RepStack/$PROJECT_NAME/g" README.md 2>/dev/null || \
sed -i "s/RepStack/$PROJECT_NAME/g" README.md
print_success "Updated README.md"
fi
print_success "Project name updated to: $PROJECT_NAME"
echo ""
# Step 4: Admin Console Setup Info
print_step "Step 4: Admin Console Info..."
if [ -d "admin" ]; then
print_success "Admin directory detected"
print_warning "Configure these in .env later when ready:"
echo " - ADMIN_EMAILS=your-email@example.com"
echo " - WEBSITE_URL=https://yourdomain.com"
echo ""
print_warning "When ready, install dependencies manually:"
echo " - cd admin/frontend && npm install"
echo " - pip3 install playwright && playwright install chromium (optional)"
else
print_warning "No admin directory found - skipping admin configuration"
fi
echo ""
# Summary
echo "=============================================="
echo " Setup Complete!"
echo "=============================================="
echo ""
echo "Next steps:"
echo ""
echo "1. Update the unified environment file with your actual values:"
echo " - .env (in root directory - used by frontend, backend, and iOS)"
echo ""
echo "2. Follow the setup guide:"
echo " - docs/setup.md"
echo ""
echo "3. Test locally:"
echo " Terminal 1: cd backend && pip install -r requirements.txt && uvicorn app.main:app --reload --port 8002"
echo " Terminal 2: cd frontend && npm install && npm run dev"
if [ -d "admin" ]; then
echo " Terminal 3: cd admin/frontend && npm install && npm run dev"
fi
echo ""
if [ -d "ios" ]; then
echo "4. When ready for iOS development, run:"
echo " ./configure-ios.sh"
echo ""
fi
echo "5. Add a remote repository when ready:"
echo " git remote add origin https://github.com/USERNAME/REPO.git"
echo ""
echo "6. Deploy:"
echo " - Frontend: Connect to Vercel (docs/deployment.md)"
echo " - Backend: Connect to Digital Ocean (docs/deployment.md)"
if [ -d "admin" ]; then
echo " - Admin: Deploy admin/frontend to Vercel as admin.yourdomain.com"
fi
if [ -d "ios" ]; then
echo " - iOS: cd ios && ./scripts/archive.sh"
fi
echo ""
print_success "Happy coding!"
echo ""