vibe-design-system 2.8.45 → 2.8.47
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 +7 -1
- package/package.json +1 -1
- package/vds-core-template/story-generator.mjs +17 -10
package/bin/init.js
CHANGED
|
@@ -276,6 +276,12 @@ export default config;
|
|
|
276
276
|
`;
|
|
277
277
|
}
|
|
278
278
|
// vite (default) & remix
|
|
279
|
+
// For fullstack projects (client/src, frontend/src, etc.), add staticDirs for public assets
|
|
280
|
+
const frontendDir = srcPrefix.split("/")[0]; // e.g. "client" from "client/src"
|
|
281
|
+
const staticDirsLine = srcPrefix !== "src"
|
|
282
|
+
? `\n staticDirs: [{ from: "../${frontendDir}/public", to: "/${frontendDir}" }],`
|
|
283
|
+
: "";
|
|
284
|
+
|
|
279
285
|
return `import type { StorybookConfig } from "@storybook/react-vite";
|
|
280
286
|
import { mergeConfig } from "vite";
|
|
281
287
|
import path from "path";
|
|
@@ -283,7 +289,7 @@ import path from "path";
|
|
|
283
289
|
const config: StorybookConfig = {
|
|
284
290
|
stories: [
|
|
285
291
|
"../${srcPrefix}/**/*.stories.@(js|jsx|mjs|ts|tsx)",${extraStoriesGlob}
|
|
286
|
-
]
|
|
292
|
+
],${staticDirsLine}
|
|
287
293
|
addons: ["@storybook/addon-essentials", "@storybook/addon-a11y"],
|
|
288
294
|
framework: {
|
|
289
295
|
name: "@storybook/react-vite",
|
package/package.json
CHANGED
|
@@ -3016,8 +3016,9 @@ function main() {
|
|
|
3016
3016
|
// ignore
|
|
3017
3017
|
}
|
|
3018
3018
|
|
|
3019
|
-
// Clear existing .stories.* files only on full regeneration (no filter arg),
|
|
3019
|
+
// Clear existing AUTO-GENERATED .stories.* files only on full regeneration (no filter arg),
|
|
3020
3020
|
// so that "node story-generator.mjs SomeName" doesn't wipe other stories.
|
|
3021
|
+
// Files WITHOUT @vds-regenerate tag are considered manually curated and are NEVER deleted.
|
|
3021
3022
|
if (!onlyName) {
|
|
3022
3023
|
try {
|
|
3023
3024
|
const existing = fs.readdirSync(STORIES_DIR);
|
|
@@ -3029,7 +3030,18 @@ function main() {
|
|
|
3029
3030
|
name.endsWith(".stories.jsx") ||
|
|
3030
3031
|
name.endsWith(".stories.js")
|
|
3031
3032
|
) {
|
|
3032
|
-
|
|
3033
|
+
const filePath = path.join(STORIES_DIR, name);
|
|
3034
|
+
try {
|
|
3035
|
+
const firstLine = fs.readFileSync(filePath, "utf-8").split("\n")[0] || "";
|
|
3036
|
+
if (!firstLine.includes("@vds-regenerate")) {
|
|
3037
|
+
// Manually curated story — do NOT delete
|
|
3038
|
+
continue;
|
|
3039
|
+
}
|
|
3040
|
+
} catch {
|
|
3041
|
+
// If we can't read it, don't delete it
|
|
3042
|
+
continue;
|
|
3043
|
+
}
|
|
3044
|
+
fs.unlinkSync(filePath);
|
|
3033
3045
|
}
|
|
3034
3046
|
}
|
|
3035
3047
|
} catch {
|
|
@@ -3059,15 +3071,10 @@ function main() {
|
|
|
3059
3071
|
const requiredCount = Array.isArray(comp.props) ? comp.props.filter((p) => p.required === true).length : 0;
|
|
3060
3072
|
if (requiredCount > 3) continue;
|
|
3061
3073
|
|
|
3062
|
-
// Never overwrite
|
|
3074
|
+
// Never overwrite existing story files — only create new ones
|
|
3075
|
+
// To regenerate a story: delete the file and re-run VDS
|
|
3063
3076
|
if (fs.existsSync(storyPath)) {
|
|
3064
|
-
|
|
3065
|
-
const existing = fs.readFileSync(storyPath, "utf-8");
|
|
3066
|
-
// If file was manually edited (different from VDS auto-gen pattern), skip it
|
|
3067
|
-
if (!existing.includes("@vds-regenerate")) {
|
|
3068
|
-
continue;
|
|
3069
|
-
}
|
|
3070
|
-
} catch (_) {}
|
|
3077
|
+
continue;
|
|
3071
3078
|
}
|
|
3072
3079
|
|
|
3073
3080
|
const content = buildStoryFileContent(comp);
|