-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23915 from storybookjs/yann/add-framework-preset-…
…to-every-framework Preset: Add common preset overrides mechanism
- Loading branch information
Showing
4 changed files
with
35 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
code/lib/core-server/src/presets/common-override-preset.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { PresetProperty, StorybookConfig } from '@storybook/types'; | ||
|
||
export const framework: PresetProperty<'framework', StorybookConfig> = async (config) => { | ||
// This will get called with the values from the user's main config, but before | ||
// framework preset from framework packages e.g. react-webpack5 gets called. | ||
// This means we can add default values to the framework config, before it's requested by other packages. | ||
const name = typeof config === 'string' ? config : config?.name; | ||
const options = typeof config === 'string' ? {} : config?.options || {}; | ||
|
||
return { | ||
name, | ||
options, | ||
}; | ||
}; |