Files
ADS3-Design-System/vite.lib.config.ts
Richie ce1efd1c13
Some checks failed
Publish package to GitHub Packages / publish (push) Has been cancelled
Add shared SDC app shell (SdcTopBar + ApiSettings + unified credentials)
Workstream D: a shared top bar for the SDC tool suite — app name (left), API
settings cog, and the suite app directory (grid) — composed on the existing
TopBar. Adds an ApiSettings dialog and sdc_api_key/sdc_api_endpoint credential
helpers (shared once across all tools, with legacy-key migration). lucide-react
becomes a peer dependency. Bump to 0.2.0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 08:44:00 +10:00

48 lines
1.6 KiB
TypeScript

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import dts from 'vite-plugin-dts'
import { resolve } from 'node:path'
// Library build for distribution as an installable package (@geljic/ads3-design-system).
// Kept separate from vite.config.ts so the Storybook + Vitest setup there stays untouched.
// Build with: npm run build:lib
export default defineConfig({
plugins: [
react(),
dts({
tsconfigPath: './tsconfig.app.json',
// Emit `dist/index.d.ts` (+ per-file declarations) rather than nesting under dist/src.
entryRoot: 'src',
include: ['src'],
exclude: [
'src/**/*.stories.tsx',
'src/**/*.test.tsx',
'src/main.tsx',
'src/App.tsx',
'src/**/_story-helpers*',
],
}),
],
resolve: {
// Resolve ADS's 97 internal `@/...` imports at build time so they never leak to consumers.
alias: { '@': resolve(__dirname, 'src') },
},
build: {
lib: {
entry: resolve(__dirname, 'src/index.ts'),
formats: ['es'],
fileName: () => 'index.js',
},
rollupOptions: {
// React + lucide-react are peer deps (consumer apps already have them) — externalise to avoid
// bundling a second copy. Everything else (clsx, tailwind-merge, @floating-ui) is small and bundled.
external: ['react', 'react-dom', 'react/jsx-runtime', 'lucide-react'],
output: { preserveModules: false },
},
sourcemap: true,
emptyOutDir: true,
// Library output only — don't copy public/ (favicons, logos) into the package.
copyPublicDir: false,
},
})