Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Restore deprecation warning for configure #16041

Merged
merged 1 commit into from
Sep 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion lib/core-client/src/preview/start.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import global from 'global';
import deprecate from 'util-deprecate';
import { ClientApi } from '@storybook/client-api';
import { WebProjectAnnotations, PreviewWeb } from '@storybook/preview-web';
import { AnyFramework, ArgsStoryFn } from '@storybook/csf';
Expand All @@ -12,6 +13,13 @@ import { executeLoadableForChanges } from './executeLoadable';

const { window: globalWindow } = global;

const configureDeprecationWarning = deprecate(
() => {},
`\`configure()\` is deprecated and will be removed in Storybook 7.0.
Please use the \`stories\` field of \`main.js\` to load stories.
Read more at https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecated-configure`
);

export function start<TFramework extends AnyFramework>(
renderToDOM: WebProjectAnnotations<TFramework>['renderToDOM'],
{
Expand Down Expand Up @@ -52,7 +60,16 @@ export function start<TFramework extends AnyFramework>(
clientApi,
// This gets called each time the user calls configure (i.e. once per HMR)
// The first time, it constructs the preview, subsequently it updates it
configure(framework: string, loadable: Loadable, m?: NodeModule) {
configure(
framework: string,
loadable: Loadable,
m?: NodeModule,
showDeprecationWarning = true
) {
if (showDeprecationWarning) {
configureDeprecationWarning();
}

clientApi.addParameters({ framework });

// We need to run the `executeLoadableForChanges` function *inside* the `getProjectAnnotations
Expand Down