npms-exam-kit 3.0.0 → 3.0.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/bin/exam-kit.js +51 -14
- package/package.json +1 -1
package/bin/exam-kit.js
CHANGED
|
@@ -367,16 +367,52 @@ function generateMermaidDiagrams(projectType){
|
|
|
367
367
|
|
|
368
368
|
function initMermaidFile(fp, pt){
|
|
369
369
|
const d=generateMermaidDiagrams(pt);
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
370
|
+
const title=pt==='SIMS'?'Stock Inventory Management System (SIMS)':'Car Repair Payment Management System (CRPMS)';
|
|
371
|
+
const html=`<!DOCTYPE html>
|
|
372
|
+
<html lang="en">
|
|
373
|
+
<head>
|
|
374
|
+
<meta charset="UTF-8">
|
|
375
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
376
|
+
<title>${title} - ERD & DFD</title>
|
|
377
|
+
<script src="https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.min.js"></script>
|
|
378
|
+
<style>
|
|
379
|
+
*{margin:0;padding:0;box-sizing:border-box}
|
|
380
|
+
body{font-family:system-ui,-apple-system,sans-serif;background:#f0f2f5;padding:40px 20px;display:flex;flex-direction:column;align-items:center}
|
|
381
|
+
.container{max-width:1200px;width:100%}
|
|
382
|
+
h1{text-align:center;color:#1a1a2e;margin-bottom:8px;font-size:28px}
|
|
383
|
+
.subtitle{text-align:center;color:#666;margin-bottom:40px;font-size:14px}
|
|
384
|
+
.section{background:white;border-radius:16px;padding:32px;margin-bottom:32px;box-shadow:0 2px 12px rgba(0,0,0,0.08)}
|
|
385
|
+
.section h2{color:#1a1a2e;margin-bottom:20px;padding-bottom:12px;border-bottom:3px solid #00D2FF;font-size:20px}
|
|
386
|
+
.mermaid-wrapper{overflow-x:auto;padding:8px 0}
|
|
387
|
+
.mermaid svg{max-width:100%;height:auto}
|
|
388
|
+
.footer{text-align:center;color:#999;font-size:12px;margin-top:16px}
|
|
389
|
+
</style>
|
|
390
|
+
</head>
|
|
391
|
+
<body>
|
|
392
|
+
<div class="container">
|
|
393
|
+
<h1>${title}</h1>
|
|
394
|
+
<p class="subtitle">Entity Relationship Diagram & Data Flow Diagram — Generated by npms-exam-kit on ${new Date().toISOString().split('T')[0]}</p>
|
|
395
|
+
|
|
396
|
+
<div class="section">
|
|
397
|
+
<h2>Entity Relationship Diagram (ERD)</h2>
|
|
398
|
+
<div class="mermaid-wrapper">
|
|
399
|
+
<pre class="mermaid">${d.erd}</pre>
|
|
400
|
+
</div>
|
|
401
|
+
</div>
|
|
402
|
+
|
|
403
|
+
<div class="section">
|
|
404
|
+
<h2>Data Flow Diagram (DFD)</h2>
|
|
405
|
+
<div class="mermaid-wrapper">
|
|
406
|
+
<pre class="mermaid">${d.dfd}</pre>
|
|
407
|
+
</div>
|
|
408
|
+
</div>
|
|
409
|
+
|
|
410
|
+
<p class="footer">Open this file in a browser to view interactive diagrams. Generated by npms-exam-kit</p>
|
|
411
|
+
</div>
|
|
412
|
+
</body>
|
|
413
|
+
</html>`;
|
|
414
|
+
writeFileSync(fp.replace(/\.md$/,'.html'),html,'utf8');
|
|
415
|
+
return fp.replace(/\.md$/,'.html');
|
|
380
416
|
}
|
|
381
417
|
|
|
382
418
|
function showNextSteps(project, targetDir){
|
|
@@ -449,7 +485,7 @@ function showNextSteps(project, targetDir){
|
|
|
449
485
|
log(chalk.bold(` DATABASE: ${chalk.dim(dbName)}`));
|
|
450
486
|
log(chalk.bold(` FRONTEND: ${chalk.dim('http://localhost:5173')}`));
|
|
451
487
|
log(chalk.bold(` BACKEND: ${chalk.dim('http://localhost:5000')}`));
|
|
452
|
-
log(chalk.bold(`
|
|
488
|
+
log(chalk.bold(` Diagrams (ERD & DFD): ${chalk.dim(join(targetDir, project+'_ERD_DFD.html'))}`));
|
|
453
489
|
log(chalk.bold(` Assessment report saved: ${chalk.dim(join(targetDir, 'checklist_report'))}`));
|
|
454
490
|
log(chalk.bold('───────────────────────────────────────────────────────────────\n'));
|
|
455
491
|
|
|
@@ -536,10 +572,11 @@ async function main(){
|
|
|
536
572
|
log(chalk.dim(` Report: ${join(rd)}\n`));
|
|
537
573
|
|
|
538
574
|
// ── MERMAID DIAGRAMS ──
|
|
539
|
-
const diagPath=join(targetDir,`${project}_ERD_DFD.
|
|
575
|
+
const diagPath=join(targetDir,`${project}_ERD_DFD.html`);
|
|
540
576
|
initMermaidFile(diagPath,project);
|
|
541
|
-
log(chalk.green(` ✓
|
|
542
|
-
log(` ${chalk.bold(diagPath)}
|
|
577
|
+
log(chalk.green(` ✓ Real ERD & DFD diagrams saved to:`));
|
|
578
|
+
log(` ${chalk.bold(diagPath)}`);
|
|
579
|
+
log(chalk.dim(' Open the .html file in a browser to see actual diagrams\n'));
|
|
543
580
|
|
|
544
581
|
// ── NEXT STEPS ──
|
|
545
582
|
showNextSteps(project, targetDir);
|