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: Add an option to disable warnOnIncompatibleAddons #24663

Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions code/lib/core-server/src/presets/common-preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ export const features = async (
storyStoreV7: true,
argTypeTargetsV7: true,
legacyDecoratorFileOrder: false,
warnOnIncompatibleAddons: true,
});

export const csfIndexer: Indexer = {
Expand Down
4 changes: 4 additions & 0 deletions code/lib/core-server/src/utils/warnOnIncompatibleAddons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import dedent from 'ts-dedent';
import { getIncompatibleAddons } from '../../../cli/src/automigrate/helpers/getIncompatibleAddons';

export const warnOnIncompatibleAddons = async (config: StorybookConfig) => {
if (config.features?.warnOnIncompatibleAddons === false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shilman I'm guessing warnOnIncompatibleAddons isn't temporary, so you'd want to locate it somewhere else?

return;
}

const incompatibleAddons = await getIncompatibleAddons(config);

if (incompatibleAddons.length > 0) {
Expand Down
6 changes: 6 additions & 0 deletions code/lib/types/src/modules/core-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export interface CLIOptions {
debugWebpack?: boolean;
webpackStatsJson?: string | boolean;
outputDir?: string;
warnOnIncompatibleAddons?: boolean;
}

export interface BuilderOptions {
Expand Down Expand Up @@ -310,6 +311,11 @@ export interface StorybookConfig {
* Apply decorators from preview.js before decorators from addons or frameworks
*/
legacyDecoratorFileOrder?: boolean;

/**
* Warn when there are incompatible addons detected, default to true.
*/
warnOnIncompatibleAddons?: boolean;
};

/**
Expand Down