mirror of
https://github.com/penpot/penpot.git
synced 2026-05-23 00:43:41 +00:00
- Configure @penpot/ui package with full tooling: ESLint 9, Stylelint, Prettier, Vitest, Storybook (react-vite), vite-plugin-dts, React Compiler - Add AGENTS.md with architecture overview, conventions, and migration table - Fix Storybook react-docgen TypeScript parse error by removing empty .babelrc that disabled Babel's built-in typescript plugin - Fix vite.config.mts for @vitejs/plugin-react v6 (reactCompilerPreset()) - Fix tsconfig.storybook.json (remove emitDecoratorMetadata without decorator) - Add shared SCSS foundations: _borders, _sizes, _utils, typography - Migrate Text, Heading (foundations/typography) with stories and tests - Migrate Icon (foundations/assets) with full iconIds catalogue and stories - Migrate Cta (product) with stories and tests - Migrate Button (buttons) with polymorphic anchor/button rendering, 4 variants, optional icon, and onRef callback; add _buttons.scss partial - All checks passing: lint, check-fmt, typecheck, test (41 tests)
64 lines
1.4 KiB
TypeScript
64 lines
1.4 KiB
TypeScript
/// <reference types='vitest' />
|
|
import { defineConfig } from 'vite';
|
|
import react, { reactCompilerPreset } from '@vitejs/plugin-react';
|
|
import dts from 'vite-plugin-dts';
|
|
import * as path from 'path';
|
|
import { copyFileSync } from 'node:fs';
|
|
|
|
const copyCssPlugin = () => ({
|
|
name: 'copy-css',
|
|
closeBundle: () => {
|
|
try {
|
|
copyFileSync(
|
|
'dist/index.css',
|
|
'../../resources/public/css/ui.css',
|
|
);
|
|
} catch (e) {
|
|
console.log('Error copying css file', e);
|
|
}
|
|
},
|
|
});
|
|
|
|
export default defineConfig(() => ({
|
|
root: import.meta.dirname,
|
|
plugins: [
|
|
react(),
|
|
reactCompilerPreset(),
|
|
dts({
|
|
entryRoot: 'src',
|
|
tsconfigPath: path.join(import.meta.dirname, 'tsconfig.lib.json'),
|
|
pathsToAliases: false,
|
|
}),
|
|
copyCssPlugin(),
|
|
],
|
|
build: {
|
|
outDir: 'dist/',
|
|
emptyOutDir: true,
|
|
reportCompressedSize: true,
|
|
commonjsOptions: {
|
|
transformMixedEsModules: true,
|
|
},
|
|
lib: {
|
|
entry: 'src/index.ts',
|
|
name: 'ui',
|
|
fileName: 'index',
|
|
formats: ['es' as const],
|
|
},
|
|
rollupOptions: {
|
|
external: ['react', 'react-dom', 'react/jsx-runtime'],
|
|
},
|
|
},
|
|
test: {
|
|
name: 'ui',
|
|
watch: false,
|
|
globals: true,
|
|
environment: 'jsdom',
|
|
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
reporters: ['default'],
|
|
coverage: {
|
|
reportsDirectory: '../../coverage/libs/ui',
|
|
provider: 'v8' as const,
|
|
},
|
|
},
|
|
}));
|