diff --git a/packages/map2tree/.eslintignore b/packages/map2tree/.eslintignore index 1521c8b7..a65b4177 100644 --- a/packages/map2tree/.eslintignore +++ b/packages/map2tree/.eslintignore @@ -1 +1 @@ -dist +lib diff --git a/packages/map2tree/babel.config.esm.json b/packages/map2tree/babel.config.esm.json new file mode 100644 index 00000000..1c02687e --- /dev/null +++ b/packages/map2tree/babel.config.esm.json @@ -0,0 +1,7 @@ +{ + "presets": [ + ["@babel/preset-env", { "targets": "defaults", "modules": false }], + "@babel/preset-typescript" + ], + "plugins": ["@babel/plugin-transform-runtime"] +} diff --git a/packages/map2tree/.babelrc b/packages/map2tree/babel.config.json old mode 100755 new mode 100644 similarity index 100% rename from packages/map2tree/.babelrc rename to packages/map2tree/babel.config.json diff --git a/packages/map2tree/package.json b/packages/map2tree/package.json index d483417d..2cf6ec44 100755 --- a/packages/map2tree/package.json +++ b/packages/map2tree/package.json @@ -16,20 +16,25 @@ "license": "MIT", "author": "romseguy", "files": [ - "dist", + "lib", "src" ], - "main": "dist/map2tree.cjs.js", - "module": "dist/map2tree.esm.js", - "types": "dist/index.d.ts", - "unpkg": "dist/map2tree.umd.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", + "types": "lib/types/index.d.ts", + "unpkg": "lib/umd/map2tree.umd.js", + "sideEffects": false, "repository": { "type": "git", "url": "https://github.com/reduxjs/redux-devtools.git" }, "scripts": { - "build": "rollup -c", - "clean": "rimraf dist", + "build": "yarn build:cjs && yarn build:esm && yarn build:types && yarn build:umd", + "build:cjs": "babel src --extensions \".ts\" --out-dir lib/cjs", + "build:esm": "babel src --config-file ./babel.config.esm.json --extensions \".ts\" --out-dir lib/esm", + "build:types": "tsc --emitDeclarationOnly", + "build:umd": "rollup -c", + "clean": "rimraf lib", "test": "jest", "lint": "eslint . --ext .ts", "type-check": "tsc --noEmit", @@ -41,6 +46,7 @@ "lodash": "^4.17.21" }, "devDependencies": { + "@babel/cli": "^7.16.8", "@babel/core": "^7.16.12", "@babel/eslint-parser": "^7.16.5", "@babel/plugin-transform-runtime": "^7.16.10", diff --git a/packages/map2tree/rollup.config.js b/packages/map2tree/rollup.config.js index db24ba2e..f977bb7c 100644 --- a/packages/map2tree/rollup.config.js +++ b/packages/map2tree/rollup.config.js @@ -9,11 +9,13 @@ const config = [ input: 'src/index.ts', output: { name: 'map2tree', - file: 'dist/map2tree.umd.js', + file: 'lib/umd/map2tree.js', format: 'umd', }, plugins: [ - typescript(), + typescript({ + tsconfigOverride: { compilerOptions: { declaration: false } }, + }), resolve(), commonjs(), babel({ @@ -27,11 +29,13 @@ const config = [ input: 'src/index.ts', output: { name: 'map2tree', - file: 'dist/map2tree.umd.min.js', + file: 'lib/umd/map2tree.min.js', format: 'umd', }, plugins: [ - typescript(), + typescript({ + tsconfigOverride: { compilerOptions: { declaration: false } }, + }), resolve(), commonjs(), babel({ @@ -42,22 +46,6 @@ const config = [ terser(), ], }, - { - input: 'src/index.ts', - output: [ - { file: 'dist/map2tree.cjs.js', format: 'cjs' }, - { file: 'dist/map2tree.esm.js', format: 'esm' }, - ], - plugins: [ - typescript(), - babel({ - babelHelpers: 'runtime', - extensions: ['.ts'], - plugins: ['@babel/plugin-transform-runtime'], - }), - ], - external: [/@babel\/runtime/, /lodash/], - }, ]; export default config; diff --git a/packages/map2tree/tsconfig.json b/packages/map2tree/tsconfig.json index 7b7d1492..0aade49a 100644 --- a/packages/map2tree/tsconfig.json +++ b/packages/map2tree/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 96631e47..ee869086 100644 --- a/yarn.lock +++ b/yarn.lock @@ -20071,6 +20071,7 @@ __metadata: version: 0.0.0-use.local resolution: "map2tree@workspace:packages/map2tree" dependencies: + "@babel/cli": ^7.16.8 "@babel/core": ^7.16.12 "@babel/eslint-parser": ^7.16.5 "@babel/plugin-transform-runtime": ^7.16.10