Skip to content

Commit

Permalink
Callded build web types in vite plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Explicit12 committed Dec 26, 2024
1 parent 0b265cd commit 1df7d77
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"access": "public"
},
"scripts": {
"pre:start": "npx @vueless/web-types && node .scripts/icons",
"pre:start": "npx node .scripts/icons",
"dev:docs": "npm run pre:start && storybook dev -p 6006 --docs --no-open",
"dev": "npm run pre:start && STORYBOOK_FULL=1 storybook dev -p 6006 --no-open",
"build": "npm run pre:start && storybook build --docs",
Expand Down
12 changes: 12 additions & 0 deletions src/plugin-vite.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ export const Vueless = function (options = {}) {
await createTailwindSafelist({ mode, env, debug, targetFiles });
}

if ((config.command.includes("sb:") && mode === "storybook") || isVuelessEnv) {
try {
const webTypesModule = await import("@vueless/storybook/webTypes");
const buildWebTypes = webTypesModule.default;

await buildWebTypes();
} catch (error) {
// eslint-disable-next-line no-console
console.warn(error);
}
}

if (config.command === "build") {
/* remove cached icons */
await removeIconsCache(mirrorCacheDir, debug);
Expand Down

0 comments on commit 1df7d77

Please sign in to comment.