Initial ui-kit: Button, дизайн-токены, сборка Vite, Storybook
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
/// <reference types="vitest/config" />
|
||||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import dts from "vite-plugin-dts";
|
||||
import { resolve } from "path";
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
|
||||
import { playwright } from '@vitest/browser-playwright';
|
||||
const dirname = typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
|
||||
export default defineConfig({
|
||||
plugins: [react(), dts({
|
||||
include: ["src"],
|
||||
// истории — только для витрины Storybook, в пакет их типы не кладём
|
||||
exclude: ["src/**/*.stories.tsx"],
|
||||
insertTypesEntry: true
|
||||
})],
|
||||
build: {
|
||||
lib: {
|
||||
entry: resolve(import.meta.dirname, "src/index.ts"),
|
||||
formats: ["es", "cjs"],
|
||||
fileName: format => format === "es" ? "index.js" : "index.cjs",
|
||||
cssFileName: "style"
|
||||
},
|
||||
rollupOptions: {
|
||||
// peer-зависимости НЕ бандлим — их принесёт web part
|
||||
external: ["react", "react-dom", "react/jsx-runtime", "@fluentui/react", "tslib"]
|
||||
},
|
||||
cssCodeSplit: false,
|
||||
sourcemap: true
|
||||
},
|
||||
test: {
|
||||
projects: [{
|
||||
extends: true,
|
||||
plugins: [
|
||||
// The plugin will run tests for the stories defined in your Storybook config
|
||||
// See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
|
||||
storybookTest({
|
||||
configDir: path.join(dirname, '.storybook')
|
||||
})],
|
||||
test: {
|
||||
name: 'storybook',
|
||||
browser: {
|
||||
enabled: true,
|
||||
headless: true,
|
||||
provider: playwright({}),
|
||||
instances: [{
|
||||
browser: 'chromium'
|
||||
}]
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user