Skip to content

Commit

Permalink
chore: bundle library, emit type declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasphil committed Aug 20, 2024
1 parent 87ffb38 commit ee96371
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { setup } from "@storybook/vue3";
import PrimeVue from "primevue/config";
import preset from "../src/primevue";
import { RisUi } from "../src/primevue";

setup((app) => {
app.use(PrimeVue, {
pt: preset,
pt: RisUi,
unstyled: true,
});
});
24 changes: 22 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
{
"name": "ris-ui",
"private": true,
"version": "0.0.0",
"private": false,
"description": "Component library for NeuRIS",
"author": "TBD.",
"license": "GPL-3.0-only",
"type": "module",
"repository": "https://github.com/digitalservicebund/ris-ui",
"files": [
"dist"
],
"exports": {
".": {
"import": "./dist/primevue.js",
"types": "./dist/primevue/index.d.ts"
},
"./style.css": {
"import": "./dist/style.css"
},
"./tailwind": {
"import": "./dist/tailwind.js",
"types": "./dist/tailwind/index.d.ts"
}
},
"scripts": {
"storybook": "storybook dev -p 6006",
"build": "vue-tsc -b && vite build",
"build": "vite build; vue-tsc -p tsconfig.lib.json",
"build:storybook": "storybook build",
"prettier:check": "prettier --check .",
"prettier:fix": "prettier --write --ignore-unknown ."
Expand Down
2 changes: 1 addition & 1 deletion src/primevue/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import inputGroupAddon from "./inputGroup/inputGroupAddon";
import inputText from "./inputText/inputText";
import password from "./password/password";

export default {
export const RisUi = {
button,
inputText,
inputGroup,
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"module": "ESNext",
"skipLibCheck": true,
"target": "ES2020",
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.tsbuildinfo",
"useDefineForClassFields": true,

/* Bundler mode */
Expand Down
17 changes: 17 additions & 0 deletions tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "./tsconfig.json",

"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.lib.tsbuildinfo",

/* Build output */
"declaration": true,
"emitDeclarationOnly": true,
"noEmit": false,
"outDir": "dist",
"rootDir": "./src"
},

"include": ["src/**/*.ts"],
"exclude": ["src/**/*.stories.ts"]
}
6 changes: 4 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ export default defineConfig({

build: {
lib: {
entry: "src/primevue/index.ts",
name: "ris-ui",
entry: {
primevue: "src/primevue/index.ts",
tailwind: "src/tailwind/index.ts",
},
formats: ["es"],
},
rollupOptions: {
Expand Down

0 comments on commit ee96371

Please sign in to comment.