-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
177 lines (160 loc) · 6.01 KB
/
Makefile
File metadata and controls
177 lines (160 loc) · 6.01 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
.PHONY: help check check-prereqs init install install-backend install-frontend start-backend start-frontend start test update clean status eject-frontend
help:
@echo "Available commands:"
@echo " make check-prereqs - Check for required tools (git, python3, pip3)"
@echo " make init - Initialize submodules and install all dependencies"
@echo " make install-backend - Install backend dependencies only"
@echo " make install-frontend - Install frontend dependencies only"
@echo " make start - Start application (backend + frontend)"
@echo " make start-backend - Start backend only (port 8081)"
@echo " make start-frontend - Start frontend only (port 8080)"
@echo " make update - Update submodules to latest"
@echo " make clean - Remove venv, node_modules and build artifacts"
@echo " make status - Show git and submodule status"
check-prereqs:
@echo "==> Checking prerequisites..."
@command -v git >/dev/null 2>&1 || { echo "❌ git is required but not installed. Visit https://git-scm.com"; exit 1; }
@command -v python3 >/dev/null 2>&1 || { echo "❌ python3 is required but not installed. Visit https://python.org"; exit 1; }
@command -v pip3 >/dev/null 2>&1 || { echo "❌ pip3 is required but not installed."; exit 1; }
@echo "✓ All prerequisites installed"
@echo ""
check: check-prereqs
init: check-prereqs
@echo "==> Initializing submodules..."
git submodule update --init --recursive
@echo ""
@echo "==> Creating Python virtual environment..."
python3 -m venv venv
@echo ""
@echo "==> Installing Python dependencies..."
./venv/bin/pip install -r requirements.txt
@echo ""
@echo "==> Installing frontend dependencies..."
cd frontend && corepack pnpm install
@echo ""
@echo "✓ Project initialized successfully!"
@echo ""
@echo "Next steps:"
@echo " 1. Copy sample.env to .env and add your DEEPGRAM_API_KEY"
@echo " 2. Run 'make start' to start the application"
@echo ""
install: init
install-backend:
@echo "==> Installing backend dependencies..."
python3 -m venv venv
./venv/bin/pip install -r requirements.txt
install-frontend:
@echo "==> Installing frontend dependencies..."
@if [ ! -d "frontend" ] || [ -z "$$(ls -A frontend)" ]; then \
echo "❌ Error: Frontend submodule not initialized. Run 'make init' first."; \
exit 1; \
fi
cd frontend && corepack pnpm install
start-backend:
@if [ ! -f ".env" ]; then \
echo "❌ Error: .env file not found. Copy sample.env to .env and add your DEEPGRAM_API_KEY"; \
exit 1; \
fi
@echo "==> Starting backend on http://localhost:8081"
./venv/bin/python app.py
start-frontend:
@if [ ! -d "frontend" ] || [ -z "$$(ls -A frontend)" ]; then \
echo "❌ Error: Frontend submodule not initialized. Run 'make init' first."; \
exit 1; \
fi
@echo "==> Starting frontend on http://localhost:8080"
cd frontend && corepack pnpm run dev -- --port 8080 --no-open
start:
@if [ ! -f ".env" ]; then \
echo "❌ Error: .env file not found. Copy sample.env to .env and add your DEEPGRAM_API_KEY"; \
exit 1; \
fi
@if [ ! -d "frontend" ] || [ -z "$$(ls -A frontend)" ]; then \
echo "❌ Error: Frontend submodule not initialized. Run 'make init' first."; \
exit 1; \
fi
@echo "==> Starting application..."
@echo " Backend: http://localhost:8081"
@echo " Frontend: http://localhost:8080"
@echo ""
@$(MAKE) start-backend & $(MAKE) start-frontend & wait
update:
@echo "==> Updating submodules..."
git submodule update --remote --merge
@echo "✓ Submodules updated"
test:
@if [ ! -f ".env" ]; then \
echo "❌ Error: .env file not found. Copy sample.env to .env and add your DEEPGRAM_API_KEY"; \
exit 1; \
fi
@if [ ! -d "contracts" ] || [ -z "$$(ls -A contracts)" ]; then \
echo "❌ Error: Contracts submodule not initialized. Run 'make init' first."; \
exit 1; \
fi
@echo "==> Running contract conformance tests..."
@bash contracts/tests/run-text-intelligence-app.sh
clean:
@echo "==> Cleaning build artifacts..."
rm -rf venv/
rm -rf frontend/node_modules/
rm -rf frontend/.vite/
rm -rf __pycache__/
rm -rf */__pycache__/
rm -rf */*/__pycache__/
@echo "✓ Cleaned successfully"
status:
@echo "==> Repository Status"
@echo "====================="
@echo ""
@echo "Main Repository:"
git status --short
@echo ""
@echo "Submodule Status:"
git submodule status
@echo ""
@echo "Submodule Branches:"
@cd frontend && echo "frontend: $$(git branch --show-current) ($$(git rev-parse --short HEAD))"
eject-frontend:
@echo ""
@echo "⚠️ This will:"
@echo " 1. Copy frontend submodule files into a regular 'frontend/' directory"
@echo " 2. Remove the frontend git submodule configuration"
@echo " 3. Remove the contracts git submodule"
@echo " 4. Remove .gitmodules file"
@echo ""
@echo " After ejecting, frontend changes can be committed directly"
@echo " with your backend changes. This cannot be undone."
@echo ""
@read -p " Continue? [Y/n] " confirm; \
if [ "$$confirm" != "Y" ] && [ "$$confirm" != "y" ] && [ -n "$$confirm" ]; then \
echo " Cancelled."; \
exit 1; \
fi
@echo ""
@echo "==> Ejecting frontend submodule..."
@FRONTEND_TMP=$$(mktemp -d); \
cp -r frontend/. "$$FRONTEND_TMP/"; \
git submodule deinit -f frontend; \
git rm -f frontend; \
rm -rf .git/modules/frontend; \
mkdir -p frontend; \
cp -r "$$FRONTEND_TMP/." frontend/; \
rm -rf "$$FRONTEND_TMP"; \
rm -rf frontend/.git; \
echo " ✅ Frontend ejected to regular directory"
@echo "==> Removing contracts submodule..."
@if git config --file .gitmodules submodule.contracts.url > /dev/null 2>&1; then \
git submodule deinit -f contracts; \
git rm -f contracts; \
rm -rf .git/modules/contracts; \
echo " ✅ Contracts submodule removed"; \
else \
echo " ℹ️ No contracts submodule found"; \
fi
@if [ -f .gitmodules ] && [ ! -s .gitmodules ]; then \
git rm -f .gitmodules; \
echo " ✅ Empty .gitmodules removed"; \
fi
@echo ""
@echo "✅ Eject complete! Frontend files are now regular tracked files."
@echo " Run 'git add . && git commit' to save the changes."