diff --git a/packages/redux-devtools-ui/.eslintignore b/packages/redux-devtools-ui/.eslintignore index b448b494..232c27de 100644 --- a/packages/redux-devtools-ui/.eslintignore +++ b/packages/redux-devtools-ui/.eslintignore @@ -1,2 +1,2 @@ -dist +lib storybook-static diff --git a/packages/redux-devtools-ui/babel.config.esm.json b/packages/redux-devtools-ui/babel.config.esm.json new file mode 100644 index 00000000..d616aff2 --- /dev/null +++ b/packages/redux-devtools-ui/babel.config.esm.json @@ -0,0 +1,8 @@ +{ + "presets": [ + ["@babel/preset-env", { "targets": "defaults", "modules": false }], + "@babel/preset-react", + "@babel/preset-typescript" + ], + "plugins": ["@babel/plugin-transform-runtime"] +} diff --git a/packages/redux-devtools-ui/.babelrc b/packages/redux-devtools-ui/babel.config.json similarity index 100% rename from packages/redux-devtools-ui/.babelrc rename to packages/redux-devtools-ui/babel.config.json diff --git a/packages/redux-devtools-ui/package.json b/packages/redux-devtools-ui/package.json index 56671a1a..fd1cba21 100644 --- a/packages/redux-devtools-ui/package.json +++ b/packages/redux-devtools-ui/package.json @@ -9,13 +9,14 @@ "license": "MIT", "author": "Mihail Diordiev (https://github.com/zalmoxisus)", "files": [ - "dist", "fonts", + "lib", "src" ], - "main": "dist/redux-devtools-ui.cjs.js", - "module": "dist/redux-devtools-ui.esm.js", - "types": "dist/index.d.ts", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", + "types": "lib/types/index.d.ts", + "sideEffects": false, "repository": { "type": "git", "url": "https://github.com/reduxjs/redux-devtools.git" @@ -25,8 +26,11 @@ "storybook": "start-storybook -p 6006 -s ./fonts", "build-storybook": "build-storybook -s ./fonts", "build": "yarn run build:lib && yarn run build-storybook", - "build:lib": "rollup -c", - "clean": "rimraf dist storybook-static", + "build:lib": "yarn build:cjs && yarn build:esm && yarn build:types", + "build:cjs": "babel src --extensions \".ts,.tsx\" --out-dir lib/cjs", + "build:esm": "babel src --config-file ./babel.config.esm.json --extensions \".ts,.tsx\" --out-dir lib/esm", + "build:types": "tsc --emitDeclarationOnly", + "clean": "rimraf lib storybook-static", "test": "jest", "lint": "eslint . --ext .ts,.tsx", "lint:css": "stylelint \"./src/**/*.js\"", @@ -53,13 +57,13 @@ "simple-element-resize-detector": "^1.3.0" }, "devDependencies": { + "@babel/cli": "^7.16.8", "@babel/core": "^7.16.12", "@babel/eslint-parser": "^7.16.5", "@babel/plugin-transform-runtime": "^7.16.10", "@babel/preset-env": "^7.16.11", "@babel/preset-react": "^7.16.7", "@babel/preset-typescript": "^7.16.7", - "@rollup/plugin-babel": "^5.3.0", "@storybook/addon-essentials": "^6.4.14", "@storybook/react": "^6.4.14", "@testing-library/dom": "^8.11.2", @@ -83,8 +87,6 @@ "react-dom": "^17.0.2", "react-is": "^17.0.2", "rimraf": "^3.0.2", - "rollup": "^2.66.0", - "rollup-plugin-typescript2": "^0.31.1", "styled-components": "^5.3.3", "stylelint": "^14.2.0", "stylelint-config-prettier": "^9.0.3", @@ -92,7 +94,6 @@ "stylelint-config-styled-components": "^0.1.1", "stylelint-processor-styled-components": "^1.10.0", "ts-jest": "^27.1.3", - "tslib": "^2.3.1", "typescript": "~4.5.5", "webpack": "^5.67.0" }, diff --git a/packages/redux-devtools-ui/rollup.config.js b/packages/redux-devtools-ui/rollup.config.js deleted file mode 100644 index fb215be8..00000000 --- a/packages/redux-devtools-ui/rollup.config.js +++ /dev/null @@ -1,43 +0,0 @@ -import typescript from 'rollup-plugin-typescript2'; -import babel from '@rollup/plugin-babel'; - -const config = [ - { - input: 'src/index.ts', - output: [ - { - file: 'dist/redux-devtools-ui.cjs.js', - format: 'cjs', - }, - { - file: 'dist/redux-devtools-ui.esm.js', - format: 'esm', - }, - ], - plugins: [ - typescript(), - babel({ - babelHelpers: 'runtime', - extensions: ['.ts', '.tsx'], - plugins: ['@babel/plugin-transform-runtime'], - }), - ], - external: [ - /@babel\/runtime/, - /\.css/, - 'react', - 'prop-types', - 'styled-components', - 'color', - 'redux-devtools-themes', - 'base16', - '@rjsf/core', - /codemirror/, - 'react-select', - /react-icons/, - 'simple-element-resize-detector', - ], - }, -]; - -export default config; diff --git a/packages/redux-devtools-ui/tsconfig.json b/packages/redux-devtools-ui/tsconfig.json index 7b7d1492..0aade49a 100644 --- a/packages/redux-devtools-ui/tsconfig.json +++ b/packages/redux-devtools-ui/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../tsconfig.react.base.json", "compilerOptions": { - "outDir": "lib" + "outDir": "lib/types" }, "include": ["src"] } diff --git a/yarn.lock b/yarn.lock index 934df201..c79418ef 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5197,6 +5197,7 @@ __metadata: version: 0.0.0-use.local resolution: "@redux-devtools/ui@workspace:packages/redux-devtools-ui" dependencies: + "@babel/cli": ^7.16.8 "@babel/core": ^7.16.12 "@babel/eslint-parser": ^7.16.5 "@babel/plugin-transform-runtime": ^7.16.10 @@ -5205,7 +5206,6 @@ __metadata: "@babel/preset-typescript": ^7.16.7 "@babel/runtime": ^7.16.7 "@rjsf/core": ^3.2.1 - "@rollup/plugin-babel": ^5.3.0 "@storybook/addon-essentials": ^6.4.14 "@storybook/react": ^6.4.14 "@testing-library/dom": ^8.11.2 @@ -5242,8 +5242,6 @@ __metadata: react-select: ^5.2.2 redux-devtools-themes: ^1.0.0 rimraf: ^3.0.2 - rollup: ^2.66.0 - rollup-plugin-typescript2: ^0.31.1 simple-element-resize-detector: ^1.3.0 styled-components: ^5.3.3 stylelint: ^14.2.0 @@ -5252,7 +5250,6 @@ __metadata: stylelint-config-styled-components: ^0.1.1 stylelint-processor-styled-components: ^1.10.0 ts-jest: ^27.1.3 - tslib: ^2.3.1 typescript: ~4.5.5 webpack: ^5.67.0 peerDependencies: