popeye-cli 1.7.0 → 1.8.0
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 +102 -5
- package/cheatsheet.md +407 -0
- package/dist/cli/commands/db.d.ts +10 -0
- package/dist/cli/commands/db.d.ts.map +1 -0
- package/dist/cli/commands/db.js +240 -0
- package/dist/cli/commands/db.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +18 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +255 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/index.d.ts +2 -0
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +2 -0
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +3 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/interactive.d.ts.map +1 -1
- package/dist/cli/interactive.js +96 -0
- package/dist/cli/interactive.js.map +1 -1
- package/dist/generators/admin-wizard.d.ts +25 -0
- package/dist/generators/admin-wizard.d.ts.map +1 -0
- package/dist/generators/admin-wizard.js +123 -0
- package/dist/generators/admin-wizard.js.map +1 -0
- package/dist/generators/all.d.ts.map +1 -1
- package/dist/generators/all.js +10 -3
- package/dist/generators/all.js.map +1 -1
- package/dist/generators/database.d.ts +58 -0
- package/dist/generators/database.d.ts.map +1 -0
- package/dist/generators/database.js +229 -0
- package/dist/generators/database.js.map +1 -0
- package/dist/generators/fullstack.d.ts.map +1 -1
- package/dist/generators/fullstack.js +23 -7
- package/dist/generators/fullstack.js.map +1 -1
- package/dist/generators/index.d.ts +2 -0
- package/dist/generators/index.d.ts.map +1 -1
- package/dist/generators/index.js +2 -0
- package/dist/generators/index.js.map +1 -1
- package/dist/generators/templates/admin-wizard-python.d.ts +32 -0
- package/dist/generators/templates/admin-wizard-python.d.ts.map +1 -0
- package/dist/generators/templates/admin-wizard-python.js +425 -0
- package/dist/generators/templates/admin-wizard-python.js.map +1 -0
- package/dist/generators/templates/admin-wizard-react.d.ts +48 -0
- package/dist/generators/templates/admin-wizard-react.d.ts.map +1 -0
- package/dist/generators/templates/admin-wizard-react.js +554 -0
- package/dist/generators/templates/admin-wizard-react.js.map +1 -0
- package/dist/generators/templates/database-docker.d.ts +23 -0
- package/dist/generators/templates/database-docker.d.ts.map +1 -0
- package/dist/generators/templates/database-docker.js +221 -0
- package/dist/generators/templates/database-docker.js.map +1 -0
- package/dist/generators/templates/database-python.d.ts +54 -0
- package/dist/generators/templates/database-python.d.ts.map +1 -0
- package/dist/generators/templates/database-python.js +723 -0
- package/dist/generators/templates/database-python.js.map +1 -0
- package/dist/generators/templates/database-typescript.d.ts +34 -0
- package/dist/generators/templates/database-typescript.d.ts.map +1 -0
- package/dist/generators/templates/database-typescript.js +232 -0
- package/dist/generators/templates/database-typescript.js.map +1 -0
- package/dist/generators/templates/fullstack.d.ts.map +1 -1
- package/dist/generators/templates/fullstack.js +29 -0
- package/dist/generators/templates/fullstack.js.map +1 -1
- package/dist/generators/templates/index.d.ts +5 -0
- package/dist/generators/templates/index.d.ts.map +1 -1
- package/dist/generators/templates/index.js +5 -0
- package/dist/generators/templates/index.js.map +1 -1
- package/dist/state/index.d.ts +10 -0
- package/dist/state/index.d.ts.map +1 -1
- package/dist/state/index.js +21 -0
- package/dist/state/index.js.map +1 -1
- package/dist/types/database-runtime.d.ts +86 -0
- package/dist/types/database-runtime.d.ts.map +1 -0
- package/dist/types/database-runtime.js +61 -0
- package/dist/types/database-runtime.js.map +1 -0
- package/dist/types/database.d.ts +85 -0
- package/dist/types/database.d.ts.map +1 -0
- package/dist/types/database.js +71 -0
- package/dist/types/database.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/workflow.d.ts +21 -0
- package/dist/types/workflow.d.ts.map +1 -1
- package/dist/types/workflow.js +2 -0
- package/dist/types/workflow.js.map +1 -1
- package/dist/workflow/db-setup-runner.d.ts +63 -0
- package/dist/workflow/db-setup-runner.d.ts.map +1 -0
- package/dist/workflow/db-setup-runner.js +336 -0
- package/dist/workflow/db-setup-runner.js.map +1 -0
- package/dist/workflow/db-state-machine.d.ts +30 -0
- package/dist/workflow/db-state-machine.d.ts.map +1 -0
- package/dist/workflow/db-state-machine.js +51 -0
- package/dist/workflow/db-state-machine.js.map +1 -0
- package/dist/workflow/index.d.ts +2 -0
- package/dist/workflow/index.d.ts.map +1 -1
- package/dist/workflow/index.js +2 -0
- package/dist/workflow/index.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/commands/db.ts +281 -0
- package/src/cli/commands/doctor.ts +273 -0
- package/src/cli/commands/index.ts +2 -0
- package/src/cli/index.ts +4 -0
- package/src/cli/interactive.ts +102 -0
- package/src/generators/admin-wizard.ts +146 -0
- package/src/generators/all.ts +10 -3
- package/src/generators/database.ts +286 -0
- package/src/generators/fullstack.ts +26 -9
- package/src/generators/index.ts +12 -0
- package/src/generators/templates/admin-wizard-python.ts +431 -0
- package/src/generators/templates/admin-wizard-react.ts +560 -0
- package/src/generators/templates/database-docker.ts +227 -0
- package/src/generators/templates/database-python.ts +734 -0
- package/src/generators/templates/database-typescript.ts +238 -0
- package/src/generators/templates/fullstack.ts +29 -0
- package/src/generators/templates/index.ts +5 -0
- package/src/state/index.ts +28 -0
- package/src/types/database-runtime.ts +69 -0
- package/src/types/database.ts +84 -0
- package/src/types/index.ts +29 -0
- package/src/types/workflow.ts +5 -0
- package/src/workflow/db-setup-runner.ts +391 -0
- package/src/workflow/db-state-machine.ts +58 -0
- package/src/workflow/index.ts +2 -0
- package/tests/generators/admin-wizard-orchestrator.test.ts +64 -0
- package/tests/generators/admin-wizard-templates.test.ts +366 -0
- package/tests/generators/cross-phase-integration.test.ts +383 -0
- package/tests/generators/database.test.ts +456 -0
- package/tests/generators/fe-be-db-integration.test.ts +613 -0
- package/tests/types/database-runtime.test.ts +158 -0
- package/tests/types/database.test.ts +187 -0
- package/tests/workflow/db-setup-runner.test.ts +211 -0
- package/tests/workflow/db-state-machine.test.ts +117 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Docker-related database template functions
|
|
3
|
+
* Generates PostgreSQL service configs and docker-compose files
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Generate PostgreSQL service YAML block for docker-compose
|
|
8
|
+
*/
|
|
9
|
+
export function generatePostgresServiceYaml(projectName: string): string {
|
|
10
|
+
return ` postgres:
|
|
11
|
+
image: postgres:16-alpine
|
|
12
|
+
container_name: ${projectName}-postgres
|
|
13
|
+
restart: unless-stopped
|
|
14
|
+
environment:
|
|
15
|
+
- POSTGRES_USER=postgres
|
|
16
|
+
- POSTGRES_PASSWORD=postgres
|
|
17
|
+
- POSTGRES_DB=${projectName.replace(/-/g, '_')}_db
|
|
18
|
+
ports:
|
|
19
|
+
- "5432:5432"
|
|
20
|
+
volumes:
|
|
21
|
+
- postgres-data:/var/lib/postgresql/data
|
|
22
|
+
healthcheck:
|
|
23
|
+
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
24
|
+
interval: 5s
|
|
25
|
+
timeout: 5s
|
|
26
|
+
retries: 5`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Generate full docker-compose.yml for fullstack projects with PostgreSQL
|
|
31
|
+
* Preserves all 4 existing services (frontend, backend, frontend-dev, backend-dev)
|
|
32
|
+
* and adds postgres service with proper depends_on
|
|
33
|
+
*/
|
|
34
|
+
export function generateDockerComposeWithDb(projectName: string): string {
|
|
35
|
+
const dbName = projectName.replace(/-/g, '_') + '_db';
|
|
36
|
+
|
|
37
|
+
return `version: "3.8"
|
|
38
|
+
|
|
39
|
+
services:
|
|
40
|
+
frontend:
|
|
41
|
+
build:
|
|
42
|
+
context: ./apps/frontend
|
|
43
|
+
target: production
|
|
44
|
+
container_name: ${projectName}-frontend
|
|
45
|
+
restart: unless-stopped
|
|
46
|
+
ports:
|
|
47
|
+
- "3000:80"
|
|
48
|
+
depends_on:
|
|
49
|
+
- backend
|
|
50
|
+
environment:
|
|
51
|
+
- VITE_API_URL=http://backend:8000
|
|
52
|
+
|
|
53
|
+
backend:
|
|
54
|
+
build:
|
|
55
|
+
context: ./apps/backend
|
|
56
|
+
container_name: ${projectName}-backend
|
|
57
|
+
restart: unless-stopped
|
|
58
|
+
ports:
|
|
59
|
+
- "8000:8000"
|
|
60
|
+
env_file:
|
|
61
|
+
- ./apps/backend/.env
|
|
62
|
+
environment:
|
|
63
|
+
- DATABASE_URL=postgresql+asyncpg://postgres:postgres@postgres:5432/${dbName}
|
|
64
|
+
volumes:
|
|
65
|
+
- backend-data:/app/data
|
|
66
|
+
depends_on:
|
|
67
|
+
postgres:
|
|
68
|
+
condition: service_healthy
|
|
69
|
+
|
|
70
|
+
postgres:
|
|
71
|
+
image: postgres:16-alpine
|
|
72
|
+
container_name: ${projectName}-postgres
|
|
73
|
+
restart: unless-stopped
|
|
74
|
+
environment:
|
|
75
|
+
- POSTGRES_USER=postgres
|
|
76
|
+
- POSTGRES_PASSWORD=postgres
|
|
77
|
+
- POSTGRES_DB=${dbName}
|
|
78
|
+
ports:
|
|
79
|
+
- "5432:5432"
|
|
80
|
+
volumes:
|
|
81
|
+
- postgres-data:/var/lib/postgresql/data
|
|
82
|
+
healthcheck:
|
|
83
|
+
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
84
|
+
interval: 5s
|
|
85
|
+
timeout: 5s
|
|
86
|
+
retries: 5
|
|
87
|
+
|
|
88
|
+
frontend-dev:
|
|
89
|
+
build:
|
|
90
|
+
context: ./apps/frontend
|
|
91
|
+
target: development
|
|
92
|
+
container_name: ${projectName}-frontend-dev
|
|
93
|
+
ports:
|
|
94
|
+
- "5173:5173"
|
|
95
|
+
volumes:
|
|
96
|
+
- ./apps/frontend/src:/app/src
|
|
97
|
+
environment:
|
|
98
|
+
- VITE_API_URL=http://backend:8000
|
|
99
|
+
depends_on:
|
|
100
|
+
- backend
|
|
101
|
+
|
|
102
|
+
backend-dev:
|
|
103
|
+
build:
|
|
104
|
+
context: ./apps/backend
|
|
105
|
+
container_name: ${projectName}-backend-dev
|
|
106
|
+
ports:
|
|
107
|
+
- "8000:8000"
|
|
108
|
+
volumes:
|
|
109
|
+
- ./apps/backend/src:/app/src
|
|
110
|
+
- ./apps/backend/tests:/app/tests
|
|
111
|
+
environment:
|
|
112
|
+
- DATABASE_URL=postgresql+asyncpg://postgres:postgres@postgres:5432/${dbName}
|
|
113
|
+
command: ["uvicorn", "src.backend.main:app", "--reload", "--host", "0.0.0.0", "--port", "8000"]
|
|
114
|
+
depends_on:
|
|
115
|
+
postgres:
|
|
116
|
+
condition: service_healthy
|
|
117
|
+
|
|
118
|
+
volumes:
|
|
119
|
+
backend-data:
|
|
120
|
+
postgres-data:
|
|
121
|
+
`;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Generate full docker-compose.yml for "all" projects (FE + BE + Website + Postgres)
|
|
126
|
+
*/
|
|
127
|
+
export function generateAllDockerComposeWithDb(projectName: string): string {
|
|
128
|
+
const dbName = projectName.replace(/-/g, '_') + '_db';
|
|
129
|
+
|
|
130
|
+
return `version: '3.8'
|
|
131
|
+
|
|
132
|
+
services:
|
|
133
|
+
frontend:
|
|
134
|
+
build:
|
|
135
|
+
context: apps/frontend
|
|
136
|
+
dockerfile: Dockerfile
|
|
137
|
+
ports:
|
|
138
|
+
- "3000:80"
|
|
139
|
+
depends_on:
|
|
140
|
+
- backend
|
|
141
|
+
environment:
|
|
142
|
+
- VITE_API_URL=http://backend:8000
|
|
143
|
+
networks:
|
|
144
|
+
- ${projectName}-network
|
|
145
|
+
|
|
146
|
+
backend:
|
|
147
|
+
build:
|
|
148
|
+
context: apps/backend
|
|
149
|
+
dockerfile: Dockerfile
|
|
150
|
+
ports:
|
|
151
|
+
- "8000:8000"
|
|
152
|
+
environment:
|
|
153
|
+
- DEBUG=false
|
|
154
|
+
- FRONTEND_URL=http://frontend:80
|
|
155
|
+
- WEBSITE_URL=http://website:3000
|
|
156
|
+
- DATABASE_URL=postgresql+asyncpg://postgres:postgres@postgres:5432/${dbName}
|
|
157
|
+
volumes:
|
|
158
|
+
- backend-data:/app/data
|
|
159
|
+
depends_on:
|
|
160
|
+
postgres:
|
|
161
|
+
condition: service_healthy
|
|
162
|
+
networks:
|
|
163
|
+
- ${projectName}-network
|
|
164
|
+
|
|
165
|
+
website:
|
|
166
|
+
build:
|
|
167
|
+
context: apps/website
|
|
168
|
+
dockerfile: Dockerfile
|
|
169
|
+
ports:
|
|
170
|
+
- "3001:3000"
|
|
171
|
+
environment:
|
|
172
|
+
- NODE_ENV=production
|
|
173
|
+
- NEXT_PUBLIC_APP_URL=http://localhost:3000
|
|
174
|
+
networks:
|
|
175
|
+
- ${projectName}-network
|
|
176
|
+
|
|
177
|
+
postgres:
|
|
178
|
+
image: postgres:16-alpine
|
|
179
|
+
container_name: ${projectName}-postgres
|
|
180
|
+
restart: unless-stopped
|
|
181
|
+
environment:
|
|
182
|
+
- POSTGRES_USER=postgres
|
|
183
|
+
- POSTGRES_PASSWORD=postgres
|
|
184
|
+
- POSTGRES_DB=${dbName}
|
|
185
|
+
ports:
|
|
186
|
+
- "5432:5432"
|
|
187
|
+
volumes:
|
|
188
|
+
- postgres-data:/var/lib/postgresql/data
|
|
189
|
+
healthcheck:
|
|
190
|
+
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
191
|
+
interval: 5s
|
|
192
|
+
timeout: 5s
|
|
193
|
+
retries: 5
|
|
194
|
+
networks:
|
|
195
|
+
- ${projectName}-network
|
|
196
|
+
|
|
197
|
+
networks:
|
|
198
|
+
${projectName}-network:
|
|
199
|
+
driver: bridge
|
|
200
|
+
|
|
201
|
+
volumes:
|
|
202
|
+
backend-data:
|
|
203
|
+
postgres-data:
|
|
204
|
+
`;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Generate .env.example content with database variables
|
|
209
|
+
*/
|
|
210
|
+
export function generateDbEnvExample(projectName: string): string {
|
|
211
|
+
const dbName = projectName.replace(/-/g, '_') + '_db';
|
|
212
|
+
|
|
213
|
+
return `DEBUG=true
|
|
214
|
+
|
|
215
|
+
# Database
|
|
216
|
+
DATABASE_URL=postgresql+asyncpg://postgres:postgres@localhost:5432/${dbName}
|
|
217
|
+
POSTGRES_USER=postgres
|
|
218
|
+
POSTGRES_PASSWORD=postgres
|
|
219
|
+
POSTGRES_DB=${dbName}
|
|
220
|
+
|
|
221
|
+
# Vector support
|
|
222
|
+
DB_VECTOR_REQUIRED=true
|
|
223
|
+
|
|
224
|
+
# Admin Wizard
|
|
225
|
+
ADMIN_SETUP_TOKEN=change-me-to-a-random-string
|
|
226
|
+
`;
|
|
227
|
+
}
|