Skip to content

Commit

Permalink
core-server: add an option to disable warnOnIncompatibleAddons
Browse files Browse the repository at this point in the history
  • Loading branch information
taozhou-glean committed Nov 1, 2023
1 parent e1cb740 commit 0a00b6d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
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) {
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.
*/
warnOnIncompatibleAddons?: boolean;
};

/**
Expand Down

0 comments on commit 0a00b6d

Please sign in to comment.