File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -135,6 +135,12 @@ function processModule(
135135
136136/** Inject typescript docgen information into modules at the end of a build */
137137export default class DocgenPlugin implements webpack . WebpackPluginInstance {
138+ public static defaultOptions = {
139+ setDisplayName : true ,
140+ typePropName : "type" ,
141+ docgenCollectionName : "STORYBOOK_REACT_CLASSES" ,
142+ } ;
143+
138144 private name = "React Docgen Typescript Plugin" ;
139145 private options : PluginOptions ;
140146
@@ -266,6 +272,7 @@ export default class DocgenPlugin implements webpack.WebpackPluginInstance {
266272 typePropName,
267273 ...docgenOptions
268274 } = this . options ;
275+ const { defaultOptions } = DocgenPlugin ;
269276
270277 let compilerOptions = {
271278 jsx : ts . JsxEmit . React ,
@@ -286,9 +293,12 @@ export default class DocgenPlugin implements webpack.WebpackPluginInstance {
286293 return {
287294 docgenOptions,
288295 generateOptions : {
289- docgenCollectionName : docgenCollectionName || "STORYBOOK_REACT_CLASSES" ,
290- setDisplayName : setDisplayName || true ,
291- typePropName : typePropName || "type" ,
296+ docgenCollectionName :
297+ docgenCollectionName === undefined
298+ ? defaultOptions . docgenCollectionName
299+ : docgenCollectionName ,
300+ setDisplayName : setDisplayName ?? defaultOptions . setDisplayName ,
301+ typePropName : typePropName ?? defaultOptions . typePropName ,
292302 } ,
293303 compilerOptions,
294304 } ;
You can’t perform that action at this time.
0 commit comments