Skip to content

Commit 90efbfc

Browse files
committed
fix: add types for typescript project in dist files
1 parent c53afc2 commit 90efbfc

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "react-tooltip",
3-
"version": "5.0.0-beta.0",
3+
"version": "5.0.0-beta.1",
44
"description": "react tooltip component",
55
"scripts": {
66
"dev": "node ./cli.js --env=development && node --max_old_space_size=2048 ./node_modules/rollup/dist/bin/rollup -c rollup.config.dev.js --watch",
7-
"build": "node ./cli.js --env=production && node --max_old_space_size=2048 ./node_modules/rollup/dist/bin/rollup -c rollup.config.prod.js",
7+
"build": "node ./cli.js --env=production && npm run types && node --max_old_space_size=2048 ./node_modules/rollup/dist/bin/rollup -c rollup.config.prod.js",
88
"types": "node --max_old_space_size=2048 ./node_modules/rollup/dist/bin/rollup -c rollup.config.types.js",
99
"eslint": "eslint --ext=js --ext=jsx --ext=ts --ext=tsx --fix ./src",
1010
"stylelint": "stylelint \"src/**/*.css\"",
@@ -27,7 +27,7 @@
2727
"format": "es"
2828
}
2929
],
30-
"types": "dist/index.d.ts",
30+
"types": "dist/react-tooltip.d.ts",
3131
"type": "module",
3232
"license": "MIT",
3333
"private": false,

rollup.config.types.js

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
import dts from 'rollup-plugin-dts'
2+
import postcss from 'rollup-plugin-postcss'
23

34
export default {
4-
input: './build/index.d.ts',
5-
output: [{ file: 'build/index-builded.d.ts', format: 'es' }],
6-
plugins: [dts()],
5+
input: './src/index.tsx',
6+
output: [{ file: 'dist/react-tooltip.d.ts', format: 'es' }],
7+
plugins: [
8+
postcss({
9+
extract: 'react-tooltip-tokens.css', // this will generate a specific file and override on multiples build, but the css will be the same
10+
autoModules: true,
11+
include: '**/*.css',
12+
extensions: ['.css'],
13+
plugins: [],
14+
}),
15+
dts(),
16+
],
717
}

0 commit comments

Comments
 (0)