Skip to content

Commit

Permalink
Update build process to include type declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
ioan-ghisoi-cko committed Nov 25, 2024
1 parent e8c2bde commit 9853c0e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 13 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frames-react",
"version": "1.2.1",
"version": "1.2.2",
"main": "dist/cjs/index.js",
"scripts": {
"build": "rollup -c",
Expand All @@ -14,6 +14,7 @@
"classnames": "^2.5.1",
"react": "^17.0.0 || ^18.0.0",
"react-dom": "^17.0.0 || ^18.0.0",
"rollup-plugin-typescript2": "^0.36.0",
"tslib": "^2.8.1"
},
"devDependencies": {
Expand All @@ -39,7 +40,7 @@
"react-dom": "^17.0.0 || ^18.0.0"
},
"module": "dist/esm/index.js",
"types": "dist/index.d.ts",
"types": "dist/types/index.d.ts",
"files": [
"dist"
]
Expand Down
19 changes: 16 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import resolve from "@rollup/plugin-node-resolve";
import typescript from "rollup-plugin-typescript2";
import commonjs from "@rollup/plugin-commonjs";
import typescript from "@rollup/plugin-typescript";
import peerDepsExternal from "rollup-plugin-peer-deps-external";
import { terser } from "rollup-plugin-terser";

Expand All @@ -22,9 +22,22 @@ export default {
],
plugins: [
peerDepsExternal(),
resolve(),
resolve({
extensions: [".mjs", ".js", ".jsx", ".ts", ".tsx"],
}),
commonjs(),
typescript({ tsconfig: "./tsconfig.json" }),
terser(),
typescript({
tsconfig: "./tsconfig.json",
tsconfigOverride: {
compilerOptions: {
declaration: true,
declarationDir: "dist/types",
},
include: ["src/**/*"],
},
useTsconfigDeclarationDir: true,
clean: true,
}),
],
};
16 changes: 8 additions & 8 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"module": "ESNext",
"target": "ES6",
"jsx": "react",
"moduleResolution": "node",
"declaration": true,
"declarationDir": "./dist/types",
"esModuleInterop": true,
"skipLibCheck": true,
"moduleResolution": "node",
"strict": true,
"baseUrl": ".",
"paths": {
"frames-react": ["../dist"]
}
"skipLibCheck": true,
"outDir": "./dist",
"baseUrl": "."
},
"include": ["src/**/*", "tests/**/*"],
"exclude": ["node_modules", "dist"]
"include": ["src/**/*.ts", "src/**/*.tsx"],
"exclude": ["node_modules", "dist", "tests"]
}

0 comments on commit 9853c0e

Please sign in to comment.