-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_package.sh
More file actions
executable file
Β·166 lines (139 loc) Β· 4.3 KB
/
create_package.sh
File metadata and controls
executable file
Β·166 lines (139 loc) Β· 4.3 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
#!/bin/bash
# OCR App - Package Creator
# This script creates a downloadable package of your OCR app
echo "π¦ Creating OCR App Package..."
# Create temporary directory
PACKAGE_DIR="ocr-text-extractor-$(date +%Y%m%d)"
mkdir -p "$PACKAGE_DIR"
echo "π Copying files..."
# Copy backend
cp -r backend "$PACKAGE_DIR/"
rm -rf "$PACKAGE_DIR/backend/__pycache__"
rm -rf "$PACKAGE_DIR/backend/.env" # Don't include .env
# Copy frontend (excluding node_modules and build artifacts)
mkdir -p "$PACKAGE_DIR/frontend"
cp -r frontend/app "$PACKAGE_DIR/frontend/"
cp -r frontend/assets "$PACKAGE_DIR/frontend/"
cp -r frontend/scripts "$PACKAGE_DIR/frontend/"
cp frontend/package.json "$PACKAGE_DIR/frontend/"
cp frontend/app.json "$PACKAGE_DIR/frontend/"
cp frontend/eas.json "$PACKAGE_DIR/frontend/"
cp frontend/tsconfig.json "$PACKAGE_DIR/frontend/"
cp frontend/eslint.config.js "$PACKAGE_DIR/frontend/"
cp frontend/metro.config.js "$PACKAGE_DIR/frontend/"
cp frontend/.gitignore "$PACKAGE_DIR/frontend/"
# Copy documentation
cp BUILD_INSTRUCTIONS.md "$PACKAGE_DIR/"
cp README_APP.md "$PACKAGE_DIR/README.md"
# Create .env template
cat > "$PACKAGE_DIR/frontend/.env.example" << 'EOF'
# Update this with your local backend URL when running
# Find your local IP: ifconfig (Mac/Linux) or ipconfig (Windows)
EXPO_PUBLIC_BACKEND_URL=http://YOUR_LOCAL_IP:8001
EOF
# Create backend .env template
cat > "$PACKAGE_DIR/backend/.env.example" << 'EOF'
# MongoDB URL (optional - only if you want to use MongoDB)
MONGO_URL=mongodb://localhost:27017
DB_NAME=ocr_app
EOF
# Create quick start script for Mac/Linux
cat > "$PACKAGE_DIR/quickstart.sh" << 'EOF'
#!/bin/bash
echo "π OCR Text Extractor - Quick Start"
echo ""
# Check Node.js
if ! command -v node &> /dev/null; then
echo "β Node.js not found. Please install Node.js first."
echo " Download from: https://nodejs.org"
exit 1
fi
# Check Python
if ! command -v python3 &> /dev/null; then
echo "β Python 3 not found. Please install Python 3 first."
exit 1
fi
echo "β
Node.js and Python found"
echo ""
# Setup frontend
echo "π± Setting up Frontend..."
cd frontend
yarn install || npm install
cd ..
# Setup backend
echo "π₯οΈ Setting up Backend..."
cd backend
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cd ..
echo ""
echo "β
Setup complete!"
echo ""
echo "π Next steps:"
echo " 1. Read BUILD_INSTRUCTIONS.md for building the app"
echo " 2. To build for Android: cd frontend && eas build --platform android --profile preview"
echo " 3. To run backend: cd backend && source venv/bin/activate && uvicorn server:app --host 0.0.0.0 --port 8001"
echo ""
EOF
chmod +x "$PACKAGE_DIR/quickstart.sh"
# Create quick start script for Windows
cat > "$PACKAGE_DIR/quickstart.bat" << 'EOF'
@echo off
echo OCR Text Extractor - Quick Start
echo.
REM Check Node.js
where node >nul 2>nul
if %ERRORLEVEL% NEQ 0 (
echo Node.js not found. Please install Node.js first.
echo Download from: https://nodejs.org
exit /b 1
)
REM Check Python
where python >nul 2>nul
if %ERRORLEVEL% NEQ 0 (
echo Python not found. Please install Python 3 first.
exit /b 1
)
echo Node.js and Python found
echo.
REM Setup frontend
echo Setting up Frontend...
cd frontend
call yarn install || call npm install
cd ..
REM Setup backend
echo Setting up Backend...
cd backend
python -m venv venv
call venv\Scripts\activate
pip install -r requirements.txt
cd ..
echo.
echo Setup complete!
echo.
echo Next steps:
echo 1. Read BUILD_INSTRUCTIONS.md for building the app
echo 2. To build for Android: cd frontend ^&^& eas build --platform android --profile preview
echo 3. To run backend: cd backend ^&^& venv\Scripts\activate ^&^& uvicorn server:app --host 0.0.0.0 --port 8001
echo.
pause
EOF
# Create archive
echo "ποΈ Creating archive..."
tar -czf "${PACKAGE_DIR}.tar.gz" "$PACKAGE_DIR"
zip -r "${PACKAGE_DIR}.zip" "$PACKAGE_DIR" > /dev/null 2>&1
echo ""
echo "β
Package created successfully!"
echo ""
echo "π¦ Download one of these files:"
echo " β’ ${PACKAGE_DIR}.tar.gz (Linux/Mac)"
echo " β’ ${PACKAGE_DIR}.zip (Windows/All)"
echo ""
echo "π Location: $(pwd)"
echo ""
echo "π On your laptop:"
echo " 1. Extract the archive"
echo " 2. Run quickstart.sh (Mac/Linux) or quickstart.bat (Windows)"
echo " 3. Follow BUILD_INSTRUCTIONS.md to build the app"
echo ""