diff --git a/MIGRATION.md b/MIGRATION.md index 7f4ad7a0a7d6..20ff3de61010 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -6,6 +6,7 @@ - [Imported types](#imported-types) - [Rolling back](#rolling-back) - [New addon presets](#new-addon-presets) + - [Removed Deprecated APIs](#removed-deprecated-apis) - [Client API changes](#client-api-changes) - [Removed Legacy Story APIs](#removed-legacy-story-apis) - [Can no longer add decorators/parameters after stories](#can-no-longer-add-decoratorsparameters-after-stories) @@ -50,6 +51,7 @@ - [Addon cssresources name attribute renamed](#addon-cssresources-name-attribute-renamed) - [Addon viewport uses parameters](#addon-viewport-uses-parameters) - [Addon a11y uses parameters, decorator renamed](#addon-a11y-uses-parameters-decorator-renamed) + - [Addon centered decorator deprecated](#addon-centered-decorator-deprecated) - [New keyboard shortcuts defaults](#new-keyboard-shortcuts-defaults) - [New URL structure](#new-url-structure) - [Rename of the `--secure` cli parameter to `--https`](#rename-of-the---secure-cli-parameter-to---https) @@ -207,6 +209,18 @@ MyNonCheckedStory.story = { }; ``` +### Removed Deprecated APIs + +In 6.0 we removed a number of APIs that were previously deprecated. + +See the migration guides for further details: + +- [Addon a11y uses parameters, decorator renamed](#addon-a11y-uses-parameters-decorator-renamed) +- [Addon backgrounds uses parameters](#addon-backgrounds-uses-parameters) +- [Source-loader](#source-loader) +- [Unified docs preset](#unified-docs-preset) +- [Addon centered decorator deprecated](#addon-centered-decorator-deprecated) + ### Client API changes #### Removed Legacy Story APIs @@ -869,6 +883,26 @@ Furthermore, the decorator `checkA11y` has been deprecated and renamed to `withA See the [a11y addon README](https://github.com/storybookjs/storybook/blob/master/addons/a11y/README.md) for more information. +### Addon centered decorator deprecated + +If you previously had: + +```js +import centered from '@storybook/addon-centered'; +``` + +You should replace it with the React or Vue version as appropriate + +```js +import centered from '@storybook/addon-centered/react'; +``` + +or + +```js +import centered from '@storybook/addon-centered/vue'; +``` + ### New keyboard shortcuts defaults Storybook's keyboard shortcuts are updated in 5.0, but they are configurable via the menu so if you want to set them back you can: diff --git a/addons/a11y/package.json b/addons/a11y/package.json index 8ba75f336139..7c53fa68d717 100644 --- a/addons/a11y/package.json +++ b/addons/a11y/package.json @@ -48,9 +48,7 @@ "react-redux": "^7.0.2", "react-sizeme": "^2.5.2", "redux": "^4.0.1", - "regenerator-runtime": "^0.13.3", - "ts-dedent": "^1.1.1", - "util-deprecate": "^1.0.2" + "regenerator-runtime": "^0.13.3" }, "devDependencies": { "@types/react-redux": "^7.0.6", diff --git a/addons/a11y/src/index.ts b/addons/a11y/src/index.ts index f96d86cb0d07..d3e3b5bbce65 100644 --- a/addons/a11y/src/index.ts +++ b/addons/a11y/src/index.ts @@ -1,7 +1,5 @@ import { document } from 'global'; import axe, { AxeResults, ElementContext, RunOptions, Spec } from 'axe-core'; -import deprecate from 'util-deprecate'; -import dedent from 'ts-dedent'; import addons, { makeDecorator } from '@storybook/addons'; import { EVENTS, PARAM_KEY } from './constants'; @@ -14,7 +12,7 @@ interface Setup { manual: boolean; } -let setup: Setup = { element: undefined, config: {}, options: {}, manual: false }; +const setup: Setup = { element: undefined, config: {}, options: {}, manual: false }; const getElement = () => { const storyRoot = document.getElementById('story-root'); @@ -74,34 +72,3 @@ export const withA11y = makeDecorator({ return getStory(context); }, }); - -// TODO: REMOVE at v6.0.0 -export const withA11Y = deprecate( - // @ts-ignore - (...args: any[]) => withA11y(...args), - 'withA11Y has been renamed withA11y' -); - -// TODO: REMOVE at v6.0.0 -export const checkA11y = deprecate( - // @ts-ignore - (...args: any[]) => withA11y(...args), - 'checkA11y has been renamed withA11y' -); - -// TODO: REMOVE at v6.0.0 -export const configureA11y = deprecate( - (config: any) => { - setup = config; - }, - dedent` - configureA11y is deprecated, please configure addon-a11y using the addParameter api: - - addParameters({ - a11y: { - // ... axe options - element: '#root', // optional selector which element to inspect - }, - }); - ` -); diff --git a/addons/a11y/src/preset/addDecorator.ts b/addons/a11y/src/preset/addDecorator.ts index d4cef2e81112..be3b27b26f7a 100644 --- a/addons/a11y/src/preset/addDecorator.ts +++ b/addons/a11y/src/preset/addDecorator.ts @@ -1,3 +1,3 @@ -import { withA11Y } from '../index'; +import { withA11y } from '../index'; -export const decorators = [withA11Y]; +export const decorators = [withA11y]; diff --git a/addons/backgrounds/package.json b/addons/backgrounds/package.json index 0a32e336c0a6..f4372022e77b 100644 --- a/addons/backgrounds/package.json +++ b/addons/backgrounds/package.json @@ -41,11 +41,9 @@ "core-js": "^3.0.1", "memoizerific": "^1.11.3", "react": "^16.8.3", - "regenerator-runtime": "^0.13.3", - "util-deprecate": "^1.0.2" + "regenerator-runtime": "^0.13.3" }, "devDependencies": { - "@types/util-deprecate": "^1.0.0", "@types/webpack-env": "^1.15.1" }, "peerDependencies": { diff --git a/addons/backgrounds/src/index.ts b/addons/backgrounds/src/index.ts index 9352400fe35c..b9ba57b91818 100644 --- a/addons/backgrounds/src/index.ts +++ b/addons/backgrounds/src/index.ts @@ -1,20 +1,3 @@ -import { makeDecorator, StoryContext, StoryGetter } from '@storybook/addons'; -import deprecate from 'util-deprecate'; - -// This decorator is kept purely so we produce a decorator that is compatible with both -// `addDecorator(withBackgrounds(...))` and `addDecorator(withBackgrounds)` -export const withBackgrounds = deprecate( - makeDecorator({ - name: 'withBackgrounds', - parameterName: 'backgrounds', - wrapper: (getStory: StoryGetter, context: StoryContext) => { - return getStory(context); - }, - }), - `Note that withBackgrounds(options) has been replaced by addParameters({ backgrounds: options}) -Read more about it in the migration guide: https://github.com/storybookjs/storybook/blob/master/MIGRATION.md` -); - if (module && module.hot && module.hot.decline) { module.hot.decline(); } diff --git a/addons/centered/package.json b/addons/centered/package.json index 73d14a0122ed..585c7824912e 100644 --- a/addons/centered/package.json +++ b/addons/centered/package.json @@ -33,8 +33,7 @@ "@storybook/addons": "6.0.0-alpha.25", "core-js": "^3.0.1", "global": "^4.3.2", - "regenerator-runtime": "^0.13.3", - "util-deprecate": "^1.0.2" + "regenerator-runtime": "^0.13.3" }, "devDependencies": { "@types/mithril": "^1.1.16", diff --git a/addons/centered/src/index.ts b/addons/centered/src/index.ts index 1bb9f82933ae..b9ba57b91818 100644 --- a/addons/centered/src/index.ts +++ b/addons/centered/src/index.ts @@ -1,24 +1,3 @@ -import { window } from 'global'; -import deprecate from 'util-deprecate'; - -import ReactCentered from './react'; -import VueCentered from './vue'; - -// TODO: REMOVE this entire file in V6.0.0 - -const Centered = deprecate( - () => (window.STORYBOOK_ENV === 'vue' ? VueCentered : ReactCentered), - ` - Using "import centered from '@storybook/addon-centered'" is deprecated. - Please use either: - "import centered from '@storybook/addon-centered/react'" - or - "import centered from '@storybook/addon-centered/vue'" -` -)(); - -export default Centered; - if (module && module.hot && module.hot.decline) { module.hot.decline(); } diff --git a/addons/docs/angular/preset.js b/addons/docs/angular/preset.js deleted file mode 100644 index 8d573804f8bf..000000000000 --- a/addons/docs/angular/preset.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../dist/frameworks/common/makePreset').default('angular'); diff --git a/addons/docs/html/preset.js b/addons/docs/html/preset.js deleted file mode 100644 index c8e7b0564571..000000000000 --- a/addons/docs/html/preset.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../dist/frameworks/common/makePreset').default('html'); diff --git a/addons/docs/react/preset.js b/addons/docs/react/preset.js deleted file mode 100644 index c92d21ffca5c..000000000000 --- a/addons/docs/react/preset.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../dist/frameworks/common/makePreset').default('react'); diff --git a/addons/docs/src/frameworks/common/makePreset.ts b/addons/docs/src/frameworks/common/makePreset.ts deleted file mode 100644 index 08654c15063b..000000000000 --- a/addons/docs/src/frameworks/common/makePreset.ts +++ /dev/null @@ -1,17 +0,0 @@ -import deprecate from 'util-deprecate'; -import dedent from 'ts-dedent'; -import * as common from '../../preset'; - -const makePreset = (framework: string) => { - deprecate( - () => {}, - dedent` - Framework-specific presets are no longer-needed as of Storybook 5.3 and will be removed in 6.0. - - Please use '@storybook/addon-docs/preset' instead of '@storybook/addon-docs/${framework}/preset'. - ` - )(); - return common; -}; - -export default makePreset; diff --git a/addons/docs/vue/preset.js b/addons/docs/vue/preset.js deleted file mode 100644 index 09cb6c49e5e5..000000000000 --- a/addons/docs/vue/preset.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../dist/frameworks/common/makePreset').default('vue'); diff --git a/addons/docs/web-components/preset.js b/addons/docs/web-components/preset.js deleted file mode 100644 index bb92eefa1c08..000000000000 --- a/addons/docs/web-components/preset.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../dist/frameworks/common/makePreset').default('web-components'); diff --git a/addons/storysource/loader.js b/addons/storysource/loader.js deleted file mode 100644 index cde76952e169..000000000000 --- a/addons/storysource/loader.js +++ /dev/null @@ -1,6 +0,0 @@ -const deprecate = require('util-deprecate'); - -deprecate(() => {}, -'@storybook/addon-storysource/loader is deprecated, please use @storybook/source-loader instead.')(); - -module.exports = require('@storybook/source-loader'); diff --git a/addons/storysource/package.json b/addons/storysource/package.json index 4e1176b48378..1557223153cd 100644 --- a/addons/storysource/package.json +++ b/addons/storysource/package.json @@ -43,8 +43,7 @@ "prop-types": "^15.7.2", "react": "^16.9.17", "react-syntax-highlighter": "^11.0.2", - "regenerator-runtime": "^0.13.3", - "util-deprecate": "^1.0.2" + "regenerator-runtime": "^0.13.3" }, "devDependencies": { "@types/react": "^16.9.19", diff --git a/addons/storysource/src/index.ts b/addons/storysource/src/index.ts index 6f62c1dcf725..a5cd9202f547 100644 --- a/addons/storysource/src/index.ts +++ b/addons/storysource/src/index.ts @@ -1,7 +1,6 @@ import { ADDON_ID, PANEL_ID } from './events'; -import { withStorySource } from './preview'; -export { ADDON_ID, PANEL_ID, withStorySource }; +export { ADDON_ID, PANEL_ID }; if (module && module.hot && module.hot.decline) { module.hot.decline(); diff --git a/addons/storysource/src/preview.ts b/addons/storysource/src/preview.ts deleted file mode 100644 index e36004385aec..000000000000 --- a/addons/storysource/src/preview.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { logger } from '@storybook/client-logger'; - -export function withStorySource(source: string, locationsMap = {}) { - logger.error( - '@storybook/addon-storysource/withStorySource is deprecated, please use paramaters instead.' - ); - - return (storyFn: (context: any) => React.ReactNode, context: any) => { - return storyFn(context); - }; -}