vibe-design-system 2.4.5 → 2.4.7
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 +45 -13
- package/package.json +1 -1
package/bin/init.js
CHANGED
|
@@ -22,6 +22,8 @@ const INSTALLER_ROOT = path.join(__dirname, "..");
|
|
|
22
22
|
const TEMPLATE_DIR = path.join(INSTALLER_ROOT, "vds-core-template");
|
|
23
23
|
|
|
24
24
|
const STORYBOOK_MAIN_TS = `import type { StorybookConfig } from "@storybook/react-vite";
|
|
25
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
26
|
+
|
|
25
27
|
const config: StorybookConfig = {
|
|
26
28
|
stories: ["../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
|
27
29
|
addons: ["@storybook/addon-essentials"],
|
|
@@ -29,13 +31,38 @@ const config: StorybookConfig = {
|
|
|
29
31
|
name: "@storybook/react-vite",
|
|
30
32
|
options: {},
|
|
31
33
|
},
|
|
34
|
+
viteFinal: async (config) => {
|
|
35
|
+
config.plugins = config.plugins || [];
|
|
36
|
+
config.plugins.push(tailwindcss());
|
|
37
|
+
return config;
|
|
38
|
+
},
|
|
32
39
|
};
|
|
40
|
+
|
|
33
41
|
export default config;
|
|
34
42
|
`;
|
|
35
43
|
|
|
36
44
|
const STORYBOOK_PREVIEW_TS = `import type { Preview } from "@storybook/react";
|
|
45
|
+
import React from "react";
|
|
37
46
|
import "../src/index.css";
|
|
38
|
-
|
|
47
|
+
|
|
48
|
+
const preview: Preview = {
|
|
49
|
+
parameters: {
|
|
50
|
+
backgrounds: {
|
|
51
|
+
default: "dark",
|
|
52
|
+
values: [
|
|
53
|
+
{ name: "light", value: "#ffffff" },
|
|
54
|
+
{ name: "dark", value: "#020617" },
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
decorators: [
|
|
59
|
+
(Story) => {
|
|
60
|
+
document.documentElement.classList.add("dark");
|
|
61
|
+
return React.createElement(Story, null);
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
};
|
|
65
|
+
|
|
39
66
|
export default preview;
|
|
40
67
|
`;
|
|
41
68
|
|
|
@@ -114,19 +141,28 @@ function readPackageJson(projectRoot) {
|
|
|
114
141
|
}
|
|
115
142
|
}
|
|
116
143
|
|
|
117
|
-
// ADIM 1 — Bağımlılık kontrolü
|
|
144
|
+
// ADIM 1 — Bağımlılık kontrolü (Storybook v8 + Tailwind v4 Vite)
|
|
118
145
|
function needsStorybook(projectRoot) {
|
|
119
146
|
const pkg = readPackageJson(projectRoot);
|
|
120
147
|
if (!pkg) return false;
|
|
121
148
|
const dev = pkg.devDependencies || {};
|
|
122
|
-
return !(dev.storybook && dev["@storybook/react-vite"]);
|
|
149
|
+
return !(dev.storybook && dev["@storybook/react-vite"] && dev["@tailwindcss/vite"]);
|
|
123
150
|
}
|
|
124
151
|
|
|
125
152
|
function installStorybook(projectRoot) {
|
|
126
|
-
console.log("📚 Storybook
|
|
153
|
+
console.log("📚 Storybook v8 ve @tailwindcss/vite kuruluyor...");
|
|
127
154
|
const r = spawnSync(
|
|
128
155
|
"npm",
|
|
129
|
-
[
|
|
156
|
+
[
|
|
157
|
+
"install",
|
|
158
|
+
"--save-dev",
|
|
159
|
+
"storybook@8",
|
|
160
|
+
"@storybook/react-vite@8",
|
|
161
|
+
"@storybook/react@8",
|
|
162
|
+
"@storybook/addon-essentials@8",
|
|
163
|
+
"@storybook/blocks@8",
|
|
164
|
+
"@tailwindcss/vite",
|
|
165
|
+
],
|
|
130
166
|
{ cwd: projectRoot, stdio: "inherit" }
|
|
131
167
|
);
|
|
132
168
|
if (r.status !== 0) {
|
|
@@ -143,16 +179,12 @@ function ensureStorybook(projectRoot) {
|
|
|
143
179
|
}
|
|
144
180
|
|
|
145
181
|
const mainPath = path.join(storybookDir, "main.ts");
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
console.log("📝 .storybook/main.ts yazıldı.");
|
|
149
|
-
}
|
|
182
|
+
fs.writeFileSync(mainPath, STORYBOOK_MAIN_TS, "utf-8");
|
|
183
|
+
console.log("📝 .storybook/main.ts yazıldı.");
|
|
150
184
|
|
|
151
185
|
const previewPath = path.join(storybookDir, "preview.ts");
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
console.log("📝 .storybook/preview.ts yazıldı.");
|
|
155
|
-
}
|
|
186
|
+
fs.writeFileSync(previewPath, STORYBOOK_PREVIEW_TS, "utf-8");
|
|
187
|
+
console.log("📝 .storybook/preview.ts yazıldı.");
|
|
156
188
|
}
|
|
157
189
|
|
|
158
190
|
// ADIM 3 — vds-core/ kopyala
|