Skip to content

Commit

Permalink
Added DataTable as lib component
Browse files Browse the repository at this point in the history
  • Loading branch information
Noé Grangier committed Jul 12, 2024
1 parent 67158eb commit 3526684
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 4 deletions.
17 changes: 16 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
"preview": "vite preview",
"prepare": "pnpm run build"
},
"files": [
"dist"
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/dataviz.es.js",
"require": "./dist/dataviz.umd.js"
}
},
"dependencies": {
"@radix-ui/react-collapsible": "^1.0.3",
Expand Down Expand Up @@ -40,5 +51,9 @@
"tailwindcss": "^3.4.4",
"typescript": "^5.2.2",
"vite": "^5.2.0"
},
"peerDependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
}
}
3 changes: 3 additions & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import DataTable from "./organisms/DataTable";

export default DataTable;
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
"baseUrl": ".",
"paths": {
"@/*": [
"./src/*"
]
"./src/*",
],
"dataviz": [ "./src/components/index.ts" ]
}
},
"include": ["src"],
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"allowSyntheticDefaultImports": true,
"strict": true
},
"include": ["vite.config.ts"]
"include": ["vite.config.ts", "package.json"]
}
12 changes: 12 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from "path"
import * as packageJson from './package.json'

export default defineConfig({
plugins: [react()],
Expand All @@ -9,4 +10,15 @@ export default defineConfig({
"@": path.resolve(__dirname, "./src"),
},
},
build: {
lib: {
entry: path.resolve('src', 'components/index.ts'),
name: 'dataviz',
formats: ['es', 'umd'],
fileName: (format) => `dataviz.${format}.js`,
},
rollupOptions: {
external: [...Object.keys(packageJson.peerDependencies)],
},
},
});

0 comments on commit 3526684

Please sign in to comment.