74 lines
1.7 KiB
TypeScript
74 lines
1.7 KiB
TypeScript
/// <reference types="vitest/config" />
|
|
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
import { storybookTest } from "@storybook/addon-vitest/vitest-plugin";
|
|
import react from "@vitejs/plugin-react";
|
|
import { defineConfig } from "vite";
|
|
|
|
const dirname =
|
|
typeof __dirname !== "undefined"
|
|
? __dirname
|
|
: path.dirname(fileURLToPath(import.meta.url));
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
build: {
|
|
lib: {
|
|
entry: "src/index.ts",
|
|
name: "StardustUI",
|
|
fileName: (format) => `stardust-ui.${format}.js`,
|
|
},
|
|
rollupOptions: {
|
|
external: ["react", "react-dom"],
|
|
output: {
|
|
globals: {
|
|
react: "React",
|
|
"react-dom": "ReactDOM",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
test: {
|
|
coverage: {
|
|
include: ["src/**/*.{ts,tsx}"],
|
|
exclude: [
|
|
"**/node_modules/**",
|
|
"**/dist/**",
|
|
"**/.{idea,git,cache,output,temp}/**",
|
|
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*",
|
|
"**/*.stories.tsx", // Exclude Storybook files
|
|
"**/*.stories.ts",
|
|
"**/*.stories.jsx",
|
|
"**/*.stories.js",
|
|
],
|
|
reporter: ["text", "lcov"],
|
|
},
|
|
projects: [
|
|
{
|
|
extends: true,
|
|
plugins: [
|
|
storybookTest({
|
|
configDir: path.join(dirname, ".storybook"),
|
|
}),
|
|
],
|
|
test: {
|
|
name: "storybook",
|
|
browser: {
|
|
enabled: true,
|
|
headless: true,
|
|
provider: "playwright",
|
|
instances: [
|
|
{
|
|
browser: "chromium",
|
|
},
|
|
],
|
|
},
|
|
setupFiles: [".storybook/vitest.setup.ts"],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
});
|