-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.sh.ejs
More file actions
126 lines (118 loc) · 3.71 KB
/
setup.sh.ejs
File metadata and controls
126 lines (118 loc) · 3.71 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
#!/usr/bin/env bash
set -e
git config core.hooksPath .githooks
echo "Git hooks configured."
<% for (const inst of fastapiInstances) { %>
(
cd <%= inst.path %>
uv sync --all-extras
)
if [ ! -f <%= inst.path %>/.env ] && [ -f <%= inst.path %>/.env.example ]; then
cp <%= inst.path %>/.env.example <%= inst.path %>/.env
echo "<%= inst.path %>/.env created from .env.example."
fi
echo "<%= inst.display %> dependencies installed."
<% } %>
<% for (const inst of fastifyInstances) { %>
(
cd <%= inst.path %>
<%= pm.install %>
<% if (orm === 'drizzle') { %>
if [ -f drizzle.config.ts ]; then
if [ -n "$DATABASE_URL" ]; then
<%= pm.exec %> drizzle-kit push --force
else
echo "<%= inst.display %>: skipping Drizzle schema push (DATABASE_URL not set)."
fi
fi
<% } else if (orm === 'sequelize' || orm === 'typeorm') { %>
if [ -f scripts/db-sync.ts ]; then
if [ -n "$DATABASE_URL" ]; then
<%= pm.exec %> tsx scripts/db-sync.ts
else
echo "<%= inst.display %>: skipping schema sync (DATABASE_URL not set)."
fi
fi
<% } else { %>
if [ -f prisma/schema.prisma ] && [ -z "$(ls -A prisma/migrations 2>/dev/null | grep -v migration_lock.toml)" ]; then
if [ -n "$DATABASE_URL" ]; then
<%= pm.exec %> prisma migrate dev --name init --skip-seed
else
echo "<%= inst.display %>: skipping initial migration (DATABASE_URL not set)."
fi
fi
<% } %>
)
if [ ! -f <%= inst.path %>/.env ] && [ -f <%= inst.path %>/.env.example ]; then
cp <%= inst.path %>/.env.example <%= inst.path %>/.env
echo "<%= inst.path %>/.env created from .env.example."
fi
echo "<%= inst.display %> dependencies installed."
<% } %>
<% for (const inst of expressInstances) { %>
(
cd <%= inst.path %>
<%= pm.install %>
<% if (orm === 'drizzle') { %>
if [ -f drizzle.config.ts ]; then
if [ -n "$DATABASE_URL" ]; then
<%= pm.exec %> drizzle-kit push --force
else
echo "<%= inst.display %>: skipping Drizzle schema push (DATABASE_URL not set)."
fi
fi
<% } else if (orm === 'sequelize' || orm === 'typeorm') { %>
if [ -f scripts/db-sync.ts ]; then
if [ -n "$DATABASE_URL" ]; then
<%= pm.exec %> tsx scripts/db-sync.ts
else
echo "<%= inst.display %>: skipping schema sync (DATABASE_URL not set)."
fi
fi
<% } else { %>
if [ -f prisma/schema.prisma ] && [ -z "$(ls -A prisma/migrations 2>/dev/null | grep -v migration_lock.toml)" ]; then
if [ -n "$DATABASE_URL" ]; then
<%= pm.exec %> prisma migrate dev --name init --skip-seed
else
echo "<%= inst.display %>: skipping initial migration (DATABASE_URL not set)."
fi
fi
<% } %>
)
if [ ! -f <%= inst.path %>/.env ] && [ -f <%= inst.path %>/.env.example ]; then
cp <%= inst.path %>/.env.example <%= inst.path %>/.env
echo "<%= inst.path %>/.env created from .env.example."
fi
echo "<%= inst.display %> dependencies installed."
<% } %>
<% for (const inst of frontendInstances) { %>
(
cd <%= inst.path %>
<%= pm.install %>
)
if [ ! -f <%= inst.path %>/.env ] && [ -f <%= inst.path %>/.env.example ]; then
cp <%= inst.path %>/.env.example <%= inst.path %>/.env
echo "<%= inst.path %>/.env created from .env.example."
fi
echo "<%= inst.display %> dependencies installed."
<% } %>
<% for (const inst of e2eInstances) { %>
(
cd <%= inst.path %>
<%= pm.install %>
)
echo "<%= inst.display %> dependencies installed."
<% } %>
<% for (const inst of mobileInstances) { %>
if command -v flutter &>/dev/null; then
(
cd <%= inst.path %>
flutter pub get
)
echo "<%= inst.display %> dependencies installed."
else
echo "<%= inst.display %> skipped (SDK not installed)."
fi
<% } %>
echo ""
echo "Done. Ensure PostgreSQL is running locally, then run '<%= pm.runDev %>' (or 'uv run main.py') in each service."