vibe-design-system 2.8.41 → 2.8.42
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: [
|
|
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
|
@@ -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
|
-
|
|
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
|
-
|
|
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;
|