From c5ecac91f90dcfd134553f2ee8e104ee3961fd9a Mon Sep 17 00:00:00 2001 From: Saunved Date: Mon, 25 Jul 2022 20:57:30 +0530 Subject: [PATCH 1/4] Build addons/controls with tsup + Ref: https://github.com/storybookjs/storybook/issues/18732 --- addons/controls/manager.js | 2 +- addons/controls/package.json | 34 ++++++++++++++++++++++++++++++---- yarn.lock | 1 + 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/addons/controls/manager.js b/addons/controls/manager.js index 4e287d25b15..8a2eae4ffce 100644 --- a/addons/controls/manager.js +++ b/addons/controls/manager.js @@ -1 +1 @@ -import './dist/esm/manager'; +import './dist/manager'; diff --git a/addons/controls/package.json b/addons/controls/package.json index 9ccc3a1bded..f9ddab08c97 100644 --- a/addons/controls/package.json +++ b/addons/controls/package.json @@ -25,9 +25,27 @@ "url": "https://opencollective.com/storybook" }, "license": "MIT", - "main": "dist/cjs/manager.js", - "module": "dist/esm/manager.js", - "types": "dist/types/index.d.ts", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs", + "types": "./dist/index.d.ts" + }, + "./manager": { + "require": "./dist/manager.js", + "import": "./dist/manager.mjs", + "types": "./dist/manager.d.ts" + }, + "./register.js": { + "require": "./dist/manager.js", + "import": "./dist/manager.mjs", + "types": "./dist/manager.d.ts" + }, + "./package.json": "./package.json" + }, + "main": "dist/index.js", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", "files": [ "dist/**/*", "README.md", @@ -36,9 +54,10 @@ ], "scripts": { "check": "tsc --noEmit", - "prepare": "node ../../scripts/prepare.js" + "prepare": "esrun ../../scripts/prepare/bundle.ts" }, "dependencies": { + "@digitak/esrun": "^3.2.2", "@storybook/addons": "7.0.0-alpha.16", "@storybook/api": "7.0.0-alpha.16", "@storybook/blocks": "7.0.0-alpha.16", @@ -68,6 +87,13 @@ "publishConfig": { "access": "public" }, + "bundler": { + "entries": [ + "./src/index.ts", + "./src/manager.tsx" + ], + "platform": "browser" + }, "gitHead": "df30e7db2b251418af106345e5722477f057ec36", "storybook": { "displayName": "Controls", diff --git a/yarn.lock b/yarn.lock index c16edad78ba..c782cd7e7fa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6938,6 +6938,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/addon-controls@workspace:addons/controls" dependencies: + "@digitak/esrun": ^3.2.2 "@storybook/addons": 7.0.0-alpha.16 "@storybook/api": 7.0.0-alpha.16 "@storybook/blocks": 7.0.0-alpha.16 From 80cee9f8bcc46a315360ffdc8466a46d5310d28c Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 26 Jul 2022 09:42:09 +0200 Subject: [PATCH 2/4] fix --- code/addons/controls/manager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/addons/controls/manager.js b/code/addons/controls/manager.js index 4e287d25b15..8a2eae4ffce 100644 --- a/code/addons/controls/manager.js +++ b/code/addons/controls/manager.js @@ -1 +1 @@ -import './dist/esm/manager'; +import './dist/manager'; From e4ef0fdeefb25bbc181d5da6b8004d4df1a36c48 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 26 Jul 2022 09:56:46 +0200 Subject: [PATCH 3/4] fix --- code/addons/actions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/addons/actions/package.json b/code/addons/actions/package.json index 55ff4fb9ac3..f5006ccbfbb 100644 --- a/code/addons/actions/package.json +++ b/code/addons/actions/package.json @@ -32,7 +32,7 @@ ], "scripts": { "check": "tsc --noEmit", - "prepare": "node ../../../scripts/prepare.js" + "prepare": "../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/addons": "7.0.0-alpha.16", From a4f6ba718518e7f24f0914b90f3ea60309fd3805 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 26 Jul 2022 10:03:00 +0200 Subject: [PATCH 4/4] fix --- code/addons/actions/manager.js | 2 +- code/addons/actions/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/addons/actions/manager.js b/code/addons/actions/manager.js index 8a2eae4ffce..4e287d25b15 100644 --- a/code/addons/actions/manager.js +++ b/code/addons/actions/manager.js @@ -1 +1 @@ -import './dist/manager'; +import './dist/esm/manager'; diff --git a/code/addons/actions/package.json b/code/addons/actions/package.json index f5006ccbfbb..55ff4fb9ac3 100644 --- a/code/addons/actions/package.json +++ b/code/addons/actions/package.json @@ -32,7 +32,7 @@ ], "scripts": { "check": "tsc --noEmit", - "prepare": "../../../scripts/prepare/bundle.ts" + "prepare": "node ../../../scripts/prepare.js" }, "dependencies": { "@storybook/addons": "7.0.0-alpha.16",