Skip to content

Commit

Permalink
fix: clean usage of @types/webpack-env dep in all packages
Browse files Browse the repository at this point in the history
 - `@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 `/// <reference types="webpack-env" />` 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
  • Loading branch information
gaetanmaisse committed Jan 20, 2020
1 parent 7e4fb09 commit 36ee762
Show file tree
Hide file tree
Showing 33 changed files with 56 additions and 43 deletions.
3 changes: 2 additions & 1 deletion addons/a11y/package.json
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion addons/actions/package.json
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion addons/backgrounds/package.json
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions addons/centered/package.json
Expand Up @@ -36,6 +36,7 @@
},
"devDependencies": {
"@types/mithril": "^1.1.16",
"@types/webpack-env": "^1.15.0",
"mithril": "*",
"preact": "*",
"react": "*"
Expand Down
3 changes: 3 additions & 0 deletions addons/cssresources/package.json
Expand Up @@ -40,6 +40,9 @@
"global": "^4.3.2",
"react": "^16.8.3"
},
"devDependencies": {
"@types/webpack-env": "^1.15.0"
},
"peerDependencies": {
"react": "*"
},
Expand Down
1 change: 0 additions & 1 deletion addons/docs/package.json
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion addons/essentials/tsconfig.json
Expand Up @@ -2,7 +2,7 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"types": ["webpack-env", "jest"]
"types": ["jest"]
},
"include": ["src/**/*"],
"exclude": ["src/**.test.ts"]
Expand Down
3 changes: 3 additions & 0 deletions addons/events/package.json
Expand Up @@ -45,6 +45,9 @@
"react-textarea-autosize": "^7.0.4",
"util-deprecate": "^1.0.2"
},
"devDependencies": {
"@types/webpack-env": "^1.15.0"
},
"peerDependencies": {
"react": "*"
},
Expand Down
3 changes: 3 additions & 0 deletions addons/jest/package.json
Expand Up @@ -47,6 +47,9 @@
"upath": "^1.1.0",
"util-deprecate": "^1.0.2"
},
"devDependencies": {
"@types/webpack-env": "^1.15.0"
},
"peerDependencies": {
"react": "*"
},
Expand Down
3 changes: 2 additions & 1 deletion addons/knobs/package.json
Expand Up @@ -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": "*"
Expand Down
3 changes: 3 additions & 0 deletions addons/links/package.json
Expand Up @@ -40,6 +40,9 @@
"qs": "^6.6.0",
"ts-dedent": "^1.1.0"
},
"devDependencies": {
"@types/webpack-env": "^1.15.0"
},
"peerDependencies": {
"react": "*"
},
Expand Down
2 changes: 1 addition & 1 deletion addons/notes/package.json
Expand Up @@ -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": "*"
Expand Down
3 changes: 1 addition & 2 deletions addons/ondevice-backgrounds/tsconfig.json
@@ -1,8 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"types": ["webpack-env"]
"rootDir": "./src"
},
"include": [
"src/**/*"
Expand Down
25 changes: 12 additions & 13 deletions 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__/**/*"
]
}
3 changes: 3 additions & 0 deletions addons/options/package.json
Expand Up @@ -33,6 +33,9 @@
"core-js": "^3.0.1",
"util-deprecate": "^1.0.2"
},
"devDependencies": {
"@types/webpack-env": "^1.15.0"
},
"peerDependencies": {
"react": "*"
},
Expand Down
3 changes: 3 additions & 0 deletions addons/queryparams/package.json
Expand Up @@ -42,6 +42,9 @@
"react": "^16.8.3",
"ts-dedent": "^1.1.0"
},
"devDependencies": {
"@types/webpack-env": "^1.15.0"
},
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion app/angular/package.json
Expand Up @@ -36,6 +36,7 @@
"@storybook/addons": "5.3.7",
"@storybook/core": "5.3.7",
"@storybook/node-logger": "5.3.7",
"@types/webpack-env": "^1.15.0",
"core-js": "^3.0.1",
"fork-ts-checker-webpack-plugin": "^3.0.1",
"global": "^4.3.2",
Expand All @@ -47,7 +48,6 @@
},
"devDependencies": {
"@types/autoprefixer": "^9.4.0",
"@types/webpack-env": "^1.14.0",
"webpack": "^4.33.0"
},
"peerDependencies": {
Expand Down
2 changes: 0 additions & 2 deletions app/angular/src/client/index.ts
Expand Up @@ -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();
}
2 changes: 1 addition & 1 deletion app/angular/tsconfig.json
Expand Up @@ -3,7 +3,7 @@
"compileOnSave": false,
"compilerOptions": {
"outDir": "dist",
"types": [],
"types": ["webpack-env"],
"rootDir": "./src",
"resolveJsonModule": true
}
Expand Down
2 changes: 1 addition & 1 deletion app/html/package.json
Expand Up @@ -35,7 +35,7 @@
"dependencies": {
"@storybook/addons": "5.3.7",
"@storybook/core": "5.3.7",
"@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",
Expand Down
1 change: 1 addition & 0 deletions app/mithril/package.json
Expand Up @@ -38,6 +38,7 @@
"@storybook/addons": "5.3.7",
"@storybook/core": "5.3.7",
"@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",
Expand Down
2 changes: 1 addition & 1 deletion app/preact/package.json
Expand Up @@ -36,7 +36,7 @@
"@babel/plugin-transform-react-jsx": "^7.3.0",
"@storybook/addons": "5.3.7",
"@storybook/core": "5.3.7",
"@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",
Expand Down
1 change: 1 addition & 0 deletions app/svelte/package.json
Expand Up @@ -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"
},
Expand Down
2 changes: 1 addition & 1 deletion app/svelte/tsconfig.json
Expand Up @@ -11,4 +11,4 @@
"exclude": [
"src/**/*.test.*"
]
}
}
2 changes: 1 addition & 1 deletion app/vue/package.json
Expand Up @@ -35,7 +35,7 @@
"dependencies": {
"@storybook/addons": "5.3.7",
"@storybook/core": "5.3.7",
"@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",
Expand Down
2 changes: 1 addition & 1 deletion app/web-components/package.json
Expand Up @@ -39,7 +39,7 @@
"@babel/plugin-syntax-import-meta": "^7.2.0",
"@storybook/addons": "5.3.7",
"@storybook/core": "5.3.7",
"@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",
Expand Down
2 changes: 1 addition & 1 deletion examples/angular-cli/package.json
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions lib/client-api/package.json
Expand Up @@ -33,6 +33,7 @@
"@storybook/client-logger": "5.3.7",
"@storybook/core-events": "5.3.7",
"@storybook/csf": "0.0.1",
"@types/webpack-env": "^1.15.0",
"core-js": "^3.0.1",
"eventemitter3": "^4.0.0",
"global": "^4.3.2",
Expand Down
1 change: 0 additions & 1 deletion lib/components/tsconfig.json
Expand Up @@ -3,7 +3,6 @@
"compilerOptions": {
"rootDir": "./src",
"types": [
"webpack-env",
"jest",
"react-syntax-highlighter"
]
Expand Down
3 changes: 1 addition & 2 deletions lib/router/tsconfig.json
@@ -1,8 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"types": ["webpack-env"]
"rootDir": "./src"
},
"include": [
"src/**/*"
Expand Down
3 changes: 1 addition & 2 deletions lib/theming/tsconfig.json
@@ -1,8 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"types": ["webpack-env"]
"rootDir": "./src"
},
"include": [
"src/**/*"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -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",
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Expand Up @@ -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"
Expand Down

0 comments on commit 36ee762

Please sign in to comment.