From b814ecad04eae800f3ed5db2b4c9fa548ed96895 Mon Sep 17 00:00:00 2001 From: Alexander Trefz Date: Fri, 20 Jan 2023 12:00:18 +0100 Subject: [PATCH] fix: Ensure Angular docsMode flag has effect & rename it to docs --- .../src/builders/build-storybook/index.ts | 6 +++--- .../src/builders/build-storybook/schema.json | 18 +++++++++++++----- .../src/builders/start-storybook/index.ts | 6 +++--- .../src/builders/start-storybook/schema.json | 13 +++++++++---- code/lib/cli/src/build.ts | 1 - code/lib/cli/src/dev.ts | 1 - .../installation-problems/angular.mdx | 2 +- 7 files changed, 29 insertions(+), 18 deletions(-) diff --git a/code/frameworks/angular/src/builders/build-storybook/index.ts b/code/frameworks/angular/src/builders/build-storybook/index.ts index 5d10ddfbd03b..d39fad679d3a 100644 --- a/code/frameworks/angular/src/builders/build-storybook/index.ts +++ b/code/frameworks/angular/src/builders/build-storybook/index.ts @@ -22,7 +22,7 @@ import { buildStandaloneErrorHandler } from '../utils/build-standalone-errors-ha export type StorybookBuilderOptions = JsonObject & { browserTarget?: string | null; tsConfig?: string; - docsMode: boolean; + docs: boolean; compodoc: boolean; compodocArgs: string[]; styles?: StyleElement[]; @@ -59,7 +59,7 @@ function commandBuilder( stylePreprocessorOptions, styles, configDir, - docsMode, + docs, loglevel, outputDir, quiet, @@ -70,7 +70,7 @@ function commandBuilder( const standaloneOptions: StandaloneBuildOptions = { packageJson: readUpSync({ cwd: __dirname }).packageJson, configDir, - docsMode, + ...(docs ? { docs } : {}), loglevel, outputDir, quiet, diff --git a/code/frameworks/angular/src/builders/build-storybook/schema.json b/code/frameworks/angular/src/builders/build-storybook/schema.json index 29ebe3b5e19d..43c55428d1dd 100644 --- a/code/frameworks/angular/src/builders/build-storybook/schema.json +++ b/code/frameworks/angular/src/builders/build-storybook/schema.json @@ -34,7 +34,7 @@ "description": "Suppress verbose build output.", "default": false }, - "docsMode": { + "docs": { "type": "boolean", "description": "Starts Storybook in documentation mode. Learn more about it : https://storybook.js.org/docs/react/writing-docs/build-documentation#preview-storybooks-documentation.", "default": false @@ -47,13 +47,19 @@ "compodocArgs": { "type": "array", "description": "Compodoc options : https://compodoc.app/guides/options.html. Options `-p` with tsconfig path and `-d` with workspace root is always given.", - "default": ["-e", "json"], + "default": [ + "-e", + "json" + ], "items": { "type": "string" } }, "webpackStatsJson": { - "type": ["boolean", "string"], + "type": [ + "boolean", + "string" + ], "description": "Write Webpack Stats JSON to disk", "default": false }, @@ -104,7 +110,9 @@ } }, "additionalProperties": false, - "required": ["input"] + "required": [ + "input" + ] }, { "type": "string", @@ -113,4 +121,4 @@ ] } } -} +} \ No newline at end of file diff --git a/code/frameworks/angular/src/builders/start-storybook/index.ts b/code/frameworks/angular/src/builders/start-storybook/index.ts index 6678cf501778..abf0e59f237e 100644 --- a/code/frameworks/angular/src/builders/start-storybook/index.ts +++ b/code/frameworks/angular/src/builders/start-storybook/index.ts @@ -22,7 +22,7 @@ import { buildStandaloneErrorHandler } from '../utils/build-standalone-errors-ha export type StorybookBuilderOptions = JsonObject & { browserTarget?: string | null; tsConfig?: string; - docsMode: boolean; + docs: boolean; compodoc: boolean; compodocArgs: string[]; styles?: StyleElement[]; @@ -68,7 +68,7 @@ function commandBuilder( styles, ci, configDir, - docsMode, + docs, host, https, port, @@ -84,7 +84,7 @@ function commandBuilder( packageJson: readUpSync({ cwd: __dirname }).packageJson, ci, configDir, - docsMode, + ...(docs ? { docs } : {}), host, https, port, diff --git a/code/frameworks/angular/src/builders/start-storybook/schema.json b/code/frameworks/angular/src/builders/start-storybook/schema.json index bfc83a59fe29..e81e0579b8dc 100644 --- a/code/frameworks/angular/src/builders/start-storybook/schema.json +++ b/code/frameworks/angular/src/builders/start-storybook/schema.json @@ -61,7 +61,7 @@ "description": "Suppress verbose build output.", "default": false }, - "docsMode": { + "docs": { "type": "boolean", "description": "Starts Storybook in documentation mode. Learn more about it : https://storybook.js.org/docs/react/writing-docs/build-documentation#preview-storybooks-documentation.", "default": false @@ -74,7 +74,10 @@ "compodocArgs": { "type": "array", "description": "Compodoc options : https://compodoc.app/guides/options.html. Options `-p` with tsconfig path and `-d` with workspace root is always given.", - "default": ["-e", "json"], + "default": [ + "-e", + "json" + ], "items": { "type": "string" } @@ -126,7 +129,9 @@ } }, "additionalProperties": false, - "required": ["input"] + "required": [ + "input" + ] }, { "type": "string", @@ -135,4 +140,4 @@ ] } } -} +} \ No newline at end of file diff --git a/code/lib/cli/src/build.ts b/code/lib/cli/src/build.ts index 2110be45d4fa..b1c16e37b2cd 100644 --- a/code/lib/cli/src/build.ts +++ b/code/lib/cli/src/build.ts @@ -10,7 +10,6 @@ export const build = async (cliOptions: any) => { configDir: cliOptions.configDir || './.storybook', outputDir: cliOptions.outputDir || './storybook-static', ignorePreview: !!cliOptions.previewUrl && !cliOptions.forceBuildPreview, - docsMode: !!cliOptions.docs, configType: 'PRODUCTION', cache, packageJson: readUpSync({ cwd: __dirname }).packageJson, diff --git a/code/lib/cli/src/dev.ts b/code/lib/cli/src/dev.ts index b50da7466229..4eaa12083904 100644 --- a/code/lib/cli/src/dev.ts +++ b/code/lib/cli/src/dev.ts @@ -13,7 +13,6 @@ export const dev = async (cliOptions: any) => { configDir: cliOptions.configDir || './.storybook', configType: 'DEVELOPMENT', ignorePreview: !!cliOptions.previewUrl && !cliOptions.forceBuildPreview, - docsMode: !!cliOptions.docs, cache, packageJson: readUpSync({ cwd: __dirname }).packageJson, }; diff --git a/docs/get-started/installation-problems/angular.mdx b/docs/get-started/installation-problems/angular.mdx index b2a0a78ba378..3fb4c90b5093 100644 --- a/docs/get-started/installation-problems/angular.mdx +++ b/docs/get-started/installation-problems/angular.mdx @@ -38,7 +38,7 @@ | `"smokeTest"` | Exit Storybook after successful start.
`"smokeTest": true` | | `"ci"` | Starts Storybook in CI mode (skips interactive prompts and will not open browser window).
`"ci": true` | | `"quiet"` | Filters Storybook verbose build output.
`"quiet": true` | -| `"docsMode"` | Starts Storybook in [documentation mode](../writing-docs/build-documentation.md#preview-storybooks-documentation).
`"docsMode": true` | +| `"docs"` | Starts Storybook in [documentation mode](../writing-docs/build-documentation.md#preview-storybooks-documentation).
`"docs": true` | | `"styles"` | Provide the location of the [application's styles](../configure/styling-and-css.md#importing-css-files) to be used with Storybook.
`"styles": ["src/styles.css", "src/styles.scss"]`
| | `"stylePreprocessorOptions"` | Provides further customization for style preprocessors resolved to the workspace root.
`"stylePreprocessorOptions": { "includePaths": ["src/styles"] }` |