From e17e05a4a5b74ec024ac73ed07547509b319365e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Maisse?= Date: Sun, 19 Jan 2020 11:19:10 +0100 Subject: [PATCH] fix: clean usage of `@types/webpack-env` dep in all packages - `@types/webpack-env` must be defined as `dependencies` in packages that export a type/function using typings from `@types/webpack-env` (it is often `NodeModule`). In that case `/// ` is present in some files of the `dist` folder of the lib. Example: `lib/client-api`. - `@types/webpack-env` must be defined as `devDependencies` in packages that use its typings internally but does not expose anything related to it. Many addons need the type because they use `module.hot` function. Example: `addons/a11y` - `webpack-env` should be removed from "compilerOptions.types" key of `tsconfig.json` of packages that don't need it. I also bump `@types/webpack-env` to ^1.15.0 to have the same version all across the monorepo --- addons/a11y/package.json | 3 ++- addons/actions/package.json | 3 ++- addons/backgrounds/package.json | 3 ++- addons/centered/package.json | 1 + addons/cssresources/package.json | 3 +++ addons/docs/package.json | 1 - addons/essentials/tsconfig.json | 2 +- addons/events/package.json | 3 +++ addons/jest/package.json | 3 +++ addons/knobs/package.json | 3 ++- addons/links/package.json | 3 +++ addons/notes/package.json | 2 +- addons/ondevice-backgrounds/tsconfig.json | 3 +-- addons/ondevice-notes/tsconfig.json | 25 +++++++++++------------ addons/options/package.json | 3 +++ addons/queryparams/package.json | 3 +++ app/angular/package.json | 2 +- app/angular/src/client/index.ts | 2 -- app/angular/tsconfig.json | 2 +- app/html/package.json | 2 +- app/mithril/package.json | 1 + app/preact/package.json | 2 +- app/svelte/package.json | 1 + app/svelte/tsconfig.json | 2 +- app/vue/package.json | 2 +- app/web-components/package.json | 2 +- examples/angular-cli/package.json | 2 +- lib/client-api/package.json | 1 + lib/components/tsconfig.json | 1 - lib/router/tsconfig.json | 3 +-- lib/theming/tsconfig.json | 3 +-- package.json | 2 +- yarn.lock | 5 ----- 33 files changed, 56 insertions(+), 43 deletions(-) diff --git a/addons/a11y/package.json b/addons/a11y/package.json index 83c3e06cd36e..af66dee4b974 100644 --- a/addons/a11y/package.json +++ b/addons/a11y/package.json @@ -51,7 +51,8 @@ "util-deprecate": "^1.0.2" }, "devDependencies": { - "@types/react-redux": "^7.0.6" + "@types/react-redux": "^7.0.6", + "@types/webpack-env": "^1.15.0" }, "publishConfig": { "access": "public" diff --git a/addons/actions/package.json b/addons/actions/package.json index e1443e4fc1cf..cde6631e0a2f 100644 --- a/addons/actions/package.json +++ b/addons/actions/package.json @@ -45,7 +45,8 @@ }, "devDependencies": { "@types/lodash": "^4.14.149", - "@types/uuid": "^3.4.4" + "@types/uuid": "^3.4.4", + "@types/webpack-env": "^1.15.0" }, "publishConfig": { "access": "public" diff --git a/addons/backgrounds/package.json b/addons/backgrounds/package.json index 04d7e4af03c8..1721d503d5d7 100644 --- a/addons/backgrounds/package.json +++ b/addons/backgrounds/package.json @@ -44,7 +44,8 @@ "util-deprecate": "^1.0.2" }, "devDependencies": { - "@types/util-deprecate": "^1.0.0" + "@types/util-deprecate": "^1.0.0", + "@types/webpack-env": "^1.15.0" }, "publishConfig": { "access": "public" diff --git a/addons/centered/package.json b/addons/centered/package.json index 2a370a92ff46..c9db7cdb36e0 100644 --- a/addons/centered/package.json +++ b/addons/centered/package.json @@ -36,6 +36,7 @@ }, "devDependencies": { "@types/mithril": "^1.1.16", + "@types/webpack-env": "^1.15.0", "mithril": "*", "preact": "*", "react": "*" diff --git a/addons/cssresources/package.json b/addons/cssresources/package.json index 8bdbb185ef62..59361d14134a 100644 --- a/addons/cssresources/package.json +++ b/addons/cssresources/package.json @@ -40,6 +40,9 @@ "global": "^4.3.2", "react": "^16.8.3" }, + "devDependencies": { + "@types/webpack-env": "^1.15.0" + }, "peerDependencies": { "react": "*" }, diff --git a/addons/docs/package.json b/addons/docs/package.json index c150950f7de9..f2056ae085b1 100644 --- a/addons/docs/package.json +++ b/addons/docs/package.json @@ -79,7 +79,6 @@ "@types/jest": "^24.0.11", "@types/prop-types": "^15.5.9", "@types/util-deprecate": "^1.0.0", - "@types/webpack-env": "^1.14.0", "jest-specific-snapshot": "^2.0.0" }, "peerDependencies": { diff --git a/addons/essentials/tsconfig.json b/addons/essentials/tsconfig.json index eac4a67bed71..6fe48b89c0d8 100644 --- a/addons/essentials/tsconfig.json +++ b/addons/essentials/tsconfig.json @@ -2,7 +2,7 @@ "extends": "../../tsconfig.json", "compilerOptions": { "rootDir": "./src", - "types": ["webpack-env", "jest"] + "types": ["jest"] }, "include": ["src/**/*"], "exclude": ["src/**.test.ts"] diff --git a/addons/events/package.json b/addons/events/package.json index f58c4f068eb3..b60f79c38a02 100644 --- a/addons/events/package.json +++ b/addons/events/package.json @@ -45,6 +45,9 @@ "react-textarea-autosize": "^7.0.4", "util-deprecate": "^1.0.2" }, + "devDependencies": { + "@types/webpack-env": "^1.15.0" + }, "peerDependencies": { "react": "*" }, diff --git a/addons/jest/package.json b/addons/jest/package.json index 0791f365d41b..71df82b4b5d6 100644 --- a/addons/jest/package.json +++ b/addons/jest/package.json @@ -47,6 +47,9 @@ "upath": "^1.1.0", "util-deprecate": "^1.0.2" }, + "devDependencies": { + "@types/webpack-env": "^1.15.0" + }, "peerDependencies": { "react": "*" }, diff --git a/addons/knobs/package.json b/addons/knobs/package.json index 9dc1a85475bb..a3510105a0c7 100644 --- a/addons/knobs/package.json +++ b/addons/knobs/package.json @@ -51,7 +51,8 @@ "devDependencies": { "@types/escape-html": "0.0.20", "@types/react-lifecycles-compat": "^3.0.1", - "@types/react-select": "^2.0.19" + "@types/react-select": "^2.0.19", + "@types/webpack-env": "^1.15.0" }, "peerDependencies": { "react": "*" diff --git a/addons/links/package.json b/addons/links/package.json index c4c8fef1a387..b55e9577133f 100644 --- a/addons/links/package.json +++ b/addons/links/package.json @@ -40,6 +40,9 @@ "qs": "^6.6.0", "ts-dedent": "^1.1.0" }, + "devDependencies": { + "@types/webpack-env": "^1.15.0" + }, "peerDependencies": { "react": "*" }, diff --git a/addons/notes/package.json b/addons/notes/package.json index 16db667412a8..d0e4f24334a7 100644 --- a/addons/notes/package.json +++ b/addons/notes/package.json @@ -47,7 +47,7 @@ "devDependencies": { "@types/prop-types": "^15.5.9", "@types/util-deprecate": "^1.0.0", - "@types/webpack-env": "^1.14.0" + "@types/webpack-env": "^1.15.0" }, "peerDependencies": { "react": "*" diff --git a/addons/ondevice-backgrounds/tsconfig.json b/addons/ondevice-backgrounds/tsconfig.json index 8876bb6737a1..30079a2f7435 100644 --- a/addons/ondevice-backgrounds/tsconfig.json +++ b/addons/ondevice-backgrounds/tsconfig.json @@ -1,8 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "rootDir": "./src", - "types": ["webpack-env"] + "rootDir": "./src" }, "include": [ "src/**/*" diff --git a/addons/ondevice-notes/tsconfig.json b/addons/ondevice-notes/tsconfig.json index 24ef9bc68916..30079a2f7435 100644 --- a/addons/ondevice-notes/tsconfig.json +++ b/addons/ondevice-notes/tsconfig.json @@ -1,13 +1,12 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "rootDir": "./src", - "types": ["webpack-env"] - }, - "include": [ - "src/**/*" - ], - "exclude": [ - "src/__tests__/**/*" - ] -} +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "rootDir": "./src" + }, + "include": [ + "src/**/*" + ], + "exclude": [ + "src/__tests__/**/*" + ] +} diff --git a/addons/options/package.json b/addons/options/package.json index c74b311ce5c0..d0037ecaf3ad 100644 --- a/addons/options/package.json +++ b/addons/options/package.json @@ -33,6 +33,9 @@ "core-js": "^3.0.1", "util-deprecate": "^1.0.2" }, + "devDependencies": { + "@types/webpack-env": "^1.15.0" + }, "peerDependencies": { "react": "*" }, diff --git a/addons/queryparams/package.json b/addons/queryparams/package.json index f49f00f4641b..98ced7b1df8d 100644 --- a/addons/queryparams/package.json +++ b/addons/queryparams/package.json @@ -42,6 +42,9 @@ "react": "^16.8.3", "ts-dedent": "^1.1.0" }, + "devDependencies": { + "@types/webpack-env": "^1.15.0" + }, "publishConfig": { "access": "public" }, diff --git a/app/angular/package.json b/app/angular/package.json index 38905d0cb568..4721ca5de0a4 100644 --- a/app/angular/package.json +++ b/app/angular/package.json @@ -36,6 +36,7 @@ "@storybook/addons": "5.3.5", "@storybook/core": "5.3.5", "@storybook/node-logger": "5.3.5", + "@types/webpack-env": "^1.15.0", "core-js": "^3.0.1", "fork-ts-checker-webpack-plugin": "^3.0.1", "global": "^4.3.2", @@ -47,7 +48,6 @@ }, "devDependencies": { "@types/autoprefixer": "^9.4.0", - "@types/webpack-env": "^1.14.0", "webpack": "^4.33.0" }, "peerDependencies": { diff --git a/app/angular/src/client/index.ts b/app/angular/src/client/index.ts index b235d2b3b634..ae0b8377b4d0 100644 --- a/app/angular/src/client/index.ts +++ b/app/angular/src/client/index.ts @@ -11,8 +11,6 @@ export { export { moduleMetadata } from './preview/angular/decorators'; -// tsc wants to use NodeModule instead of WebpackModule -declare const module: any; if (module && module.hot && module.hot.decline) { module.hot.decline(); } diff --git a/app/angular/tsconfig.json b/app/angular/tsconfig.json index 6c12e1098876..8a9ea247510b 100644 --- a/app/angular/tsconfig.json +++ b/app/angular/tsconfig.json @@ -3,7 +3,7 @@ "compileOnSave": false, "compilerOptions": { "outDir": "dist", - "types": [], + "types": ["webpack-env"], "rootDir": "./src", "resolveJsonModule": true } diff --git a/app/html/package.json b/app/html/package.json index a152bd768009..4988e2a0cb75 100644 --- a/app/html/package.json +++ b/app/html/package.json @@ -35,7 +35,7 @@ "dependencies": { "@storybook/addons": "5.3.5", "@storybook/core": "5.3.5", - "@types/webpack-env": "^1.13.9", + "@types/webpack-env": "^1.15.0", "core-js": "^3.0.1", "global": "^4.3.2", "html-loader": "^0.5.5", diff --git a/app/mithril/package.json b/app/mithril/package.json index e7490656a7cd..8759a7578b5f 100644 --- a/app/mithril/package.json +++ b/app/mithril/package.json @@ -38,6 +38,7 @@ "@storybook/addons": "5.3.5", "@storybook/core": "5.3.5", "@types/mithril": "^2.0.0", + "@types/webpack-env": "^1.15.0", "core-js": "^3.0.1", "global": "^4.3.2", "regenerator-runtime": "^0.13.3", diff --git a/app/preact/package.json b/app/preact/package.json index 0608c361f513..b1aa4f8a7a81 100644 --- a/app/preact/package.json +++ b/app/preact/package.json @@ -36,7 +36,7 @@ "@babel/plugin-transform-react-jsx": "^7.3.0", "@storybook/addons": "5.3.5", "@storybook/core": "5.3.5", - "@types/webpack-env": "^1.13.9", + "@types/webpack-env": "^1.15.0", "core-js": "^3.0.1", "global": "^4.3.2", "regenerator-runtime": "^0.13.3", diff --git a/app/svelte/package.json b/app/svelte/package.json index 0991aa8da047..eb081b25c06f 100644 --- a/app/svelte/package.json +++ b/app/svelte/package.json @@ -41,6 +41,7 @@ "ts-dedent": "^1.1.0" }, "devDependencies": { + "@types/webpack-env": "^1.15.0", "svelte": "^3.4.1", "svelte-loader": "^2.13.4" }, diff --git a/app/svelte/tsconfig.json b/app/svelte/tsconfig.json index 9fc120ad0834..29fcd6ad6a26 100644 --- a/app/svelte/tsconfig.json +++ b/app/svelte/tsconfig.json @@ -11,4 +11,4 @@ "exclude": [ "src/**/*.test.*" ] -} \ No newline at end of file +} diff --git a/app/vue/package.json b/app/vue/package.json index c4ecf2c4469e..3c239fbe19e1 100644 --- a/app/vue/package.json +++ b/app/vue/package.json @@ -35,7 +35,7 @@ "dependencies": { "@storybook/addons": "5.3.5", "@storybook/core": "5.3.5", - "@types/webpack-env": "^1.13.9", + "@types/webpack-env": "^1.15.0", "core-js": "^3.0.1", "global": "^4.3.2", "regenerator-runtime": "^0.13.3", diff --git a/app/web-components/package.json b/app/web-components/package.json index 3d9c2d94e1a0..4bf5dedef52c 100644 --- a/app/web-components/package.json +++ b/app/web-components/package.json @@ -39,7 +39,7 @@ "@babel/plugin-syntax-import-meta": "^7.2.0", "@storybook/addons": "5.3.5", "@storybook/core": "5.3.5", - "@types/webpack-env": "^1.13.9", + "@types/webpack-env": "^1.15.0", "babel-plugin-bundled-import-meta": "^0.3.1", "core-js": "^3.0.1", "global": "^4.3.2", diff --git a/examples/angular-cli/package.json b/examples/angular-cli/package.json index c23212da7cdd..fccb59b2d5e8 100644 --- a/examples/angular-cli/package.json +++ b/examples/angular-cli/package.json @@ -55,7 +55,7 @@ "@types/core-js": "^2.5.0", "@types/jest": "^24.0.11", "@types/node": "^12.12.11", - "@types/webpack-env": "^1.14.0", + "@types/webpack-env": "^1.15.0", "babel-plugin-require-context-hook": "^1.0.0", "global": "^4.3.2", "jasmine-core": "~3.5.0", diff --git a/lib/client-api/package.json b/lib/client-api/package.json index 479b0cbbab07..2f359131bfa6 100644 --- a/lib/client-api/package.json +++ b/lib/client-api/package.json @@ -33,6 +33,7 @@ "@storybook/client-logger": "5.3.5", "@storybook/core-events": "5.3.5", "@storybook/csf": "0.0.1", + "@types/webpack-env": "^1.15.0", "core-js": "^3.0.1", "eventemitter3": "^4.0.0", "global": "^4.3.2", diff --git a/lib/components/tsconfig.json b/lib/components/tsconfig.json index 088e0f247933..53749e72ec19 100644 --- a/lib/components/tsconfig.json +++ b/lib/components/tsconfig.json @@ -3,7 +3,6 @@ "compilerOptions": { "rootDir": "./src", "types": [ - "webpack-env", "jest", "react-syntax-highlighter" ] diff --git a/lib/router/tsconfig.json b/lib/router/tsconfig.json index 48a78502378b..d26ac88f32ee 100644 --- a/lib/router/tsconfig.json +++ b/lib/router/tsconfig.json @@ -1,8 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "rootDir": "./src", - "types": ["webpack-env"] + "rootDir": "./src" }, "include": [ "src/**/*" diff --git a/lib/theming/tsconfig.json b/lib/theming/tsconfig.json index 8876bb6737a1..30079a2f7435 100644 --- a/lib/theming/tsconfig.json +++ b/lib/theming/tsconfig.json @@ -1,8 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "rootDir": "./src", - "types": ["webpack-env"] + "rootDir": "./src" }, "include": [ "src/**/*" diff --git a/package.json b/package.json index b0f43486af59..2cf6ed6e128b 100644 --- a/package.json +++ b/package.json @@ -148,7 +148,7 @@ "@types/react": "^16.8.14", "@types/semver": "^6.0.0", "@types/webpack": "^4.41.0", - "@types/webpack-env": "^1.14.0", + "@types/webpack-env": "^1.15.0", "babel-core": "^7.0.0-bridge.0", "babel-eslint": "^10.0.1", "babel-jest": "^24.7.1", diff --git a/yarn.lock b/yarn.lock index 582ad80f2b18..2e14584d2a8b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4569,11 +4569,6 @@ dependencies: "@types/node" "*" -"@types/webpack-env@^1.13.9", "@types/webpack-env@^1.14.0": - version "1.14.1" - resolved "https://registry.yarnpkg.com/@types/webpack-env/-/webpack-env-1.14.1.tgz#0d8a53f308f017c53a5ddc3d07f4d6fa76b790d7" - integrity sha512-0Ki9jAAhKDSuLDXOIMADg54Hu60SuBTEsWaJGGy5cV+SSUQ63J2a+RrYYGrErzz39fXzTibhKrAQJAb8M7PNcA== - "@types/webpack-env@^1.15.0": version "1.15.0" resolved "https://registry.yarnpkg.com/@types/webpack-env/-/webpack-env-1.15.0.tgz#bd9956d5044b1fb43e869a9ba9148862ff98d9fd"