From b1bff003befb1032e078a4a55e2c146723578493 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 18 Jul 2023 21:04:49 +0200 Subject: [PATCH 1/6] add a check script so most packages can be checked without linking --- code/addons/a11y/package.json | 2 +- code/addons/actions/package.json | 2 +- code/addons/backgrounds/package.json | 2 +- code/addons/controls/package.json | 2 +- code/addons/docs/package.json | 2 +- code/addons/essentials/package.json | 2 +- code/addons/gfm/package.json | 2 +- code/addons/highlight/package.json | 2 +- code/addons/interactions/package.json | 2 +- code/addons/jest/package.json | 2 +- code/addons/links/package.json | 2 +- code/addons/measure/package.json | 2 +- code/addons/outline/package.json | 2 +- code/addons/storyshots-core/package.json | 2 +- code/addons/storyshots-puppeteer/package.json | 2 +- code/addons/storysource/package.json | 2 +- code/addons/toolbars/package.json | 2 +- code/addons/viewport/package.json | 2 +- code/builders/builder-manager/package.json | 2 +- code/builders/builder-vite/package.json | 2 +- code/builders/builder-webpack5/package.json | 2 +- code/deprecated/addons/package.json | 2 +- .../channel-postmessage/package.json | 2 +- .../deprecated/channel-websocket/package.json | 2 +- code/deprecated/client-api/package.json | 2 +- code/deprecated/core-client/package.json | 2 +- code/deprecated/manager-api-shim/package.json | 2 +- code/deprecated/preview-web/package.json | 2 +- code/deprecated/store/package.json | 2 +- code/frameworks/ember/package.json | 2 +- code/frameworks/html-vite/package.json | 2 +- code/frameworks/html-webpack5/package.json | 2 +- code/frameworks/nextjs/package.json | 2 +- code/frameworks/preact-vite/package.json | 2 +- code/frameworks/preact-webpack5/package.json | 2 +- code/frameworks/react-vite/package.json | 2 +- code/frameworks/react-webpack5/package.json | 2 +- code/frameworks/server-webpack5/package.json | 2 +- code/frameworks/svelte-vite/package.json | 2 +- code/frameworks/svelte-webpack5/package.json | 2 +- code/frameworks/sveltekit/package.json | 2 +- code/frameworks/vue-vite/package.json | 2 +- code/frameworks/vue-webpack5/package.json | 2 +- code/frameworks/vue3-vite/package.json | 2 +- code/frameworks/vue3-webpack5/package.json | 2 +- .../web-components-vite/package.json | 2 +- .../web-components-webpack5/package.json | 2 +- code/lib/channels/package.json | 2 +- code/lib/cli/package.json | 2 +- code/lib/client-logger/package.json | 2 +- code/lib/codemod/package.json | 2 +- code/lib/core-common/package.json | 2 +- code/lib/core-events/package.json | 2 +- code/lib/core-server/package.json | 2 +- code/lib/core-webpack/package.json | 2 +- code/lib/csf-plugin/package.json | 2 +- code/lib/csf-tools/package.json | 2 +- code/lib/docs-tools/package.json | 2 +- code/lib/instrumenter/package.json | 2 +- code/lib/manager-api/package.json | 2 +- code/lib/node-logger/package.json | 2 +- code/lib/postinstall/package.json | 2 +- code/lib/preview-api/package.json | 2 +- code/lib/preview/package.json | 2 +- code/lib/react-dom-shim/package.json | 2 +- code/lib/router/package.json | 2 +- code/lib/source-loader/package.json | 2 +- code/lib/telemetry/package.json | 2 +- code/lib/theming/package.json | 2 +- code/lib/types/package.json | 2 +- code/presets/create-react-app/package.json | 2 +- code/presets/html-webpack/package.json | 2 +- code/presets/preact-webpack/package.json | 2 +- code/presets/react-webpack/package.json | 2 +- code/presets/server-webpack/package.json | 2 +- code/presets/svelte-webpack/package.json | 2 +- code/presets/vue-webpack/package.json | 2 +- code/presets/vue3-webpack/package.json | 2 +- .../web-components-webpack/package.json | 2 +- code/renderers/html/package.json | 2 +- code/renderers/preact/package.json | 2 +- code/renderers/react/package.json | 2 +- code/renderers/server/package.json | 2 +- code/renderers/web-components/package.json | 2 +- code/ui/blocks/package.json | 2 +- code/ui/components/package.json | 2 +- code/ui/manager/package.json | 2 +- scripts/prepare/check.ts | 80 +++++++++++++++++++ 88 files changed, 167 insertions(+), 87 deletions(-) create mode 100644 scripts/prepare/check.ts diff --git a/code/addons/a11y/package.json b/code/addons/a11y/package.json index ce2a52a5386e..612a0d5ff0a5 100644 --- a/code/addons/a11y/package.json +++ b/code/addons/a11y/package.json @@ -59,7 +59,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/addons/actions/package.json b/code/addons/actions/package.json index 0905b055a970..04b698d8f97d 100644 --- a/code/addons/actions/package.json +++ b/code/addons/actions/package.json @@ -76,7 +76,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/addons/backgrounds/package.json b/code/addons/backgrounds/package.json index e18a3fc41938..26128a713df0 100644 --- a/code/addons/backgrounds/package.json +++ b/code/addons/backgrounds/package.json @@ -72,7 +72,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/addons/controls/package.json b/code/addons/controls/package.json index 96597e6d218c..e76a33702e1c 100644 --- a/code/addons/controls/package.json +++ b/code/addons/controls/package.json @@ -64,7 +64,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/addons/docs/package.json b/code/addons/docs/package.json index f0ba3a7907d3..d27003bf434d 100644 --- a/code/addons/docs/package.json +++ b/code/addons/docs/package.json @@ -93,7 +93,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/addons/essentials/package.json b/code/addons/essentials/package.json index e1af4dc5c087..bfdc135d190b 100644 --- a/code/addons/essentials/package.json +++ b/code/addons/essentials/package.json @@ -115,7 +115,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/addons/gfm/package.json b/code/addons/gfm/package.json index 99a8c7d8a72f..bc607631eec0 100644 --- a/code/addons/gfm/package.json +++ b/code/addons/gfm/package.json @@ -47,7 +47,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/addons/highlight/package.json b/code/addons/highlight/package.json index a7ae4c532db5..38b1300a7d80 100644 --- a/code/addons/highlight/package.json +++ b/code/addons/highlight/package.json @@ -57,7 +57,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/addons/interactions/package.json b/code/addons/interactions/package.json index f65ccc5848cb..b3d131ffbb74 100644 --- a/code/addons/interactions/package.json +++ b/code/addons/interactions/package.json @@ -68,7 +68,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/addons/jest/package.json b/code/addons/jest/package.json index 5fb2d77148fd..506d4881525a 100644 --- a/code/addons/jest/package.json +++ b/code/addons/jest/package.json @@ -66,7 +66,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/addons/links/package.json b/code/addons/links/package.json index 509ed2e5e1dc..94f818a247df 100644 --- a/code/addons/links/package.json +++ b/code/addons/links/package.json @@ -76,7 +76,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/addons/measure/package.json b/code/addons/measure/package.json index b0229f64dc19..d640f1b8eabe 100644 --- a/code/addons/measure/package.json +++ b/code/addons/measure/package.json @@ -71,7 +71,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/addons/outline/package.json b/code/addons/outline/package.json index 00a5e705dd12..0d8ea3410553 100644 --- a/code/addons/outline/package.json +++ b/code/addons/outline/package.json @@ -74,7 +74,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/addons/storyshots-core/package.json b/code/addons/storyshots-core/package.json index 8e5035133ed9..d36cf2a0db03 100644 --- a/code/addons/storyshots-core/package.json +++ b/code/addons/storyshots-core/package.json @@ -32,7 +32,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/tsc.ts" }, "dependencies": { diff --git a/code/addons/storyshots-puppeteer/package.json b/code/addons/storyshots-puppeteer/package.json index 301f5bbe0ca5..f28ad08e21a5 100644 --- a/code/addons/storyshots-puppeteer/package.json +++ b/code/addons/storyshots-puppeteer/package.json @@ -31,7 +31,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/tsc.ts" }, "dependencies": { diff --git a/code/addons/storysource/package.json b/code/addons/storysource/package.json index 32b11982fe7e..392d06446a5b 100644 --- a/code/addons/storysource/package.json +++ b/code/addons/storysource/package.json @@ -49,7 +49,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/addons/toolbars/package.json b/code/addons/toolbars/package.json index f0137a75015d..f431300582db 100644 --- a/code/addons/toolbars/package.json +++ b/code/addons/toolbars/package.json @@ -64,7 +64,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/addons/viewport/package.json b/code/addons/viewport/package.json index 40e5db908038..e1a658fe67c5 100644 --- a/code/addons/viewport/package.json +++ b/code/addons/viewport/package.json @@ -69,7 +69,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/builders/builder-manager/package.json b/code/builders/builder-manager/package.json index 21358a566e93..71a5d5d82456 100644 --- a/code/builders/builder-manager/package.json +++ b/code/builders/builder-manager/package.json @@ -39,7 +39,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/builders/builder-vite/package.json b/code/builders/builder-vite/package.json index 6a86e40a3b67..d5aa2768e19d 100644 --- a/code/builders/builder-vite/package.json +++ b/code/builders/builder-vite/package.json @@ -38,7 +38,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/builders/builder-webpack5/package.json b/code/builders/builder-webpack5/package.json index 98f8b8f259a1..4b835f82677b 100644 --- a/code/builders/builder-webpack5/package.json +++ b/code/builders/builder-webpack5/package.json @@ -51,7 +51,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/deprecated/addons/package.json b/code/deprecated/addons/package.json index 946acd25510a..01bf737806e0 100644 --- a/code/deprecated/addons/package.json +++ b/code/deprecated/addons/package.json @@ -40,7 +40,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/deprecated/channel-postmessage/package.json b/code/deprecated/channel-postmessage/package.json index 4c9f61f6ebb6..0b389b0fd790 100644 --- a/code/deprecated/channel-postmessage/package.json +++ b/code/deprecated/channel-postmessage/package.json @@ -39,7 +39,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/deprecated/channel-websocket/package.json b/code/deprecated/channel-websocket/package.json index 3243376d4200..2eec52fe94ac 100644 --- a/code/deprecated/channel-websocket/package.json +++ b/code/deprecated/channel-websocket/package.json @@ -39,7 +39,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/facade.ts" }, "dependencies": { diff --git a/code/deprecated/client-api/package.json b/code/deprecated/client-api/package.json index 88714bf7ab17..946d814f2d5a 100644 --- a/code/deprecated/client-api/package.json +++ b/code/deprecated/client-api/package.json @@ -38,7 +38,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/facade.ts" }, "dependencies": { diff --git a/code/deprecated/core-client/package.json b/code/deprecated/core-client/package.json index 76a89270248c..64a7614f8099 100644 --- a/code/deprecated/core-client/package.json +++ b/code/deprecated/core-client/package.json @@ -31,7 +31,7 @@ "module": "dist/entry.mjs", "types": "dist/entry.d.ts", "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/facade.ts" }, "dependencies": { diff --git a/code/deprecated/manager-api-shim/package.json b/code/deprecated/manager-api-shim/package.json index fd1bca475b27..45e71ba4e257 100644 --- a/code/deprecated/manager-api-shim/package.json +++ b/code/deprecated/manager-api-shim/package.json @@ -38,7 +38,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/facade.ts" }, "dependencies": { diff --git a/code/deprecated/preview-web/package.json b/code/deprecated/preview-web/package.json index a3a8616f6fe8..056f7782a0fa 100644 --- a/code/deprecated/preview-web/package.json +++ b/code/deprecated/preview-web/package.json @@ -38,7 +38,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/facade.ts" }, "dependencies": { diff --git a/code/deprecated/store/package.json b/code/deprecated/store/package.json index 41ccc547f707..7ceca5494b6b 100644 --- a/code/deprecated/store/package.json +++ b/code/deprecated/store/package.json @@ -38,7 +38,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/facade.ts" }, "dependencies": { diff --git a/code/frameworks/ember/package.json b/code/frameworks/ember/package.json index ad79fe4eca10..6d46043864bf 100644 --- a/code/frameworks/ember/package.json +++ b/code/frameworks/ember/package.json @@ -27,7 +27,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/tsc.ts" }, "dependencies": { diff --git a/code/frameworks/html-vite/package.json b/code/frameworks/html-vite/package.json index b9f2bf5e919d..4ffc4d335fc7 100644 --- a/code/frameworks/html-vite/package.json +++ b/code/frameworks/html-vite/package.json @@ -43,7 +43,7 @@ "*.d.ts" ], "scripts": { - "check": "tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/frameworks/html-webpack5/package.json b/code/frameworks/html-webpack5/package.json index 63f650327adc..d971e2c4e966 100644 --- a/code/frameworks/html-webpack5/package.json +++ b/code/frameworks/html-webpack5/package.json @@ -43,7 +43,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/frameworks/nextjs/package.json b/code/frameworks/nextjs/package.json index 14258d631acf..8823db34ade8 100644 --- a/code/frameworks/nextjs/package.json +++ b/code/frameworks/nextjs/package.json @@ -54,7 +54,7 @@ "*.d.ts" ], "scripts": { - "check": "tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/frameworks/preact-vite/package.json b/code/frameworks/preact-vite/package.json index c74d7c3a40f6..84a4b395ab8d 100644 --- a/code/frameworks/preact-vite/package.json +++ b/code/frameworks/preact-vite/package.json @@ -42,7 +42,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/frameworks/preact-webpack5/package.json b/code/frameworks/preact-webpack5/package.json index 5c9ffa2b0eb4..e994102da998 100644 --- a/code/frameworks/preact-webpack5/package.json +++ b/code/frameworks/preact-webpack5/package.json @@ -43,7 +43,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/frameworks/react-vite/package.json b/code/frameworks/react-vite/package.json index f7c785e49f36..2eecf2e3881c 100644 --- a/code/frameworks/react-vite/package.json +++ b/code/frameworks/react-vite/package.json @@ -43,7 +43,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/frameworks/react-webpack5/package.json b/code/frameworks/react-webpack5/package.json index 7665ce96e115..0547c32c072b 100644 --- a/code/frameworks/react-webpack5/package.json +++ b/code/frameworks/react-webpack5/package.json @@ -43,7 +43,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/frameworks/server-webpack5/package.json b/code/frameworks/server-webpack5/package.json index 1652a558d251..e2bb618fcf4c 100644 --- a/code/frameworks/server-webpack5/package.json +++ b/code/frameworks/server-webpack5/package.json @@ -43,7 +43,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/frameworks/svelte-vite/package.json b/code/frameworks/svelte-vite/package.json index cff7c69c2dfc..9c6e9871c7d2 100644 --- a/code/frameworks/svelte-vite/package.json +++ b/code/frameworks/svelte-vite/package.json @@ -43,7 +43,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/frameworks/svelte-webpack5/package.json b/code/frameworks/svelte-webpack5/package.json index 463e8787a032..4b46ec53c038 100644 --- a/code/frameworks/svelte-webpack5/package.json +++ b/code/frameworks/svelte-webpack5/package.json @@ -43,7 +43,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/frameworks/sveltekit/package.json b/code/frameworks/sveltekit/package.json index 38be149ede20..981736171b17 100644 --- a/code/frameworks/sveltekit/package.json +++ b/code/frameworks/sveltekit/package.json @@ -46,7 +46,7 @@ "*.d.ts" ], "scripts": { - "check": "tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/frameworks/vue-vite/package.json b/code/frameworks/vue-vite/package.json index 5eb10c6a8e62..5c8159b0d32f 100644 --- a/code/frameworks/vue-vite/package.json +++ b/code/frameworks/vue-vite/package.json @@ -43,7 +43,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/frameworks/vue-webpack5/package.json b/code/frameworks/vue-webpack5/package.json index 1b5630f76f4d..c34a564037dc 100644 --- a/code/frameworks/vue-webpack5/package.json +++ b/code/frameworks/vue-webpack5/package.json @@ -43,7 +43,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/frameworks/vue3-vite/package.json b/code/frameworks/vue3-vite/package.json index 0e81388427e4..269facaf2121 100644 --- a/code/frameworks/vue3-vite/package.json +++ b/code/frameworks/vue3-vite/package.json @@ -43,7 +43,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/frameworks/vue3-webpack5/package.json b/code/frameworks/vue3-webpack5/package.json index bc533de95119..cbf532add8ff 100644 --- a/code/frameworks/vue3-webpack5/package.json +++ b/code/frameworks/vue3-webpack5/package.json @@ -43,7 +43,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/frameworks/web-components-vite/package.json b/code/frameworks/web-components-vite/package.json index 9d76b4321ebf..2f1b85942297 100644 --- a/code/frameworks/web-components-vite/package.json +++ b/code/frameworks/web-components-vite/package.json @@ -43,7 +43,7 @@ "*.d.ts" ], "scripts": { - "check": "tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/frameworks/web-components-webpack5/package.json b/code/frameworks/web-components-webpack5/package.json index 7707c387dc35..0cb3e19f7358 100644 --- a/code/frameworks/web-components-webpack5/package.json +++ b/code/frameworks/web-components-webpack5/package.json @@ -46,7 +46,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/lib/channels/package.json b/code/lib/channels/package.json index 28c88bcbec9d..3dd3368cbd38 100644 --- a/code/lib/channels/package.json +++ b/code/lib/channels/package.json @@ -64,7 +64,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/lib/cli/package.json b/code/lib/cli/package.json index 1fcfc30fcddc..9bd3956de4a1 100644 --- a/code/lib/cli/package.json +++ b/code/lib/cli/package.json @@ -49,7 +49,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts", "test": "jest test/**/*.test.js" }, diff --git a/code/lib/client-logger/package.json b/code/lib/client-logger/package.json index 63df41c98db3..5108f319b340 100644 --- a/code/lib/client-logger/package.json +++ b/code/lib/client-logger/package.json @@ -39,7 +39,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/lib/codemod/package.json b/code/lib/codemod/package.json index 418b1f2324dc..d59374a22def 100644 --- a/code/lib/codemod/package.json +++ b/code/lib/codemod/package.json @@ -41,7 +41,7 @@ "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/lib/core-common/package.json b/code/lib/core-common/package.json index 2b61c1aa8fc6..425cd29259d2 100644 --- a/code/lib/core-common/package.json +++ b/code/lib/core-common/package.json @@ -39,7 +39,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/lib/core-events/package.json b/code/lib/core-events/package.json index b1fae162a37c..b593eabd8d5d 100644 --- a/code/lib/core-events/package.json +++ b/code/lib/core-events/package.json @@ -39,7 +39,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "devDependencies": { diff --git a/code/lib/core-server/package.json b/code/lib/core-server/package.json index 7307973107ed..503a76e6f54e 100644 --- a/code/lib/core-server/package.json +++ b/code/lib/core-server/package.json @@ -50,7 +50,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/lib/core-webpack/package.json b/code/lib/core-webpack/package.json index c0098e347e37..e8b274475be0 100644 --- a/code/lib/core-webpack/package.json +++ b/code/lib/core-webpack/package.json @@ -39,7 +39,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/lib/csf-plugin/package.json b/code/lib/csf-plugin/package.json index 6e109375f135..82bc6331bc7e 100644 --- a/code/lib/csf-plugin/package.json +++ b/code/lib/csf-plugin/package.json @@ -39,7 +39,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/lib/csf-tools/package.json b/code/lib/csf-tools/package.json index 3acca4181f61..ccba3dda6bf9 100644 --- a/code/lib/csf-tools/package.json +++ b/code/lib/csf-tools/package.json @@ -37,7 +37,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/lib/docs-tools/package.json b/code/lib/docs-tools/package.json index 5277be1f62ee..621204561739 100644 --- a/code/lib/docs-tools/package.json +++ b/code/lib/docs-tools/package.json @@ -39,7 +39,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/lib/instrumenter/package.json b/code/lib/instrumenter/package.json index eed3009c3a83..f31671949df3 100644 --- a/code/lib/instrumenter/package.json +++ b/code/lib/instrumenter/package.json @@ -39,7 +39,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/lib/manager-api/package.json b/code/lib/manager-api/package.json index 3606f01ed813..39e84326daf2 100644 --- a/code/lib/manager-api/package.json +++ b/code/lib/manager-api/package.json @@ -38,7 +38,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/lib/node-logger/package.json b/code/lib/node-logger/package.json index 1d4e82d24342..1ccb73147a68 100644 --- a/code/lib/node-logger/package.json +++ b/code/lib/node-logger/package.json @@ -37,7 +37,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "devDependencies": { diff --git a/code/lib/postinstall/package.json b/code/lib/postinstall/package.json index f3b0220588d0..2703727f3f6a 100644 --- a/code/lib/postinstall/package.json +++ b/code/lib/postinstall/package.json @@ -40,7 +40,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "devDependencies": { diff --git a/code/lib/preview-api/package.json b/code/lib/preview-api/package.json index 0d372feed6e0..9838ce29c4a7 100644 --- a/code/lib/preview-api/package.json +++ b/code/lib/preview-api/package.json @@ -63,7 +63,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/lib/preview/package.json b/code/lib/preview/package.json index f63295505081..7edc4bbc4e83 100644 --- a/code/lib/preview/package.json +++ b/code/lib/preview/package.json @@ -51,7 +51,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/esm-bundle.ts" }, "devDependencies": { diff --git a/code/lib/react-dom-shim/package.json b/code/lib/react-dom-shim/package.json index 6fd5299a2eb3..67f865a0e0b4 100644 --- a/code/lib/react-dom-shim/package.json +++ b/code/lib/react-dom-shim/package.json @@ -49,7 +49,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "devDependencies": { diff --git a/code/lib/router/package.json b/code/lib/router/package.json index 89f39d007e6c..c9e3388b5568 100644 --- a/code/lib/router/package.json +++ b/code/lib/router/package.json @@ -44,7 +44,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/lib/source-loader/package.json b/code/lib/source-loader/package.json index 5be349908930..4243d210165f 100644 --- a/code/lib/source-loader/package.json +++ b/code/lib/source-loader/package.json @@ -40,7 +40,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/lib/telemetry/package.json b/code/lib/telemetry/package.json index 30de3fbd430e..28bf90684709 100644 --- a/code/lib/telemetry/package.json +++ b/code/lib/telemetry/package.json @@ -39,7 +39,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/lib/theming/package.json b/code/lib/theming/package.json index 504fa4fae38e..cb6af6c14bb9 100644 --- a/code/lib/theming/package.json +++ b/code/lib/theming/package.json @@ -44,7 +44,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/lib/types/package.json b/code/lib/types/package.json index 40c14195bb73..1676d89c5a73 100644 --- a/code/lib/types/package.json +++ b/code/lib/types/package.json @@ -39,7 +39,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/presets/create-react-app/package.json b/code/presets/create-react-app/package.json index aae62c08aecb..c8b67e478017 100644 --- a/code/presets/create-react-app/package.json +++ b/code/presets/create-react-app/package.json @@ -44,7 +44,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/presets/html-webpack/package.json b/code/presets/html-webpack/package.json index 14472b729a52..e1035a00238a 100644 --- a/code/presets/html-webpack/package.json +++ b/code/presets/html-webpack/package.json @@ -44,7 +44,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/presets/preact-webpack/package.json b/code/presets/preact-webpack/package.json index 041e2c7c7be0..a91416277780 100644 --- a/code/presets/preact-webpack/package.json +++ b/code/presets/preact-webpack/package.json @@ -44,7 +44,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/presets/react-webpack/package.json b/code/presets/react-webpack/package.json index a01398790eff..2df91891daa1 100644 --- a/code/presets/react-webpack/package.json +++ b/code/presets/react-webpack/package.json @@ -59,7 +59,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/presets/server-webpack/package.json b/code/presets/server-webpack/package.json index 5bb0e268cb3b..5756f411daf2 100644 --- a/code/presets/server-webpack/package.json +++ b/code/presets/server-webpack/package.json @@ -49,7 +49,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/presets/svelte-webpack/package.json b/code/presets/svelte-webpack/package.json index 47431d89989e..45efb2ee01a2 100644 --- a/code/presets/svelte-webpack/package.json +++ b/code/presets/svelte-webpack/package.json @@ -59,7 +59,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/presets/vue-webpack/package.json b/code/presets/vue-webpack/package.json index ea15ea1f1a49..7820cc57fe1f 100644 --- a/code/presets/vue-webpack/package.json +++ b/code/presets/vue-webpack/package.json @@ -54,7 +54,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/presets/vue3-webpack/package.json b/code/presets/vue3-webpack/package.json index 5fec90da4ed2..0186a5b0def7 100644 --- a/code/presets/vue3-webpack/package.json +++ b/code/presets/vue3-webpack/package.json @@ -54,7 +54,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/presets/web-components-webpack/package.json b/code/presets/web-components-webpack/package.json index c145988ce6ce..3ca95d692bd7 100644 --- a/code/presets/web-components-webpack/package.json +++ b/code/presets/web-components-webpack/package.json @@ -47,7 +47,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/renderers/html/package.json b/code/renderers/html/package.json index d90c69dcbca7..a036ef947ce4 100644 --- a/code/renderers/html/package.json +++ b/code/renderers/html/package.json @@ -44,7 +44,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/renderers/preact/package.json b/code/renderers/preact/package.json index b41abe56f30b..3c050167faca 100644 --- a/code/renderers/preact/package.json +++ b/code/renderers/preact/package.json @@ -44,7 +44,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/renderers/react/package.json b/code/renderers/react/package.json index 31c8ae575ce2..6faeea8a0b82 100644 --- a/code/renderers/react/package.json +++ b/code/renderers/react/package.json @@ -48,7 +48,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/renderers/server/package.json b/code/renderers/server/package.json index f4b0bd928143..6a4c231a3543 100644 --- a/code/renderers/server/package.json +++ b/code/renderers/server/package.json @@ -49,7 +49,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/renderers/web-components/package.json b/code/renderers/web-components/package.json index 2f2521fdb468..1f6e5bf245fa 100644 --- a/code/renderers/web-components/package.json +++ b/code/renderers/web-components/package.json @@ -47,7 +47,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/ui/blocks/package.json b/code/ui/blocks/package.json index c2d7bd274ea5..5f1326b58e35 100644 --- a/code/ui/blocks/package.json +++ b/code/ui/blocks/package.json @@ -39,7 +39,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/ui/components/package.json b/code/ui/components/package.json index a23aa0dd0e83..f02bd1d1b5cb 100644 --- a/code/ui/components/package.json +++ b/code/ui/components/package.json @@ -63,7 +63,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { diff --git a/code/ui/manager/package.json b/code/ui/manager/package.json index 4b8d95629973..45ac1d41e38c 100644 --- a/code/ui/manager/package.json +++ b/code/ui/manager/package.json @@ -46,7 +46,7 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "check": "../../../scripts/prepare/check.ts", "prep": "../../../scripts/prepare/esm-bundle.ts" }, "devDependencies": { diff --git a/scripts/prepare/check.ts b/scripts/prepare/check.ts new file mode 100644 index 000000000000..d200e921ea0b --- /dev/null +++ b/scripts/prepare/check.ts @@ -0,0 +1,80 @@ +#!/usr/bin/env ../../node_modules/.bin/ts-node-script + +import { join } from 'path'; +import fs from 'fs-extra'; +import * as ts from 'typescript'; + +const run = async ({ cwd }: { cwd: string }) => { + const { + bundler: { tsConfig: tsconfigPath = 'tsconfig.json' }, + } = await fs.readJson(join(cwd, 'package.json')); + + const { options, fileNames } = getTSFilesAndConfig(tsconfigPath); + const { program, host } = getTSProgramAndHost(fileNames, options); + + const tsDiagnostics = getTSDiagnostics(program, cwd, host); + if (tsDiagnostics.length > 0) { + console.log(tsDiagnostics); + process.exit(1); + } else { + console.log('no type errors'); + } + + // TODO, add more package checks here, like: + // - check for missing dependencies/peerDependencies + // - check for unused exports + + console.log('done'); +}; + +run({ cwd: process.cwd() }).catch((err: unknown) => { + // We can't let the stack try to print, it crashes in a way that sets the exit code to 0. + // Seems to have something to do with running JSON.parse() on binary / base64 encoded sourcemaps + // in @cspotcode/source-map-support + if (err instanceof Error) { + console.error(err.message); + } + process.exit(1); +}); + +function getTSDiagnostics(program: ts.Program, cwd: string, host: ts.CompilerHost): any { + return ts.formatDiagnosticsWithColorAndContext( + ts.getPreEmitDiagnostics(program).filter((d) => d.file.fileName.startsWith(cwd)), + host + ); +} + +function getTSProgramAndHost(fileNames: string[], options: ts.CompilerOptions) { + const program = ts.createProgram({ + rootNames: fileNames, + options: { + module: ts.ModuleKind.CommonJS, + ...options, + declaration: false, + noEmit: true, + }, + }); + + const host = ts.createCompilerHost(program.getCompilerOptions()); + return { program, host }; +} + +function getTSFilesAndConfig(tsconfigPath: string) { + const content = ts.readJsonConfigFile(tsconfigPath, ts.sys.readFile); + return ts.parseJsonSourceFileConfigFileContent( + content, + { + useCaseSensitiveFileNames: true, + readDirectory: ts.sys.readDirectory, + fileExists: ts.sys.fileExists, + readFile: ts.sys.readFile, + }, + process.cwd(), + { + noEmit: true, + outDir: join(process.cwd(), 'types'), + target: ts.ScriptTarget.ES2022, + declaration: false, + } + ); +} From 1af46cfad5f79e305131de986949a23136e53165 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 18 Jul 2023 21:05:47 +0200 Subject: [PATCH 2/6] set skipLibCheck to true for perf, and checking .d.ts files doesn't really do any good anyway --- code/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/tsconfig.json b/code/tsconfig.json index e28f13442121..26de1b5ba684 100644 --- a/code/tsconfig.json +++ b/code/tsconfig.json @@ -10,7 +10,7 @@ "moduleResolution": "Node", "target": "ES2020", "module": "CommonJS", - "skipLibCheck": false, + "skipLibCheck": true, "allowSyntheticDefaultImports": true, "esModuleInterop": true, "isolatedModules": true, From 7910e2dbf70f39e9ca2a7b39dd989497b95fe0d8 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 18 Jul 2023 21:20:33 +0200 Subject: [PATCH 3/6] update check task to allow for running with linking --- scripts/tasks/check.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/tasks/check.ts b/scripts/tasks/check.ts index 2c7fa33a7c79..8514d453dde4 100644 --- a/scripts/tasks/check.ts +++ b/scripts/tasks/check.ts @@ -4,7 +4,8 @@ import { maxConcurrentTasks } from '../utils/maxConcurrentTasks'; const parallel = process.env.CI ? 8 : maxConcurrentTasks; -const command = `nx run-many --target="check" --all --parallel=${parallel} --exclude=@storybook/addon-storyshots,@storybook/addon-storyshots-puppeteer`; +const linkCommand = `nx run-many --target="check" --all --parallel=${parallel} --exclude=@storybook/addon-storyshots,@storybook/addon-storyshots-puppeteer,@storybook/vue,@storybook/svelte,@storybook/vue3,@storybook/angular`; +const nolinkCommand = `nx run-many --target="check" --all --parallel=${parallel} --exclude=@storybook/addon-storyshots,@storybook/addon-storyshots-puppeteer`; export const check: Task = { description: 'Typecheck the source code of the monorepo', @@ -13,9 +14,8 @@ export const check: Task = { return false; }, async run({ codeDir }, { dryRun, debug, link }) { - if (link) throw new Error('Cannot check when linked, please run with `--no-link`'); return exec( - command, + link ? linkCommand : nolinkCommand, { cwd: codeDir }, { startMessage: '🥾 Checking types validity', From 67fe0942067a8d7242e04a4dc33eec816a6ecdf6 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 18 Jul 2023 21:22:39 +0200 Subject: [PATCH 4/6] chmod check script --- scripts/prepare/check.ts | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/prepare/check.ts diff --git a/scripts/prepare/check.ts b/scripts/prepare/check.ts old mode 100644 new mode 100755 From 77193b0a80856ef53bc2e5595ca0084372eb768b Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 18 Jul 2023 21:23:37 +0200 Subject: [PATCH 5/6] change codemod entrypoint to ts --- code/lib/codemod/package.json | 2 +- code/lib/codemod/src/{index.js => index.ts} | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename code/lib/codemod/src/{index.js => index.ts} (94%) diff --git a/code/lib/codemod/package.json b/code/lib/codemod/package.json index d59374a22def..cf9296466690 100644 --- a/code/lib/codemod/package.json +++ b/code/lib/codemod/package.json @@ -82,7 +82,7 @@ }, "bundler": { "entries": [ - "./src/index.js", + "./src/index.ts", "./src/transforms/add-component-parameters.js", "./src/transforms/csf-2-to-3.ts", "./src/transforms/csf-hoist-story-annotations.js", diff --git a/code/lib/codemod/src/index.js b/code/lib/codemod/src/index.ts similarity index 94% rename from code/lib/codemod/src/index.js rename to code/lib/codemod/src/index.ts index 4809d9f3d200..00473ad0f79a 100644 --- a/code/lib/codemod/src/index.js +++ b/code/lib/codemod/src/index.ts @@ -25,13 +25,13 @@ export function listCodemods() { const renameAsync = promisify(fs.rename); -async function renameFile(file, from, to, { logger }) { +async function renameFile(file: any, from: any, to: any, { logger }: any) { const newFile = file.replace(from, to); logger.log(`Rename: ${file} ${newFile}`); return renameAsync(file, newFile); } -export async function runCodemod(codemod, { glob, logger, dryRun, rename, parser }) { +export async function runCodemod(codemod: any, { glob, logger, dryRun, rename, parser }: any) { const codemods = listCodemods(); if (!codemods.includes(codemod)) { throw new Error(`Unknown codemod ${codemod}. Run --list for options.`); From d8b514c293142187caeeacfc53991e4cfe57042a Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 18 Jul 2023 21:24:00 +0200 Subject: [PATCH 6/6] fix a global type issue --- code/lib/instrumenter/src/instrumenter.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/lib/instrumenter/src/instrumenter.test.ts b/code/lib/instrumenter/src/instrumenter.test.ts index da65f5498dd7..eadb1f7d5c84 100644 --- a/code/lib/instrumenter/src/instrumenter.test.ts +++ b/code/lib/instrumenter/src/instrumenter.test.ts @@ -37,7 +37,9 @@ global.location = { reload: jest.fn() }; global.HTMLElement = HTMLElement; const storyId = 'kind--story'; -global.window.__STORYBOOK_PREVIEW__ = { selectionStore: { selection: { storyId } } }; +global.window.__STORYBOOK_PREVIEW__ = { + selectionStore: { selection: { storyId, viewMode: 'story' } }, +} as any; const setRenderPhase = (newPhase: string) => addons.getChannel().emit(STORY_RENDER_PHASE_CHANGED, { newPhase, storyId });