From b2a7a179ba5a5222ff5aeb0feb5daa51d536ff02 Mon Sep 17 00:00:00 2001 From: Saunved Date: Mon, 25 Jul 2022 20:23:16 +0530 Subject: [PATCH 1/5] Generate addons/backgrounds with ts-up Ref: https://github.com/storybookjs/storybook/issues/18732 --- addons/backgrounds/manager.js | 2 +- addons/backgrounds/package.json | 39 +++++++++++++++++++++++++++++---- addons/backgrounds/preview.js | 2 +- yarn.lock | 1 + 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/addons/backgrounds/manager.js b/addons/backgrounds/manager.js index 4e287d25b151..8a2eae4ffce1 100644 --- a/addons/backgrounds/manager.js +++ b/addons/backgrounds/manager.js @@ -1 +1 @@ -import './dist/esm/manager'; +import './dist/manager'; diff --git a/addons/backgrounds/package.json b/addons/backgrounds/package.json index 3374604ea06c..5a1ecded7ed7 100644 --- a/addons/backgrounds/package.json +++ b/addons/backgrounds/package.json @@ -25,9 +25,32 @@ }, "license": "MIT", "author": "jbaxleyiii", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.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" + }, + "./preview": { + "require": "./dist/preview.js", + "import": "./dist/preview.mjs", + "types": "./dist/preview.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 +59,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/client-logger": "7.0.0-alpha.16", @@ -70,6 +94,13 @@ "publishConfig": { "access": "public" }, + "bundler": { + "entries": [ + "./src/index.ts", + "./src/manager.tsx", + "./src/preview.tsx" + ] + }, "gitHead": "df30e7db2b251418af106345e5722477f057ec36", "storybook": { "displayName": "Backgrounds", diff --git a/addons/backgrounds/preview.js b/addons/backgrounds/preview.js index e726cab5a1b6..8de14d30fdfa 100644 --- a/addons/backgrounds/preview.js +++ b/addons/backgrounds/preview.js @@ -1 +1 @@ -export * from './dist/esm/preview'; +import './dist/preview'; diff --git a/yarn.lock b/yarn.lock index c16edad78ba0..d2bf3b30bdcd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6910,6 +6910,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/addon-backgrounds@workspace:addons/backgrounds" dependencies: + "@digitak/esrun": ^3.2.2 "@storybook/addons": 7.0.0-alpha.16 "@storybook/api": 7.0.0-alpha.16 "@storybook/client-logger": 7.0.0-alpha.16 From 418a87127b68f3d0e15075194a6fe04a5a79dbf6 Mon Sep 17 00:00:00 2001 From: Saunved Date: Mon, 25 Jul 2022 22:28:41 +0530 Subject: [PATCH 2/5] Fix preview export --- addons/backgrounds/preview.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/backgrounds/preview.js b/addons/backgrounds/preview.js index 8de14d30fdfa..49ad602f79f4 100644 --- a/addons/backgrounds/preview.js +++ b/addons/backgrounds/preview.js @@ -1 +1 @@ -import './dist/preview'; +export * from './dist/preview'; From 75b8f59d8de3da07955e991fd5c802230b6cd02c Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 26 Jul 2022 09:40:04 +0200 Subject: [PATCH 3/5] fix --- code/addons/backgrounds/manager.js | 2 +- code/addons/backgrounds/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/addons/backgrounds/manager.js b/code/addons/backgrounds/manager.js index 4e287d25b151..8a2eae4ffce1 100644 --- a/code/addons/backgrounds/manager.js +++ b/code/addons/backgrounds/manager.js @@ -1 +1 @@ -import './dist/esm/manager'; +import './dist/manager'; diff --git a/code/addons/backgrounds/package.json b/code/addons/backgrounds/package.json index 0a5312c933fe..1e6d8b9db132 100644 --- a/code/addons/backgrounds/package.json +++ b/code/addons/backgrounds/package.json @@ -59,7 +59,7 @@ ], "scripts": { "check": "tsc --noEmit", - "prepare": "node ../../../scripts/prepare.js" + "prepare": "../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/addons": "7.0.0-alpha.16", From 51bdbbf3c1f2617ce835d9abed7c94b97bb89517 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 26 Jul 2022 09:56:18 +0200 Subject: [PATCH 4/5] 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 55ff4fb9ac39..f5006ccbfbbd 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 749a2270fa5a545c7a145d6dd9f12cae19df8c4a Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 26 Jul 2022 10:04:58 +0200 Subject: [PATCH 5/5] 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 8a2eae4ffce1..4e287d25b151 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 f5006ccbfbbd..55ff4fb9ac39 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",