From 4723e97c994727422f071ef44617870dd4d9bc69 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Wed, 23 Jul 2025 11:20:35 -0600 Subject: [PATCH] watchers --- packages/ui-components/package.json | 16 +++++++++++----- .../messageAutoChartHandler.ts | 2 ++ packages/ui-components/src/index.ts | 15 +++++++++++++++ packages/ui-components/tsconfig.json | 2 ++ packages/ui-components/vite.config.ts | 18 ++++++++++++++++++ 5 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 packages/ui-components/src/index.ts diff --git a/packages/ui-components/package.json b/packages/ui-components/package.json index c9c1bdeac..8f6758381 100644 --- a/packages/ui-components/package.json +++ b/packages/ui-components/package.json @@ -2,16 +2,22 @@ "name": "@buster/ui-components", "version": "1.0.0", "type": "module", - "main": "dist/index.js", - "types": "dist/index.d.ts", + "module": "./dist/index.js", + "types": "./dist/index.d.ts", "exports": { - "styles": "./src/styles/styles.css" + ".": { + "import": "./dist/index.js", + "types": "./dist/index.d.ts" + }, + "./styles": "./src/styles/styles.css", + "./dist/style.css": "./dist/style.css" }, + "files": ["dist", "src/styles/styles.css"], "scripts": { "prebuild": "tsx scripts/validate-env.ts", - "build": "tsc", + "build": "vite build && tsc --emitDeclarationOnly --declaration", "typecheck": "tsc --noEmit", - "dev": "tsc --watch", + "dev": "vite build --watch", "lint": "biome check", "test": "vitest run", "test:watch": "vitest watch", diff --git a/packages/ui-components/src/components/charts/stories/messageAutoChartHandler/messageAutoChartHandler.ts b/packages/ui-components/src/components/charts/stories/messageAutoChartHandler/messageAutoChartHandler.ts index a747ed345..5458a1a40 100644 --- a/packages/ui-components/src/components/charts/stories/messageAutoChartHandler/messageAutoChartHandler.ts +++ b/packages/ui-components/src/components/charts/stories/messageAutoChartHandler/messageAutoChartHandler.ts @@ -31,6 +31,8 @@ const keySpecificHandlers: Partial< if (colors && !isEmpty(colors)) return colors; if (colors && colors.length <= 3) return Array.from({ length: 3 }, (_, index) => colors[index % colors.length]); + + return; }, scatterDotSize: (value: unknown) => { const scatterDotSize = value as ChartConfigProps['scatterDotSize']; diff --git a/packages/ui-components/src/index.ts b/packages/ui-components/src/index.ts new file mode 100644 index 000000000..7f6351c40 --- /dev/null +++ b/packages/ui-components/src/index.ts @@ -0,0 +1,15 @@ +// Main entry point for @buster/ui-components +// +// Instead of using barrel exports, you can: +// 1. Import components directly: import { Button } from '@buster/ui-components/dist/components/button' +// 2. Or add specific exports here as needed + +// Example: Export specific components +// export { Button } from './components/button/Button'; +// export { Card } from './components/card/Card'; + +// Example: Export specific hooks +// export { useTheme } from './hooks/useTheme'; + +// For now, let's just export a version indicator +export const version = '1.0.0'; diff --git a/packages/ui-components/tsconfig.json b/packages/ui-components/tsconfig.json index ca36baa06..e86d46214 100644 --- a/packages/ui-components/tsconfig.json +++ b/packages/ui-components/tsconfig.json @@ -6,6 +6,8 @@ "rootDir": "src", "jsx": "react-jsx", "lib": ["ESNext", "DOM"], + "declarationDir": "dist", + "emitDeclarationOnly": true, "paths": { "@/hooks/*": ["./src/hooks/*"], "@/lib/*": ["./src/lib/*"] diff --git a/packages/ui-components/vite.config.ts b/packages/ui-components/vite.config.ts index 63be2a073..b85c2730f 100644 --- a/packages/ui-components/vite.config.ts +++ b/packages/ui-components/vite.config.ts @@ -1,7 +1,25 @@ +import { resolve } from 'node:path'; import tailwindcss from '@tailwindcss/vite'; import react from '@vitejs/plugin-react'; import { defineConfig } from 'vite'; export default defineConfig({ plugins: [react(), tailwindcss()], + build: { + lib: { + entry: resolve(__dirname, 'src/index.ts'), + formats: ['es'], + }, + rollupOptions: { + external: ['react', 'react-dom'], + output: { + // Preserve the directory structure for better tree-shaking + preserveModules: true, + preserveModulesRoot: 'src', + }, + }, + sourcemap: true, + // Ensure TypeScript declarations are generated + emptyOutDir: false, + }, });