create-wakii-stack 0.1.3 → 0.1.4
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/dist/index.js +26 -11
- package/package.json +1 -1
- package/stack-template/stack-manifest.json +11 -0
package/dist/index.js
CHANGED
|
@@ -186,7 +186,20 @@ function pruneEnv(text, keys) {
|
|
|
186
186
|
}).join("\n").replace(/\n{3,}/g, "\n\n");
|
|
187
187
|
}
|
|
188
188
|
function renderReadme(manifest, selection) {
|
|
189
|
-
const
|
|
189
|
+
const gatewayUrl = manifest.ports?.gateway ?? "http://localhost:8080";
|
|
190
|
+
const chosen = new Set(selection.services);
|
|
191
|
+
const ports = Object.entries(manifest.ports ?? {}).filter(([name]) => chosen.has(name)).map(([name, url]) => {
|
|
192
|
+
const note = name === "gateway" ? " \u2014 entry duy nh\u1EA5t: `/` = FE shell, `/api/*` = services" : name === "shell" ? " \u2014 static-only (login \u1EDF \u0111\xE2y b\xE1o 405 \u2014 d\xF9ng gateway)" : "";
|
|
193
|
+
return `- ${name}: ${url}${note}`;
|
|
194
|
+
}).join("\n");
|
|
195
|
+
const access = chosen.has("gateway") ? `## Truy c\u1EADp (sau khi up)
|
|
196
|
+
|
|
197
|
+
M\u1EDF **${gatewayUrl}** (gateway) \u2014 entry duy nh\u1EA5t: \`/\` l\xE0 FE shell, \`/api/*\` l\xE0 c\xE1c service.
|
|
198
|
+
|
|
199
|
+
- Ch\u01B0a c\xF3 t\xE0i kho\u1EA3n? auth-svc KH\xD4NG seed user \u2014 d\xF9ng tab **\u0110\u0103ng k\xFD** tr\u01B0\u1EDBc, r\u1ED3i \u0110\u0103ng nh\u1EADp.
|
|
200
|
+
- KH\xD4NG m\u1EDF port FE tr\u1EF1c ti\u1EBFp (vd \`:3000\`): \u0111\xF3 l\xE0 static server, m\u1ECDi \`POST /api/*\` tr\u1EA3 **405**.
|
|
201
|
+
|
|
202
|
+
` : "";
|
|
190
203
|
return `# ${selection.appName}
|
|
191
204
|
|
|
192
205
|
Stack generated by \`create-wakii-stack\` (Hybrid C \u2014 full template pruned to your selection).
|
|
@@ -195,7 +208,7 @@ Stack generated by \`create-wakii-stack\` (Hybrid C \u2014 full template pruned
|
|
|
195
208
|
|
|
196
209
|
${selection.services.map((s) => `- ${s} _(${manifest.services[s]?.layer ?? "?"})_`).join("\n")}
|
|
197
210
|
|
|
198
|
-
## Run
|
|
211
|
+
${access}## Run
|
|
199
212
|
|
|
200
213
|
\`\`\`bash
|
|
201
214
|
cd ${selection.appName}
|
|
@@ -209,7 +222,7 @@ ${manifest.smoke ? `## Smoke
|
|
|
209
222
|
${manifest.smoke}
|
|
210
223
|
\`\`\`
|
|
211
224
|
` : ""}
|
|
212
|
-
${ports ? `##
|
|
225
|
+
${ports ? `## Ports
|
|
213
226
|
|
|
214
227
|
${ports}
|
|
215
228
|
` : ""}
|
|
@@ -312,16 +325,18 @@ Flags:
|
|
|
312
325
|
|
|
313
326
|
Rules t\u1EA7ng 1: \u22651 BE t\u1EF1 k\xE8m postgres+kafka+gateway+auth-svc; \u22651 FE t\u1EF1 k\xE8m gateway.
|
|
314
327
|
`;
|
|
315
|
-
function printNextSteps(selection,
|
|
316
|
-
const steps = [
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
328
|
+
function printNextSteps(selection, gatewayUrl) {
|
|
329
|
+
const steps = [
|
|
330
|
+
`cd ${selection.appName}`,
|
|
331
|
+
"cp platform/.env.example platform/.env # \u0111i\u1EC1n secret tr\u01B0\u1EDBc khi up",
|
|
332
|
+
"docker compose --env-file platform/.env up -d"
|
|
333
|
+
];
|
|
321
334
|
if (!selection.skipInstall) steps.push("# FE apps: pnpm install trong t\u1EEBng app mu\u1ED1n ch\u1EA1y build c\u1EE5c b\u1ED9");
|
|
322
335
|
p.log.info("Next steps:");
|
|
323
336
|
for (const step of steps) p.log.step(` ${step}`);
|
|
324
|
-
|
|
337
|
+
const entry = gatewayUrl ?? "http://localhost:8080";
|
|
338
|
+
p.log.info(`M\u1EDF ${entry} (gateway \u2014 entry duy nh\u1EA5t: / l\xE0 FE shell, /api/* l\xE0 services). \u0110\u0103ng k\xFD t\xE0i kho\u1EA3n tr\u01B0\u1EDBc khi login (auth-svc kh\xF4ng seed user).`);
|
|
339
|
+
p.log.warn("Port FE tr\u1EF1c ti\u1EBFp (vd :3000) ch\u1EC9 l\xE0 static server \u2014 login \u1EDF \u0111\xF3 b\xE1o HTTP 405.");
|
|
325
340
|
p.log.info("FE-only SPA ngo\xE0i stack? pnpm create wakii-app");
|
|
326
341
|
}
|
|
327
342
|
async function main() {
|
|
@@ -415,7 +430,7 @@ async function main() {
|
|
|
415
430
|
return;
|
|
416
431
|
}
|
|
417
432
|
p.outro("Stack s\u1EB5n s\xE0ng! \u{1F389}");
|
|
418
|
-
printNextSteps(selection,
|
|
433
|
+
printNextSteps(selection, manifest.ports?.gateway);
|
|
419
434
|
}
|
|
420
435
|
main().catch((err) => {
|
|
421
436
|
p.log.error(err instanceof Error ? err.message : String(err));
|
package/package.json
CHANGED
|
@@ -279,5 +279,16 @@
|
|
|
279
279
|
"when": "không chọn service be nào và không chọn option fe nào",
|
|
280
280
|
"action": "engine phải dừng với lỗi rõ ràng — stack trống không hợp lệ"
|
|
281
281
|
}
|
|
282
|
+
},
|
|
283
|
+
"ports": {
|
|
284
|
+
"gateway": "http://localhost:8080",
|
|
285
|
+
"shell": "http://localhost:3000",
|
|
286
|
+
"remote-tasks": "http://localhost:4001",
|
|
287
|
+
"remote-activity": "http://localhost:4002",
|
|
288
|
+
"auth-svc": "http://localhost:8090",
|
|
289
|
+
"node-svc": "http://localhost:3001",
|
|
290
|
+
"spring-svc": "http://localhost:8081",
|
|
291
|
+
"go-svc": "http://localhost:8082",
|
|
292
|
+
"postgres": "localhost:5432"
|
|
282
293
|
}
|
|
283
294
|
}
|