From 6d5e19e941bc5692c3403ef02f4ea7c0cd5982d8 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 29 Nov 2022 14:04:20 +0100 Subject: [PATCH 1/3] add backwards support for manager-api package rename --- .../src/preview/iframe-webpack.config.ts | 2 ++ code/ui/manager/src/globals/exports.ts | 32 +++++++++++++++++++ code/ui/manager/src/globals/runtime.ts | 1 + code/ui/manager/src/globals/types.ts | 1 + 4 files changed, 36 insertions(+) diff --git a/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts b/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts index 31dac54dfe5f..fe96423bdcc2 100644 --- a/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts +++ b/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts @@ -40,6 +40,8 @@ const storybookPaths: Record = { }), {} ), + // deprecated, remove in 8.0 + [`@storybook/manager`]: dirname(require.resolve(`@storybook/manager-api/package.json`)), }; export default async ( diff --git a/code/ui/manager/src/globals/exports.ts b/code/ui/manager/src/globals/exports.ts index 09bff3b7d151..bc375b6ba00e 100644 --- a/code/ui/manager/src/globals/exports.ts +++ b/code/ui/manager/src/globals/exports.ts @@ -195,6 +195,38 @@ export default { 'useTheme', 'withTheme', ], + '@storybook/manager': [ + 'ActiveTabs', + 'Consumer', + 'ManagerContext', + 'Provider', + 'addons', + 'combineParameters', + 'controlOrMetaKey', + 'controlOrMetaSymbol', + 'eventMatchesShortcut', + 'eventToShortcut', + 'isMacLike', + 'isShortcutTaken', + 'keyToSymbol', + 'merge', + 'mockChannel', + 'optionOrAltSymbol', + 'shortcutMatchesShortcut', + 'shortcutToHumanString', + 'types', + 'useAddonState', + 'useArgTypes', + 'useArgs', + 'useChannel', + 'useGlobalTypes', + 'useGlobals', + 'useParameter', + 'useSharedState', + 'useStoryPrepared', + 'useStorybookApi', + 'useStorybookState', + ], '@storybook/manager-api': [ 'ActiveTabs', 'Consumer', diff --git a/code/ui/manager/src/globals/runtime.ts b/code/ui/manager/src/globals/runtime.ts index b09db0bdf2b7..d0e4df293ed2 100644 --- a/code/ui/manager/src/globals/runtime.ts +++ b/code/ui/manager/src/globals/runtime.ts @@ -20,6 +20,7 @@ export const values: Required> = { '@storybook/core-events': STORYBOOKEVENTS, '@storybook/router': STORYBOOKROUTER, '@storybook/theming': STORYBOOKTHEMING, + '@storybook/manager': STORYBOOKMANAGERAPI, // deprecated, remove in 8.0 '@storybook/manager-api': STORYBOOKMANAGERAPI, // backwards compatibility '@storybook/addons': { diff --git a/code/ui/manager/src/globals/types.ts b/code/ui/manager/src/globals/types.ts index 40c09508a642..f61b47e0ed2b 100644 --- a/code/ui/manager/src/globals/types.ts +++ b/code/ui/manager/src/globals/types.ts @@ -9,6 +9,7 @@ export enum Keys { '@storybook/core-events' = '__STORYBOOKCOREEVENTS__', '@storybook/router' = '__STORYBOOKROUTER__', '@storybook/theming' = '__STORYBOOKTHEMING__', + '@storybook/manager' = '__STORYBOOKAPI__', // deprecated, remove in 8.0 '@storybook/manager-api' = '__STORYBOOKAPI__', '@storybook/addons' = '__STORYBOOKADDONS__', '@storybook/client-logger' = '__STORYBOOKCLIENTLOGGER__', From be652c3d2a4fbc9b65a817539f4022f897cd1ab3 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 29 Nov 2022 14:10:38 +0100 Subject: [PATCH 2/3] alias the correct package name --- code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts | 2 +- code/ui/manager/src/globals/runtime.ts | 2 +- code/ui/manager/src/globals/types.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts b/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts index fe96423bdcc2..a8de0de4baa0 100644 --- a/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts +++ b/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts @@ -41,7 +41,7 @@ const storybookPaths: Record = { {} ), // deprecated, remove in 8.0 - [`@storybook/manager`]: dirname(require.resolve(`@storybook/manager-api/package.json`)), + [`@storybook/api`]: dirname(require.resolve(`@storybook/manager-api/package.json`)), }; export default async ( diff --git a/code/ui/manager/src/globals/runtime.ts b/code/ui/manager/src/globals/runtime.ts index d0e4df293ed2..87e0f6cbcf45 100644 --- a/code/ui/manager/src/globals/runtime.ts +++ b/code/ui/manager/src/globals/runtime.ts @@ -20,7 +20,7 @@ export const values: Required> = { '@storybook/core-events': STORYBOOKEVENTS, '@storybook/router': STORYBOOKROUTER, '@storybook/theming': STORYBOOKTHEMING, - '@storybook/manager': STORYBOOKMANAGERAPI, // deprecated, remove in 8.0 + '@storybook/api': STORYBOOKMANAGERAPI, // deprecated, remove in 8.0 '@storybook/manager-api': STORYBOOKMANAGERAPI, // backwards compatibility '@storybook/addons': { diff --git a/code/ui/manager/src/globals/types.ts b/code/ui/manager/src/globals/types.ts index f61b47e0ed2b..2861e45f632a 100644 --- a/code/ui/manager/src/globals/types.ts +++ b/code/ui/manager/src/globals/types.ts @@ -9,7 +9,7 @@ export enum Keys { '@storybook/core-events' = '__STORYBOOKCOREEVENTS__', '@storybook/router' = '__STORYBOOKROUTER__', '@storybook/theming' = '__STORYBOOKTHEMING__', - '@storybook/manager' = '__STORYBOOKAPI__', // deprecated, remove in 8.0 + '@storybook/api' = '__STORYBOOKAPI__', // deprecated, remove in 8.0 '@storybook/manager-api' = '__STORYBOOKAPI__', '@storybook/addons' = '__STORYBOOKADDONS__', '@storybook/client-logger' = '__STORYBOOKCLIENTLOGGER__', From ce3b108aa609694e5d0004707faaead770e17f94 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 29 Nov 2022 14:38:03 +0100 Subject: [PATCH 3/3] fix --- code/ui/manager/src/globals/exports.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ui/manager/src/globals/exports.ts b/code/ui/manager/src/globals/exports.ts index bc375b6ba00e..bcc126d07c7d 100644 --- a/code/ui/manager/src/globals/exports.ts +++ b/code/ui/manager/src/globals/exports.ts @@ -195,7 +195,7 @@ export default { 'useTheme', 'withTheme', ], - '@storybook/manager': [ + '@storybook/api': [ 'ActiveTabs', 'Consumer', 'ManagerContext',