vibe-design-system 2.8.41 → 2.8.43

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
@@ -252,12 +252,17 @@ function storybookFrameworkPackage(framework) {
252
252
 
253
253
  /** Framework'e göre .storybook/main.ts içeriği */
254
254
  function buildStorybookMainTs(framework, srcPrefix) {
255
+ // Fullstack projects: include both srcPrefix AND src/ globs so stories in either location are found
256
+ const extraStoriesGlob = srcPrefix !== "src"
257
+ ? `\n "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)",`
258
+ : "";
259
+
255
260
  if (framework === "nextjs") {
256
261
  return `import type { StorybookConfig } from "@storybook/nextjs";
257
262
 
258
263
  const config: StorybookConfig = {
259
264
  stories: [
260
- "../${srcPrefix}/**/*.stories.@(js|jsx|mjs|ts|tsx)",
265
+ "../${srcPrefix}/**/*.stories.@(js|jsx|mjs|ts|tsx)",${extraStoriesGlob}
261
266
  "../app/**/*.stories.@(js|jsx|mjs|ts|tsx)",
262
267
  ],
263
268
  addons: ["@storybook/addon-essentials", "@storybook/addon-a11y"],
@@ -276,7 +281,9 @@ import { mergeConfig } from "vite";
276
281
  import path from "path";
277
282
 
278
283
  const config: StorybookConfig = {
279
- stories: ["../${srcPrefix}/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
284
+ stories: [
285
+ "../${srcPrefix}/**/*.stories.@(js|jsx|mjs|ts|tsx)",${extraStoriesGlob}
286
+ ],
280
287
  addons: ["@storybook/addon-essentials", "@storybook/addon-a11y"],
281
288
  framework: {
282
289
  name: "@storybook/react-vite",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibe-design-system",
3
- "version": "2.8.41",
3
+ "version": "2.8.43",
4
4
  "description": "Auto-generate design systems for vibe coding projects",
5
5
  "homepage": "https://vibedesign.tech",
6
6
  "repository": {
@@ -449,6 +449,9 @@ function extractBrandAssets() {
449
449
  const assets = [];
450
450
  const dirs = [
451
451
  path.join(PROJECT_ROOT, "public"),
452
+ path.join(PROJECT_ROOT, "client", "public"),
453
+ path.join(PROJECT_ROOT, "frontend", "public"),
454
+ path.join(PROJECT_ROOT, "web", "public"),
452
455
  path.join(PROJECT_ROOT, "src", "assets"),
453
456
  path.join(PROJECT_ROOT, "src", "images"),
454
457
  path.join(PROJECT_ROOT, "client", "src", "assets"),
@@ -466,6 +469,38 @@ function extractBrandAssets() {
466
469
  assets.push({ path: filePath, name: baseName, type });
467
470
  }
468
471
  }
472
+ // Detect inline/component-based logos (SVG in JSX, brand components, text-gradient brand names)
473
+ const logoKeywordRe = /(?:logo|brand|emblem)\s*[=:]/i;
474
+ const svgLogoRe = /<svg[^>]*(?:logo|brand|emblem)/i;
475
+ const brandTextRe = /text-gradient[^"]*"[^>]*>([^<]+)</;
476
+ const headerSidebarRe = /(?:header|sidebar|navbar|nav|topbar|layout)/i;
477
+ const allTsx = getAllTsxJsxInDir(SRC_DIR);
478
+ for (const rel of allTsx) {
479
+ try {
480
+ const content = fs.readFileSync(path.join(SRC_DIR, rel), "utf-8");
481
+ let brandName = null;
482
+ // Direct logo/brand keyword in code
483
+ if (logoKeywordRe.test(content) || svgLogoRe.test(content)) {
484
+ const m = content.match(brandTextRe);
485
+ brandName = m ? m[1].trim() : path.basename(rel, path.extname(rel));
486
+ }
487
+ // Brand name via text-gradient in header/sidebar/navbar components
488
+ if (!brandName && headerSidebarRe.test(rel)) {
489
+ const m = content.match(brandTextRe);
490
+ if (m) brandName = m[1].trim();
491
+ }
492
+ if (brandName && brandName.length > 1 && brandName.length < 30) {
493
+ assets.push({
494
+ type: "logo",
495
+ path: path.relative(PROJECT_ROOT, path.join(SRC_DIR, rel)).replace(/\\/g, "/"),
496
+ name: brandName,
497
+ inline: true,
498
+ description: `Inline logo in ${rel}`,
499
+ });
500
+ }
501
+ } catch (_) {}
502
+ }
503
+
469
504
  // Fallback: if no branded assets found by keyword, include all image files from SRC_DIR/assets
470
505
  if (assets.length === 0 || assets.every((r) => r.type === "asset")) {
471
506
  const assetsDir = path.join(SRC_DIR, "assets");
@@ -3039,7 +3039,16 @@ function main() {
3039
3039
  const componentName = toSafeComponentName(comp.name, comp.file);
3040
3040
  // Skip unclassified and shadcn/ui primitives (UI group) — they're documented at ui.shadcn.com
3041
3041
  // Only project-specific module groups (Circles, Finance, Projects, Time, …) get stories
3042
- if (comp.group === "Uncategorized" || comp.group === "UI") continue;
3042
+ const g = comp.group || "Components";
3043
+ if (g === "Uncategorized" || g === "UI" || g === "shadcn" || g === "ui") {
3044
+ // Clean up leftover story files for components that are now in the skip group
3045
+ const oldStory = path.join(STORIES_DIR, `${componentName}.stories.tsx`);
3046
+ if (fs.existsSync(oldStory)) {
3047
+ fs.unlinkSync(oldStory);
3048
+ console.log(`[VDS] Removed shadcn/ui story: ${componentName}.stories.tsx`);
3049
+ }
3050
+ continue;
3051
+ }
3043
3052
  if (onlyName && componentName !== onlyName) continue;
3044
3053
 
3045
3054
  const storyFileName = `${componentName}.stories.tsx`;
@@ -211,19 +211,65 @@ function injectAliases(projectRoot, specifiers) {
211
211
  aliasLines.push(`"${spec.replace(/"/g, '\\"')}": path.resolve(process.cwd(), "${mockRel}")`);
212
212
  }
213
213
  const newAliases = aliasLines.join(",\n ");
214
- const pattern = /("@":\s*path\.resolve\(process\.cwd\(\),\s*"src"\))(\s*)(\})/;
214
+ // Match "@": path.resolve(process.cwd(), "src") OR "@": path.resolve(process.cwd(), "client/src") etc.
215
+ const pattern = /("@":\s*path\.resolve\(process\.cwd\(\),\s*"[^"]+"\))(\s*)(\})/;
215
216
  if (pattern.test(content)) {
216
217
  content = content.replace(pattern, `$1,\n ${newAliases}$2$3`);
217
218
  fs.writeFileSync(mainPath, content, "utf-8");
218
219
  }
219
220
  }
220
221
 
222
+ /**
223
+ * Read project's vite.config.ts and inject any aliases NOT already in .storybook/main.ts.
224
+ * Supports: @shared, @assets, @db, etc. — any "path.resolve(__dirname, ...)" alias.
225
+ */
226
+ function injectViteConfigAliases(projectRoot) {
227
+ const mainPath = getMainPath(projectRoot);
228
+ if (!mainPath) return;
229
+
230
+ // Find vite.config
231
+ const viteConfigCandidates = ["vite.config.ts", "vite.config.js", "vite.config.mts", "vite.config.mjs"];
232
+ let viteConfigContent = null;
233
+ for (const name of viteConfigCandidates) {
234
+ const p = path.join(projectRoot, name);
235
+ if (fs.existsSync(p)) { viteConfigContent = fs.readFileSync(p, "utf-8"); break; }
236
+ }
237
+ if (!viteConfigContent) return;
238
+
239
+ // Extract aliases: "@shared": path.resolve(__dirname, "shared") style
240
+ const aliasRe = /["'](@[^"']+)["']\s*:\s*(?:path\.resolve\([^)]*,\s*)?["']([^"']+)["']\s*\)?/g;
241
+ const viteAliases = {};
242
+ let m;
243
+ while ((m = aliasRe.exec(viteConfigContent)) !== null) {
244
+ if (m[1] !== "@") viteAliases[m[1]] = m[2]; // skip @ — already handled
245
+ }
246
+ if (Object.keys(viteAliases).length === 0) return;
247
+
248
+ let mainContent = fs.readFileSync(mainPath, "utf-8");
249
+ const missingAliases = Object.entries(viteAliases).filter(([key]) => !mainContent.includes(`"${key}"`));
250
+ if (missingAliases.length === 0) return;
251
+
252
+ // Find the alias block and inject missing aliases
253
+ const aliasBlockRe = /(\balias\s*:\s*\{)([^}]*)(\})/;
254
+ if (!aliasBlockRe.test(mainContent)) return;
255
+ const additions = missingAliases
256
+ .map(([key, dir]) => `\n "${key}": path.resolve(process.cwd(), "${dir}"),`)
257
+ .join("");
258
+ mainContent = mainContent.replace(aliasBlockRe, (_, open, body, close) =>
259
+ `${open}${body}${additions}\n ${close}`
260
+ );
261
+ fs.writeFileSync(mainPath, mainContent, "utf-8");
262
+ console.log(`[VDS] Storybook adapt: injected vite aliases: ${missingAliases.map(([k]) => k).join(", ")}`);
263
+ }
264
+
221
265
  function main() {
222
266
  const projectRoot = PROJECT_ROOT;
223
267
  if (!fs.existsSync(path.join(projectRoot, ".storybook"))) {
224
268
  console.log("[VDS] .storybook not found; skip storybook-adapt.");
225
269
  return;
226
270
  }
271
+ // Inject vite.config aliases into storybook main (e.g. @shared, @assets)
272
+ injectViteConfigAliases(projectRoot);
227
273
  reportUnresolvedImports(projectRoot);
228
274
  const problematic = collectProblematicImports(projectRoot);
229
275
  if (problematic.size === 0) return;