From e7450ad0ee359961f6736b4a28c3cfba9d545c4b Mon Sep 17 00:00:00 2001 From: aidanCQ Date: Mon, 18 Dec 2023 18:16:09 +0000 Subject: [PATCH] fix(): Rollup and exports. --- index.ts | 3 +++ package-lock.json | 2 +- package.json | 4 ++-- rollup.config.js | 9 +++------ src/index.ts | 2 -- tsconfig.json | 1 + 6 files changed, 10 insertions(+), 11 deletions(-) create mode 100644 index.ts diff --git a/index.ts b/index.ts new file mode 100644 index 0000000..656434b --- /dev/null +++ b/index.ts @@ -0,0 +1,3 @@ +export * from "./src"; +import _theme from "./tailwind.config"; +export const theme = _theme; diff --git a/package-lock.json b/package-lock.json index 0150816..bcc5e3b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -69,7 +69,7 @@ "react-dom": "^18.2.0", "rollup": "^2.75.6", "rollup-plugin-copy": "^3.4.0", - "rollup-plugin-dts": "^4.2.2", + "rollup-plugin-dts": "^4.2.3", "rollup-plugin-peer-deps-external": "^2.2.4", "rollup-plugin-postcss": "^4.0.2", "rollup-plugin-replace": "^2.2.0", diff --git a/package.json b/package.json index ca9b907..49e2c7b 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "publishConfig": { "registry": "https://npm.pkg.github.com" }, - "module": "dist/src/index.js", + "module": "dist/index.js", "files": [ "dist" ], @@ -52,7 +52,7 @@ "react-dom": "^18.2.0", "rollup": "^2.75.6", "rollup-plugin-copy": "^3.4.0", - "rollup-plugin-dts": "^4.2.2", + "rollup-plugin-dts": "^4.2.3", "rollup-plugin-peer-deps-external": "^2.2.4", "rollup-plugin-postcss": "^4.0.2", "rollup-plugin-replace": "^2.2.0", diff --git a/rollup.config.js b/rollup.config.js index d9195b8..3a21997 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -6,13 +6,12 @@ import postcss from "rollup-plugin-postcss"; import { terser } from "rollup-plugin-terser"; export default [ { - input: "src/index.ts", + input: "index.ts", output: [ { dir: "dist/", format: "esm", - sourcemap: true, - preserveModules: true, + // preserveModules: true, }, ], plugins: [ @@ -23,15 +22,13 @@ export default [ // Create typescript definitions. typescript({ tsconfig: "./tsconfig.json", + declarationDir: "dist/types", }), // CSS vendor prefixing etc. postcss({ extract: path.resolve("./dist/tokens.css"), config: "./postcss.config.js", }), - // copy({ - // targets: [{ src: "./src/styles.css", dest: "./dist" }], - // }), // Minify output. terser(), ], diff --git a/src/index.ts b/src/index.ts index cfa3b23..5623936 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,3 @@ -export * from "../tailwind.config"; export * from "./atoms/accordion"; export * from "./atoms/alert"; export * from "./atoms/alert-dialog"; @@ -42,4 +41,3 @@ export * from "./atoms/use-toast"; export * from "./molecules/slide-in"; export * from "./molecules/theme-selector"; export * from "./utils"; -import "./tokens.css"; diff --git a/tsconfig.json b/tsconfig.json index 002606a..2506f2f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,6 +11,7 @@ "jsx": "react-jsx", "module": "ESNext", "declaration": true, + "sourceMap": true, "outDir": "dist", "moduleResolution": "node",