vibe-design-system 2.5.49 → 2.5.50
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 +24 -2
- package/package.json +1 -1
package/bin/init.js
CHANGED
|
@@ -194,12 +194,34 @@ function ensureStorybook(projectRoot) {
|
|
|
194
194
|
fs.writeFileSync(mainPath, STORYBOOK_MAIN_TS, "utf-8");
|
|
195
195
|
console.log("📝 .storybook/main.ts yazıldı.");
|
|
196
196
|
|
|
197
|
-
|
|
197
|
+
// preview.ts / preview.tsx — eski VDS template'lerini otomatik olarak yeni router'sız template'e migrate et.
|
|
198
|
+
const previewCandidates = ["preview.tsx", "preview.ts", "preview.jsx", "preview.js"];
|
|
199
|
+
const existingPreview = previewCandidates.find((name) =>
|
|
198
200
|
fs.existsSync(path.join(storybookDir, name))
|
|
199
201
|
);
|
|
200
|
-
|
|
202
|
+
const previewPath = existingPreview ? path.join(storybookDir, existingPreview) : null;
|
|
203
|
+
|
|
204
|
+
if (!previewPath) {
|
|
205
|
+
// Daha önce hiç preview yoksa, yeni template'i yaz.
|
|
201
206
|
fs.writeFileSync(path.join(storybookDir, "preview.ts"), STORYBOOK_PREVIEW_TS, "utf-8");
|
|
202
207
|
console.log("📝 .storybook/preview.ts yazıldı.");
|
|
208
|
+
} else {
|
|
209
|
+
// Eski VDS preview'lerini tespit edip otomatik migrate et; kullanıcıya ait preview'lere dokunma.
|
|
210
|
+
try {
|
|
211
|
+
const content = fs.readFileSync(previewPath, "utf-8");
|
|
212
|
+
const looksLikeOldVdsPreview =
|
|
213
|
+
content.includes('MemoryRouter from "react-router-dom"') ||
|
|
214
|
+
content.includes("const withRouter") ||
|
|
215
|
+
content.includes("decorators: [withRouter");
|
|
216
|
+
if (looksLikeOldVdsPreview) {
|
|
217
|
+
fs.writeFileSync(previewPath, STORYBOOK_PREVIEW_TS, "utf-8");
|
|
218
|
+
console.log("📝 .storybook/preview.* eski VDS şablonundan yeni router'sız şablona güncellendi.");
|
|
219
|
+
} else {
|
|
220
|
+
console.log("ℹ️ .storybook/preview.* bulundu, kullanıcıya ait görünüyor; değiştirilmedi.");
|
|
221
|
+
}
|
|
222
|
+
} catch {
|
|
223
|
+
console.log("⚠️ .storybook/preview.* okunamadı; değiştirilmedi.");
|
|
224
|
+
}
|
|
203
225
|
}
|
|
204
226
|
}
|
|
205
227
|
|