Use rollup for redux-devtools

This commit is contained in:
Nathan Bierema 2022-01-08 23:35:55 -05:00
parent 41fe530bdb
commit 5d1ff2f5e5
6 changed files with 61 additions and 19 deletions

View File

@ -1,6 +1,6 @@
{
"presets": [
"@babel/preset-env",
["@babel/preset-env", { "targets": "defaults" }],
"@babel/preset-react",
"@babel/preset-typescript"
]

View File

@ -1,3 +1,2 @@
dist
examples
lib
umd

View File

@ -1,10 +1,14 @@
module.exports = {
extends: '../../eslintrc.ts.react.base.json',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
extends: '../../eslintrc.js.base.json',
overrides: [
{
files: ['*.ts', '*.tsx'],
extends: '../../eslintrc.ts.react.base.json',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
},
{
files: ['test/**/*.ts', 'test/**/*.tsx'],
extends: '../../eslintrc.ts.react.jest.base.json',

View File

@ -17,20 +17,19 @@
"license": "MIT",
"author": "Dan Abramov <dan.abramov@me.com> (http://github.com/gaearon)",
"files": [
"lib",
"dist",
"src"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"main": "dist/redux-devtools.cjs.js",
"module": "dist/redux-devtools.esm.js",
"types": "dist/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/reduxjs/redux-devtools.git"
},
"scripts": {
"build": "yarn run build:types && yarn run build:js",
"build:types": "tsc --emitDeclarationOnly",
"build:js": "babel src --out-dir lib --extensions \".ts,.tsx\" --source-maps inline",
"clean": "rimraf lib",
"build": "rollup -c",
"clean": "rimraf dist",
"test": "jest",
"lint": "eslint . --ext .ts,.tsx",
"type-check": "tsc --noEmit",
@ -38,20 +37,22 @@
"prepublish": "yarn run type-check && yarn run lint && yarn run test"
},
"dependencies": {
"@babel/runtime": "^7.16.7",
"@redux-devtools/instrument": "^1.11.2",
"@types/prop-types": "^15.7.4",
"lodash": "^4.17.21",
"prop-types": "^15.8.0"
},
"devDependencies": {
"@babel/cli": "^7.16.7",
"@babel/core": "^7.16.7",
"@babel/eslint-parser": "^7.16.5",
"@babel/plugin-transform-runtime": "^7.16.7",
"@babel/preset-env": "^7.16.7",
"@babel/preset-react": "^7.16.7",
"@babel/preset-typescript": "^7.16.7",
"@rollup/plugin-babel": "^5.3.0",
"@types/jest": "^27.4.0",
"@types/lodash": "^4.14.178",
"@types/node": "^16.11.17",
"@types/react": "^17.0.38",
"@types/react-redux": "^7.1.21",
"@typescript-eslint/eslint-plugin": "^5.8.1",
@ -67,7 +68,10 @@
"react-redux": "^7.2.6",
"redux": "^4.1.2",
"rimraf": "^3.0.2",
"rollup": "^2.63.0",
"rollup-plugin-typescript2": "^0.31.1",
"ts-jest": "^27.1.2",
"tslib": "^2.3.1",
"typescript": "~4.5.4"
},
"peerDependencies": {

View File

@ -0,0 +1,30 @@
import typescript from 'rollup-plugin-typescript2';
import babel from '@rollup/plugin-babel';
const config = [
{
input: 'src/index.ts',
output: [
{ file: 'dist/redux-devtools.cjs.js', format: 'cjs' },
{ file: 'dist/redux-devtools.esm.js', format: 'esm' },
],
plugins: [
typescript(),
babel({
babelHelpers: 'runtime',
extensions: ['.ts', '.tsx'],
plugins: ['@babel/plugin-transform-runtime'],
}),
],
external: [
/@babel\/runtime/,
'@redux-devtools/instrument',
/lodash/,
'react',
'prop-types',
'react-redux',
],
},
];
export default config;

View File

@ -4715,15 +4715,17 @@ __metadata:
version: 0.0.0-use.local
resolution: "@redux-devtools/core@workspace:packages/redux-devtools"
dependencies:
"@babel/cli": ^7.16.7
"@babel/core": ^7.16.7
"@babel/eslint-parser": ^7.16.5
"@babel/plugin-transform-runtime": ^7.16.7
"@babel/preset-env": ^7.16.7
"@babel/preset-react": ^7.16.7
"@babel/preset-typescript": ^7.16.7
"@babel/runtime": ^7.16.7
"@redux-devtools/instrument": ^1.11.2
"@rollup/plugin-babel": ^5.3.0
"@types/jest": ^27.4.0
"@types/lodash": ^4.14.178
"@types/node": ^16.11.17
"@types/prop-types": ^15.7.4
"@types/react": ^17.0.38
"@types/react-redux": ^7.1.21
@ -4742,7 +4744,10 @@ __metadata:
react-redux: ^7.2.6
redux: ^4.1.2
rimraf: ^3.0.2
rollup: ^2.63.0
rollup-plugin-typescript2: ^0.31.1
ts-jest: ^27.1.2
tslib: ^2.3.1
typescript: ~4.5.4
peerDependencies:
react: ^0.14.9 || ^15.3.0 || ^16.0.0 || ^17.0.0