create-projx 1.6.5 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -37
- package/dist/{baseline-PZM4KJJW.js → baseline-FKCXQFRD.js} +2 -2
- package/dist/{chunk-XQ7FE4U3.js → chunk-N4WD4VN3.js} +158 -19
- package/dist/{chunk-6YRBHJ2V.js → chunk-OLPF7FAN.js} +26 -9
- package/dist/index.js +1607 -603
- package/dist/{utils-AVKSTHIF.js → utils-4G3HNHES.js} +5 -1
- package/package.json +11 -6
- package/src/templates/README.md.ejs +21 -4
- package/src/templates/ci.yml.ejs +167 -37
- package/src/templates/docker-compose.yml.ejs +72 -5
- package/src/templates/pre-commit.ejs +28 -4
- package/src/templates/setup.sh.ejs +75 -1
- package/src/templates/docker-compose.dev.yml.ejs +0 -189
|
@@ -9,6 +9,10 @@ echo "Git hooks configured."
|
|
|
9
9
|
cd <%= inst.path %>
|
|
10
10
|
uv sync --all-extras
|
|
11
11
|
)
|
|
12
|
+
if [ ! -f <%= inst.path %>/.env ] && [ -f <%= inst.path %>/.env.example ]; then
|
|
13
|
+
cp <%= inst.path %>/.env.example <%= inst.path %>/.env
|
|
14
|
+
echo "<%= inst.path %>/.env created from .env.example."
|
|
15
|
+
fi
|
|
12
16
|
echo "<%= inst.display %> dependencies installed."
|
|
13
17
|
<% } %>
|
|
14
18
|
<% for (const inst of fastifyInstances) { %>
|
|
@@ -16,7 +20,73 @@ echo "<%= inst.display %> dependencies installed."
|
|
|
16
20
|
(
|
|
17
21
|
cd <%= inst.path %>
|
|
18
22
|
<%= pm.install %>
|
|
23
|
+
<% if (orm === 'drizzle') { %>
|
|
24
|
+
if [ -f drizzle.config.ts ]; then
|
|
25
|
+
if [ -n "$DATABASE_URL" ]; then
|
|
26
|
+
<%= pm.exec %> drizzle-kit push --force
|
|
27
|
+
else
|
|
28
|
+
echo "<%= inst.display %>: skipping Drizzle schema push (DATABASE_URL not set)."
|
|
29
|
+
fi
|
|
30
|
+
fi
|
|
31
|
+
<% } else if (orm === 'sequelize' || orm === 'typeorm') { %>
|
|
32
|
+
if [ -f scripts/db-sync.ts ]; then
|
|
33
|
+
if [ -n "$DATABASE_URL" ]; then
|
|
34
|
+
<%= pm.exec %> tsx scripts/db-sync.ts
|
|
35
|
+
else
|
|
36
|
+
echo "<%= inst.display %>: skipping schema sync (DATABASE_URL not set)."
|
|
37
|
+
fi
|
|
38
|
+
fi
|
|
39
|
+
<% } else { %>
|
|
40
|
+
if [ -f prisma/schema.prisma ] && [ -z "$(ls -A prisma/migrations 2>/dev/null | grep -v migration_lock.toml)" ]; then
|
|
41
|
+
if [ -n "$DATABASE_URL" ]; then
|
|
42
|
+
<%= pm.exec %> prisma migrate dev --name init --skip-seed
|
|
43
|
+
else
|
|
44
|
+
echo "<%= inst.display %>: skipping initial migration (DATABASE_URL not set)."
|
|
45
|
+
fi
|
|
46
|
+
fi
|
|
47
|
+
<% } %>
|
|
19
48
|
)
|
|
49
|
+
if [ ! -f <%= inst.path %>/.env ] && [ -f <%= inst.path %>/.env.example ]; then
|
|
50
|
+
cp <%= inst.path %>/.env.example <%= inst.path %>/.env
|
|
51
|
+
echo "<%= inst.path %>/.env created from .env.example."
|
|
52
|
+
fi
|
|
53
|
+
echo "<%= inst.display %> dependencies installed."
|
|
54
|
+
<% } %>
|
|
55
|
+
<% for (const inst of expressInstances) { %>
|
|
56
|
+
|
|
57
|
+
(
|
|
58
|
+
cd <%= inst.path %>
|
|
59
|
+
<%= pm.install %>
|
|
60
|
+
<% if (orm === 'drizzle') { %>
|
|
61
|
+
if [ -f drizzle.config.ts ]; then
|
|
62
|
+
if [ -n "$DATABASE_URL" ]; then
|
|
63
|
+
<%= pm.exec %> drizzle-kit push --force
|
|
64
|
+
else
|
|
65
|
+
echo "<%= inst.display %>: skipping Drizzle schema push (DATABASE_URL not set)."
|
|
66
|
+
fi
|
|
67
|
+
fi
|
|
68
|
+
<% } else if (orm === 'sequelize' || orm === 'typeorm') { %>
|
|
69
|
+
if [ -f scripts/db-sync.ts ]; then
|
|
70
|
+
if [ -n "$DATABASE_URL" ]; then
|
|
71
|
+
<%= pm.exec %> tsx scripts/db-sync.ts
|
|
72
|
+
else
|
|
73
|
+
echo "<%= inst.display %>: skipping schema sync (DATABASE_URL not set)."
|
|
74
|
+
fi
|
|
75
|
+
fi
|
|
76
|
+
<% } else { %>
|
|
77
|
+
if [ -f prisma/schema.prisma ] && [ -z "$(ls -A prisma/migrations 2>/dev/null | grep -v migration_lock.toml)" ]; then
|
|
78
|
+
if [ -n "$DATABASE_URL" ]; then
|
|
79
|
+
<%= pm.exec %> prisma migrate dev --name init --skip-seed
|
|
80
|
+
else
|
|
81
|
+
echo "<%= inst.display %>: skipping initial migration (DATABASE_URL not set)."
|
|
82
|
+
fi
|
|
83
|
+
fi
|
|
84
|
+
<% } %>
|
|
85
|
+
)
|
|
86
|
+
if [ ! -f <%= inst.path %>/.env ] && [ -f <%= inst.path %>/.env.example ]; then
|
|
87
|
+
cp <%= inst.path %>/.env.example <%= inst.path %>/.env
|
|
88
|
+
echo "<%= inst.path %>/.env created from .env.example."
|
|
89
|
+
fi
|
|
20
90
|
echo "<%= inst.display %> dependencies installed."
|
|
21
91
|
<% } %>
|
|
22
92
|
<% for (const inst of frontendInstances) { %>
|
|
@@ -25,6 +95,10 @@ echo "<%= inst.display %> dependencies installed."
|
|
|
25
95
|
cd <%= inst.path %>
|
|
26
96
|
<%= pm.install %>
|
|
27
97
|
)
|
|
98
|
+
if [ ! -f <%= inst.path %>/.env ] && [ -f <%= inst.path %>/.env.example ]; then
|
|
99
|
+
cp <%= inst.path %>/.env.example <%= inst.path %>/.env
|
|
100
|
+
echo "<%= inst.path %>/.env created from .env.example."
|
|
101
|
+
fi
|
|
28
102
|
echo "<%= inst.display %> dependencies installed."
|
|
29
103
|
<% } %>
|
|
30
104
|
<% for (const inst of e2eInstances) { %>
|
|
@@ -49,4 +123,4 @@ fi
|
|
|
49
123
|
<% } %>
|
|
50
124
|
|
|
51
125
|
echo ""
|
|
52
|
-
echo "Done.
|
|
126
|
+
echo "Done. Ensure PostgreSQL is running locally, then run '<%= pm.runDev %>' (or 'uv run main.py') in each service."
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
services:
|
|
2
|
-
<% if (fastapiInstances.length > 0 || fastifyInstances.length > 0) { %>
|
|
3
|
-
db:
|
|
4
|
-
image: postgres:16-alpine
|
|
5
|
-
environment:
|
|
6
|
-
POSTGRES_USER: dev
|
|
7
|
-
POSTGRES_PASSWORD: dev
|
|
8
|
-
POSTGRES_DB: app
|
|
9
|
-
ports:
|
|
10
|
-
- '5432:5432'
|
|
11
|
-
volumes:
|
|
12
|
-
- pgdata:/var/lib/postgresql/data
|
|
13
|
-
healthcheck:
|
|
14
|
-
test: ['CMD-SHELL', 'pg_isready -U dev -d app']
|
|
15
|
-
interval: 5s
|
|
16
|
-
timeout: 3s
|
|
17
|
-
retries: 5
|
|
18
|
-
deploy:
|
|
19
|
-
resources:
|
|
20
|
-
limits:
|
|
21
|
-
memory: 256M
|
|
22
|
-
cpus: '0.5'
|
|
23
|
-
networks:
|
|
24
|
-
- app-network
|
|
25
|
-
<% } %>
|
|
26
|
-
<% for (const inst of fastapiInstances) { %>
|
|
27
|
-
<%= inst.path %>-migrate:
|
|
28
|
-
build: ./<%= inst.path %>
|
|
29
|
-
command: ['uv', 'run', 'migrate.py']
|
|
30
|
-
environment:
|
|
31
|
-
- SQLALCHEMY_DATABASE_URI=postgresql+asyncpg://dev:dev@db:5432/app
|
|
32
|
-
depends_on:
|
|
33
|
-
db:
|
|
34
|
-
condition: service_healthy
|
|
35
|
-
deploy:
|
|
36
|
-
resources:
|
|
37
|
-
limits:
|
|
38
|
-
memory: 256M
|
|
39
|
-
cpus: '0.5'
|
|
40
|
-
networks:
|
|
41
|
-
- app-network
|
|
42
|
-
<%= inst.path %>:
|
|
43
|
-
build: ./<%= inst.path %>
|
|
44
|
-
command:
|
|
45
|
-
[
|
|
46
|
-
'uv', 'run', 'uvicorn', 'src.app:app',
|
|
47
|
-
'--host', '0.0.0.0', '--port', '7860',
|
|
48
|
-
'--workers', '2', '--timeout-keep-alive', '120', '--reload',
|
|
49
|
-
]
|
|
50
|
-
<% if (inst.path === inst.type) { %>
|
|
51
|
-
ports:
|
|
52
|
-
- '7860:7860'
|
|
53
|
-
<% } else { %>
|
|
54
|
-
expose:
|
|
55
|
-
- '7860'
|
|
56
|
-
<% } %>
|
|
57
|
-
environment:
|
|
58
|
-
- SQLALCHEMY_DATABASE_URI=postgresql+asyncpg://dev:dev@db:5432/app
|
|
59
|
-
- CORS_ALLOW_ORIGINS=http://localhost:3000,http://localhost
|
|
60
|
-
- JWT_PROVIDER=shared_secret
|
|
61
|
-
- JWT_SECRET=dev-secret-that-is-at-least-32-bytes-long
|
|
62
|
-
- JWT_ALGORITHMS=HS256
|
|
63
|
-
volumes:
|
|
64
|
-
- ./<%= inst.path %>/src:/app/src
|
|
65
|
-
- ./<%= inst.path %>/alembic.ini:/app/alembic.ini
|
|
66
|
-
- ./<%= inst.path %>/migrate.py:/app/migrate.py
|
|
67
|
-
depends_on:
|
|
68
|
-
<%= inst.path %>-migrate:
|
|
69
|
-
condition: service_completed_successfully
|
|
70
|
-
restart: unless-stopped
|
|
71
|
-
healthcheck:
|
|
72
|
-
test:
|
|
73
|
-
[
|
|
74
|
-
'CMD', 'python', '-c',
|
|
75
|
-
"import urllib.request; urllib.request.urlopen('http://localhost:7860/api/health')",
|
|
76
|
-
]
|
|
77
|
-
interval: 15s
|
|
78
|
-
timeout: 5s
|
|
79
|
-
retries: 3
|
|
80
|
-
start_period: 10s
|
|
81
|
-
deploy:
|
|
82
|
-
resources:
|
|
83
|
-
limits:
|
|
84
|
-
memory: 512M
|
|
85
|
-
cpus: '1.0'
|
|
86
|
-
networks:
|
|
87
|
-
- app-network
|
|
88
|
-
<% } %>
|
|
89
|
-
<% for (const inst of fastifyInstances) { %>
|
|
90
|
-
<%= inst.path %>-migrate:
|
|
91
|
-
build: ./<%= inst.path %>
|
|
92
|
-
command: ["sh", "-c", "<%= pm.prismaExec %> migrate deploy"]
|
|
93
|
-
environment:
|
|
94
|
-
- DATABASE_URL=postgresql://dev:dev@db:5432/app
|
|
95
|
-
depends_on:
|
|
96
|
-
db:
|
|
97
|
-
condition: service_healthy
|
|
98
|
-
deploy:
|
|
99
|
-
resources:
|
|
100
|
-
limits:
|
|
101
|
-
memory: 256M
|
|
102
|
-
cpus: '0.5'
|
|
103
|
-
networks:
|
|
104
|
-
- app-network
|
|
105
|
-
<%= inst.path %>:
|
|
106
|
-
build: ./<%= inst.path %>
|
|
107
|
-
command: ["sh", "-c", "<%= pm.runDev %>"]
|
|
108
|
-
<% if (inst.path === inst.type) { %>
|
|
109
|
-
ports:
|
|
110
|
-
- '3000:3000'
|
|
111
|
-
<% } else { %>
|
|
112
|
-
expose:
|
|
113
|
-
- '3000'
|
|
114
|
-
<% } %>
|
|
115
|
-
environment:
|
|
116
|
-
- DATABASE_URL=postgresql://dev:dev@db:5432/app
|
|
117
|
-
- CORS_ALLOW_ORIGINS=http://localhost:5173,http://localhost
|
|
118
|
-
- JWT_PROVIDER=shared_secret
|
|
119
|
-
- JWT_SECRET=dev-secret-that-is-at-least-32-bytes-long
|
|
120
|
-
volumes:
|
|
121
|
-
- ./<%= inst.path %>/src:/app/src
|
|
122
|
-
depends_on:
|
|
123
|
-
<%= inst.path %>-migrate:
|
|
124
|
-
condition: service_completed_successfully
|
|
125
|
-
restart: unless-stopped
|
|
126
|
-
healthcheck:
|
|
127
|
-
test: ['CMD', 'wget', '--spider', '-q', 'http://localhost:3000/api/health']
|
|
128
|
-
interval: 15s
|
|
129
|
-
timeout: 5s
|
|
130
|
-
retries: 3
|
|
131
|
-
start_period: 10s
|
|
132
|
-
deploy:
|
|
133
|
-
resources:
|
|
134
|
-
limits:
|
|
135
|
-
memory: 512M
|
|
136
|
-
cpus: '1.0'
|
|
137
|
-
networks:
|
|
138
|
-
- app-network
|
|
139
|
-
<% } %>
|
|
140
|
-
<% for (const inst of frontendInstances) { %>
|
|
141
|
-
<%= inst.path %>:
|
|
142
|
-
image: node:20-alpine
|
|
143
|
-
working_dir: /app
|
|
144
|
-
command: sh -c "<%= pm.install %> && <%= pm.run %> dev -- --host 0.0.0.0"
|
|
145
|
-
<% if (inst.path === inst.type) { %>
|
|
146
|
-
ports:
|
|
147
|
-
- '5173:5173'
|
|
148
|
-
<% } else { %>
|
|
149
|
-
expose:
|
|
150
|
-
- '5173'
|
|
151
|
-
<% } %>
|
|
152
|
-
env_file:
|
|
153
|
-
- ./<%= inst.path %>/.env
|
|
154
|
-
volumes:
|
|
155
|
-
- ./<%= inst.path %>:/app
|
|
156
|
-
- <%= inst.upper.toLowerCase() %>_node_modules:/app/node_modules
|
|
157
|
-
<% if (fastifyInstances.length > 0) { %>
|
|
158
|
-
depends_on:
|
|
159
|
-
<%= fastifyInstances[0].path %>:
|
|
160
|
-
condition: service_healthy
|
|
161
|
-
<% } else if (fastapiInstances.length > 0) { %>
|
|
162
|
-
depends_on:
|
|
163
|
-
<%= fastapiInstances[0].path %>:
|
|
164
|
-
condition: service_healthy
|
|
165
|
-
<% } %>
|
|
166
|
-
healthcheck:
|
|
167
|
-
test: ['CMD', 'wget', '--spider', '-q', 'http://localhost:5173/']
|
|
168
|
-
interval: 15s
|
|
169
|
-
timeout: 5s
|
|
170
|
-
retries: 3
|
|
171
|
-
start_period: 30s
|
|
172
|
-
deploy:
|
|
173
|
-
resources:
|
|
174
|
-
limits:
|
|
175
|
-
memory: 512M
|
|
176
|
-
cpus: '1.0'
|
|
177
|
-
networks:
|
|
178
|
-
- app-network
|
|
179
|
-
<% } %>
|
|
180
|
-
volumes:
|
|
181
|
-
<% if (fastapiInstances.length > 0 || fastifyInstances.length > 0) { %>
|
|
182
|
-
pgdata:
|
|
183
|
-
<% } %>
|
|
184
|
-
<% for (const inst of frontendInstances) { %>
|
|
185
|
-
<%= inst.upper.toLowerCase() %>_node_modules:
|
|
186
|
-
<% } %>
|
|
187
|
-
networks:
|
|
188
|
-
app-network:
|
|
189
|
-
driver: bridge
|