vibe-design-system 2.8.10 → 2.8.12
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/init.js
CHANGED
|
@@ -79,6 +79,12 @@ Bu proje VDS kullanıyor. Tek komut yeterli:
|
|
|
79
79
|
- npm run storybook → design system'ı aç (localhost:6006)
|
|
80
80
|
- npm run vds:watch → değişiklikleri izle (tarama + story otomatik)
|
|
81
81
|
|
|
82
|
+
Arka planda Storybook (Cursor kapatılsa bile çalışmaya devam eder):
|
|
83
|
+
- npm run storybook:bg → Storybook'u arka planda başlat (PM2 ile)
|
|
84
|
+
- npm run storybook:stop → Arka plan Storybook'u durdur
|
|
85
|
+
- npm run storybook:logs → Son logları göster
|
|
86
|
+
- npm run storybook:status → Tüm PM2 process'lerini listele
|
|
87
|
+
|
|
82
88
|
Geliştirme kuralları:
|
|
83
89
|
- UI component'leri src/components/ui/ altına koy
|
|
84
90
|
- Variant'lar için cva() kullan
|
|
@@ -450,6 +456,22 @@ function addScripts(projectRoot) {
|
|
|
450
456
|
scripts["build-storybook"] = "storybook build";
|
|
451
457
|
changed = true;
|
|
452
458
|
}
|
|
459
|
+
if (!scripts["storybook:bg"]) {
|
|
460
|
+
scripts["storybook:bg"] = "node vds-core/storybook-bg.mjs start";
|
|
461
|
+
changed = true;
|
|
462
|
+
}
|
|
463
|
+
if (!scripts["storybook:stop"]) {
|
|
464
|
+
scripts["storybook:stop"] = "node vds-core/storybook-bg.mjs stop";
|
|
465
|
+
changed = true;
|
|
466
|
+
}
|
|
467
|
+
if (!scripts["storybook:logs"]) {
|
|
468
|
+
scripts["storybook:logs"] = "node vds-core/storybook-bg.mjs logs";
|
|
469
|
+
changed = true;
|
|
470
|
+
}
|
|
471
|
+
if (!scripts["storybook:status"]) {
|
|
472
|
+
scripts["storybook:status"] = "node vds-core/storybook-bg.mjs status";
|
|
473
|
+
changed = true;
|
|
474
|
+
}
|
|
453
475
|
if (changed) {
|
|
454
476
|
pkg.scripts = scripts;
|
|
455
477
|
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2), "utf-8");
|
|
@@ -626,7 +648,8 @@ runStorybookAdapt(projectRoot);
|
|
|
626
648
|
|
|
627
649
|
// ADIM 8
|
|
628
650
|
console.log("\n✅ VDS kuruldu!");
|
|
629
|
-
console.log("→ npm run storybook
|
|
630
|
-
console.log("→
|
|
631
|
-
console.log("→ npm run vds:
|
|
651
|
+
console.log("→ npm run storybook — design system'ı aç (localhost:6006)");
|
|
652
|
+
console.log("→ npm run storybook:bg — Storybook'u arka planda başlat (Cursor kapansa bile çalışır)");
|
|
653
|
+
console.log("→ npm run vds:stories — tarama + story + provider (tek komut)");
|
|
654
|
+
console.log("→ npm run vds:watch — otomatik güncelleme (watch modu)");
|
|
632
655
|
console.log("\nNot: Storybook başlarken (Node 24+) DEP0190 uyarısı çıkarsa Storybook kaynaklıdır, güvenle yok sayabilirsiniz.\n");
|
package/package.json
CHANGED
|
@@ -544,6 +544,8 @@ const COMPONENT_EXTRA_ARGS = {
|
|
|
544
544
|
" tasks: [],",
|
|
545
545
|
" onLogClick: () => {},",
|
|
546
546
|
],
|
|
547
|
+
// Project-specific extra args from vds.config.js (componentExtraArgs key) are merged below
|
|
548
|
+
...(VDS_CONFIG.componentExtraArgs ?? {}),
|
|
547
549
|
};
|
|
548
550
|
|
|
549
551
|
/** Render'da args'a uygulanacak fallback (useState(estimate.toString()) gibi kullanımlar için; args/Controls undefined yapsa bile). */
|
|
@@ -551,12 +553,15 @@ const RENDER_ARGS_FALLBACKS = {
|
|
|
551
553
|
TaskEstimateInput: ", estimate: (args && args.estimate) ?? 0, value: (args && args.value) ?? 0, task: (args && args.task) ?? { id: \"1\", title: \"Example\", estimate: 0 }",
|
|
552
554
|
};
|
|
553
555
|
|
|
554
|
-
/** Kalıcı çözüm: Storybook Docs/Controls args'ı geçmezse bile component'a güvenli props veren wrapper. Önce safeDefaults uygulanır, sonra gelen props.
|
|
556
|
+
/** Kalıcı çözüm: Storybook Docs/Controls args'ı geçmezse bile component'a güvenli props veren wrapper. Önce safeDefaults uygulanır, sonra gelen props.
|
|
557
|
+
* Projeler vds.config.js içinde safeWrapperDefaults: { ComponentName: `{ ... }` } ekleyerek genişletebilir. */
|
|
555
558
|
const SAFE_WRAPPER_DEFAULTS = {
|
|
556
559
|
TaskEstimateInput: `{ estimate: 0, onUpdate: () => {}, value: 0, task: { id: "1", title: "Example", estimate: 0 }, compact: false }`,
|
|
557
560
|
TimeFilterPanel: `{ filter: { preset: null, dateRange: {}, userIds: [], tags: [], billable: "all" }, onFilterChange: () => {}, onSaveFilter: () => {}, onDeleteFilter: () => {}, filteredCount: 0, savedFilters: [] }`,
|
|
558
561
|
TimeStats: `{ totalLogged: 0, totalBillable: 0, totalNonBillable: 0, totalBilled: 0, totalEstimated: 0, projectTotalEstimated: 0 }`,
|
|
559
562
|
TimeTable: `{ logs: [{ id: "1", taskId: "t1", userId: "u1", date: "2024-01-15", hours: 8, description: "Work session", billable: true, status: "submitted" }, { id: "2", taskId: "t1", userId: "u1", date: "2024-01-16", hours: 6, description: "Review session", billable: false, status: "draft" }], users: [], tasks: [], onLogClick: () => {} }`,
|
|
563
|
+
// Project-specific overrides from vds.config.js (safeWrapperDefaults key) are merged below
|
|
564
|
+
...(VDS_CONFIG.safeWrapperDefaults ?? {}),
|
|
560
565
|
};
|
|
561
566
|
|
|
562
567
|
/** Recursive list of .tsx/.jsx file paths under dir (relative to dir). Index.tsx / index.tsx first for deterministic "first usage". */
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* VDS Background Storybook Manager — pm2 wrapper
|
|
4
|
+
* Usage: node vds-core/storybook-bg.mjs [start|stop|logs|restart|status]
|
|
5
|
+
*
|
|
6
|
+
* Storybook'u arka planda çalıştırır, Cursor kapatılsa bile devam eder.
|
|
7
|
+
* pm2 otomatik bulunur veya kurulur.
|
|
8
|
+
*/
|
|
9
|
+
import { spawnSync } from "child_process";
|
|
10
|
+
import fs from "fs";
|
|
11
|
+
import path from "path";
|
|
12
|
+
|
|
13
|
+
const ROOT = process.cwd();
|
|
14
|
+
const action = process.argv[2] || "start";
|
|
15
|
+
|
|
16
|
+
// Benzersiz PM2 process adı için proje adını al
|
|
17
|
+
let projectName = "storybook-vds";
|
|
18
|
+
try {
|
|
19
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(ROOT, "package.json"), "utf-8"));
|
|
20
|
+
if (pkg.name) {
|
|
21
|
+
projectName = "storybook-" + pkg.name.replace(/[^a-z0-9]/gi, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
22
|
+
}
|
|
23
|
+
} catch (_) {}
|
|
24
|
+
|
|
25
|
+
// PM2 binary'sini bul
|
|
26
|
+
function findPm2() {
|
|
27
|
+
const candidates = [
|
|
28
|
+
"pm2",
|
|
29
|
+
`${process.env.HOME}/.npm-global/bin/pm2`,
|
|
30
|
+
`${process.env.HOME}/.nvm/current/bin/pm2`,
|
|
31
|
+
"/usr/local/bin/pm2",
|
|
32
|
+
"/opt/homebrew/bin/pm2",
|
|
33
|
+
];
|
|
34
|
+
for (const candidate of candidates) {
|
|
35
|
+
try {
|
|
36
|
+
const r = spawnSync(candidate, ["--version"], { stdio: "pipe", shell: false });
|
|
37
|
+
if (r.status === 0) return candidate;
|
|
38
|
+
} catch (_) {}
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let pm2Bin = findPm2();
|
|
44
|
+
|
|
45
|
+
if (!pm2Bin) {
|
|
46
|
+
console.log("📦 PM2 bulunamadı. Kuruluyor...");
|
|
47
|
+
// Önce HOME prefix ile dene (sudo gerektirmez)
|
|
48
|
+
const prefix = `${process.env.HOME}/.npm-global`;
|
|
49
|
+
spawnSync("npm", ["config", "set", "prefix", prefix], { stdio: "pipe" });
|
|
50
|
+
const r = spawnSync("npm", ["install", "-g", "pm2"], { stdio: "inherit", shell: false });
|
|
51
|
+
if (r.status !== 0) {
|
|
52
|
+
console.error("❌ PM2 kurulamadı.");
|
|
53
|
+
console.error("Manuel kurulum için:");
|
|
54
|
+
console.error(" npm config set prefix '~/.npm-global'");
|
|
55
|
+
console.error(" npm install -g pm2");
|
|
56
|
+
console.error(" echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc && source ~/.zshrc");
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
pm2Bin = `${prefix}/bin/pm2`;
|
|
60
|
+
if (!fs.existsSync(pm2Bin)) pm2Bin = "pm2";
|
|
61
|
+
console.log("✅ PM2 kuruldu.");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (action === "start" || action === "restart") {
|
|
65
|
+
console.log(`\n🚀 Storybook arka planda başlatılıyor...`);
|
|
66
|
+
console.log(` Process: ${projectName} | Port: 6006\n`);
|
|
67
|
+
|
|
68
|
+
// Zaten çalışıyorsa durdur
|
|
69
|
+
spawnSync(pm2Bin, ["stop", projectName], { stdio: "pipe" });
|
|
70
|
+
spawnSync(pm2Bin, ["delete", projectName], { stdio: "pipe" });
|
|
71
|
+
|
|
72
|
+
const r = spawnSync(
|
|
73
|
+
pm2Bin,
|
|
74
|
+
["start", "npm", "--name", projectName, "--", "run", "storybook"],
|
|
75
|
+
{ cwd: ROOT, stdio: "inherit", shell: false }
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
if (r.status === 0) {
|
|
79
|
+
console.log("\n✅ Storybook arka planda çalışıyor!");
|
|
80
|
+
console.log("→ http://localhost:6006");
|
|
81
|
+
console.log("→ Durdurmak için: npm run storybook:stop");
|
|
82
|
+
console.log("→ Logları görmek: npm run storybook:logs");
|
|
83
|
+
console.log("→ Durum: npm run storybook:status\n");
|
|
84
|
+
|
|
85
|
+
// Kaydet (yeniden başlatmada da devam etsin)
|
|
86
|
+
spawnSync(pm2Bin, ["save"], { stdio: "pipe" });
|
|
87
|
+
} else {
|
|
88
|
+
console.error("❌ Storybook başlatılamadı. Hata için: npm run storybook:logs");
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
} else if (action === "stop") {
|
|
93
|
+
console.log(`⏹️ Storybook durduruluyor (${projectName})...`);
|
|
94
|
+
spawnSync(pm2Bin, ["stop", projectName], { stdio: "inherit" });
|
|
95
|
+
spawnSync(pm2Bin, ["delete", projectName], { stdio: "inherit" });
|
|
96
|
+
spawnSync(pm2Bin, ["save"], { stdio: "pipe" });
|
|
97
|
+
console.log("✅ Storybook durduruldu.");
|
|
98
|
+
|
|
99
|
+
} else if (action === "logs") {
|
|
100
|
+
console.log(`📋 Storybook logları (${projectName}):\n`);
|
|
101
|
+
spawnSync(pm2Bin, ["logs", projectName, "--lines", "80", "--nostream"], { stdio: "inherit" });
|
|
102
|
+
|
|
103
|
+
} else if (action === "status") {
|
|
104
|
+
spawnSync(pm2Bin, ["list"], { stdio: "inherit" });
|
|
105
|
+
|
|
106
|
+
} else {
|
|
107
|
+
console.log("Kullanım: node vds-core/storybook-bg.mjs [start|stop|logs|restart|status]");
|
|
108
|
+
console.log("\nKomutlar:");
|
|
109
|
+
console.log(" start — Storybook'u arka planda başlat (varsayılan)");
|
|
110
|
+
console.log(" stop — Arka plan Storybook'u durdur");
|
|
111
|
+
console.log(" logs — Son logları göster");
|
|
112
|
+
console.log(" restart — Yeniden başlat");
|
|
113
|
+
console.log(" status — Tüm PM2 process'lerini listele");
|
|
114
|
+
}
|