Skip to content

Commit

Permalink
Fix ts types, update typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillku committed Jun 29, 2021
1 parent 5e06433 commit f04c0b6
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 40 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@
"react-docgen-typescript-loader": "^3.7.2",
"rollup": "^2.23.0",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-dts": "^3.0.2",
"rollup-plugin-eslint": "^7.0.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-terser": "^6.1.0",
"rollup-plugin-typescript2": "^0.27.1",
"storybook-dark-mode": "^0.6.1",
"ts-loader": "^8.0.2",
"typescript": "^3.9.7"
"typescript": "^4.3.4"
}
}
80 changes: 45 additions & 35 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import alias from "@rollup/plugin-alias";
import strip from "@rollup/plugin-strip";
import dts from "rollup-plugin-dts";

import babel from "rollup-plugin-babel";
import typescript from "rollup-plugin-typescript2";
Expand All @@ -15,38 +16,47 @@ const extensions = [".mjs", ".js", ".ts", ".tsx", ".json"];

const isProduction = process.env.NODE_ENV === "production";

export default {
input: "src",
output: [
{
file: "dist/common.js",
format: "cjs",
sourcemap: true,
},
{
file: "dist/index.js",
format: "esm",
sourcemap: true,
},
],
external: [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
],
plugins: [
alias({
entries: { "~": "./src" },
resolve: extensions,
}),
eslint(),
typescript({ rollupCommonJSResolveHack: true, clean: true }),
babel({
extensions,
exclude: "node_modules/**",
}),
resolve({ extensions }),
isProduction && strip(),
commonjs(),
isProduction && terser(),
],
};
const config = [
{
input: "src",
output: [
{
file: "dist/common.js",
format: "cjs",
sourcemap: true,
},
{
file: "dist/index.js",
format: "esm",
sourcemap: true,
},
],
external: [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
],
plugins: [
alias({
entries: { "~": "./src" },
resolve: extensions,
}),
eslint(),
typescript({ rollupCommonJSResolveHack: true, clean: true }),
babel({
extensions,
exclude: "node_modules/**",
}),
resolve({ extensions }),
isProduction && strip(),
commonjs(),
isProduction && terser(),
],
},
{
input: "./dist/src/index.d.ts",
output: [{ file: "dist/index.d.ts", format: "es" }],
plugins: [dts()],
},
];

export default config;
45 changes: 41 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
dependencies:
"@babel/highlight" "^7.10.4"

"@babel/code-frame@^7.12.13":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.14.5.tgz#23b08d740e83f49c5e59945fbf1b43e80bbf4edb"
integrity sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw==
dependencies:
"@babel/highlight" "^7.14.5"

"@babel/compat-data@^7.10.4", "@babel/compat-data@^7.11.0":
version "7.11.0"
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.11.0.tgz#e9f73efe09af1355b723a7f39b11bad637d7c99c"
Expand Down Expand Up @@ -511,6 +518,11 @@
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2"
integrity sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==

"@babel/helper-validator-identifier@^7.14.5":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.5.tgz#d0f0e277c512e0c938277faa85a3968c9a44c0e8"
integrity sha512-5lsetuxCLilmVGyiLEfoHBRX8UCFD+1m2x3Rj97WrW3V7H3u4RWRXA4evMjImCsin2J2YT0QaVDGf+z8ondbAg==

"@babel/helper-wrap-function@^7.10.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.10.4.tgz#8a6f701eab0ff39f765b5a1cfef409990e624b87"
Expand Down Expand Up @@ -567,6 +579,15 @@
chalk "^2.0.0"
js-tokens "^4.0.0"

"@babel/highlight@^7.14.5":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.14.5.tgz#6861a52f03966405001f6aa534a01a24d99e8cd9"
integrity sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg==
dependencies:
"@babel/helper-validator-identifier" "^7.14.5"
chalk "^2.0.0"
js-tokens "^4.0.0"

"@babel/parser@^7.1.0", "@babel/parser@^7.10.4", "@babel/parser@^7.11.0":
version "7.11.0"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.11.0.tgz#a9d7e11aead25d3b422d17b2c6502c8dddef6a5d"
Expand Down Expand Up @@ -8127,6 +8148,13 @@ magic-string@^0.25.2, magic-string@^0.25.5:
dependencies:
sourcemap-codec "^1.4.4"

magic-string@^0.25.7:
version "0.25.7"
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051"
integrity sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==
dependencies:
sourcemap-codec "^1.4.4"

make-dir@^2.0.0, make-dir@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5"
Expand Down Expand Up @@ -10602,6 +10630,15 @@ rollup-plugin-babel@^4.4.0:
"@babel/helper-module-imports" "^7.0.0"
rollup-pluginutils "^2.8.1"

rollup-plugin-dts@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/rollup-plugin-dts/-/rollup-plugin-dts-3.0.2.tgz#2b628d88f864d271d6eaec2e4c2a60ae4e944c5c"
integrity sha512-hswlsdWu/x7k5pXzaLP6OvKRKcx8Bzprksz9i9mUe72zvt8LvqAb/AZpzs6FkLgmyRaN8B6rUQOVtzA3yEt9Yw==
dependencies:
magic-string "^0.25.7"
optionalDependencies:
"@babel/code-frame" "^7.12.13"

rollup-plugin-eslint@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/rollup-plugin-eslint/-/rollup-plugin-eslint-7.0.0.tgz#a6dbcbc14699a7a02155697c0c3dfa26cca59a9b"
Expand Down Expand Up @@ -11906,10 +11943,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

typescript@^3.9.7:
version "3.9.7"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa"
integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==
typescript@^4.3.4:
version "4.3.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.4.tgz#3f85b986945bcf31071decdd96cf8bfa65f9dcbc"
integrity sha512-uauPG7XZn9F/mo+7MrsRjyvbxFpzemRjKEZXS4AK83oP2KKOJPvb+9cO/gmnv8arWZvhnjVOXz7B49m1l0e9Ew==

uglify-js@^2.6.1:
version "2.8.29"
Expand Down

0 comments on commit f04c0b6

Please sign in to comment.