Skip to content

Commit

Permalink
fix(storybook): add staticDir object schema (#8885)
Browse files Browse the repository at this point in the history
Adds schema for the more advanced storybook staticDirs config defined here.

https://storybook.js.org/docs/react/configure/images-and-assets
  • Loading branch information
leon committed Mar 8, 2022
1 parent 6c99959 commit 9c2ebfe
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
10 changes: 9 additions & 1 deletion docs/generated/api-storybook/executors/storybook.md
Expand Up @@ -79,12 +79,20 @@ Type: `string`

SSL key to use for serving HTTPS.

### staticDir
### ~~staticDir~~

Type: `array`

**Deprecated:** This field has been renamed to staticDirs.

Directory where to load static files from, array of strings

### staticDirs

Type: `array`

Directory where to load static files from, array of strings or object with from, to keys

### stylePreprocessorOptions.includePaths

Type: `array`
Expand Down
32 changes: 32 additions & 0 deletions packages/storybook/src/executors/storybook/schema.json
Expand Up @@ -50,8 +50,18 @@
"staticDir": {
"type": "array",
"description": "Directory where to load static files from, array of strings",
"default": [],
"items": {
"type": "string"
},
"x-deprecated": "This field has been renamed to staticDirs."
},
"staticDirs": {
"type": "array",
"description": "Directory where to load static files from, array of strings or object with from, to keys",
"default": [],
"items": {
"$ref": "#/definitions/staticDirPattern"
}
},
"projectBuildConfig": {
Expand Down Expand Up @@ -134,6 +144,28 @@
"description": "The file to include."
}
]
},
"staticDirPattern": {
"oneOf": [
{
"type": "object",
"properties": {
"from": {
"type": "string",
"description": "From path"
},
"to": {
"type": "string",
"description": "To path"
}
},
"additionalProperties": false,
"required": ["from", "to"]
},
{
"type": "string"
}
]
}
},
"required": ["uiFramework", "config"]
Expand Down
Expand Up @@ -16,6 +16,7 @@ export interface StorybookExecutorOptions extends CommonNxStorybookConfig {
sslCert?: string;
sslKey?: string;
staticDir?: string[];
staticDirs?: string[] | { from: string; to: string }[];
watch?: boolean;
docsMode?: boolean;
}
Expand Down

1 comment on commit 9c2ebfe

@vercel
Copy link

@vercel vercel bot commented on 9c2ebfe Mar 8, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.