Merge pull request #15030 from storybookjs/14591-build-iframe-with-preview-url

CLI: Add option to force-build iframe despite custom preview URL
This commit is contained in:
Michael Shilman 2021-05-26 00:28:30 +08:00 committed by GitHub
commit c4734946c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 2 deletions

View File

@ -123,6 +123,7 @@ export interface CLIOptions {
port?: number;
ignorePreview?: boolean;
previewUrl?: string;
forceBuildPreview?: boolean;
host?: string;
staticDir?: string[];
configDir?: string;

View File

@ -125,7 +125,7 @@ export async function buildDev(loadOptions: LoadOptions) {
...loadOptions,
configDir: loadOptions.configDir || cliOptions.configDir || './.storybook',
configType: 'DEVELOPMENT',
ignorePreview: !!cliOptions.previewUrl,
ignorePreview: !!cliOptions.previewUrl && !cliOptions.forceBuildPreview,
docsMode: !!cliOptions.docs,
cache,
});

View File

@ -124,7 +124,8 @@ export async function buildStatic({ packageJson, ...loadOptions }: LoadOptions)
packageJson,
configDir: loadOptions.configDir || cliOptions.configDir || './.storybook',
outputDir: loadOptions.outputDir || cliOptions.outputDir || './storybook-static',
ignorePreview: !!loadOptions.ignorePreview || !!cliOptions.previewUrl,
ignorePreview:
(!!loadOptions.ignorePreview || !!cliOptions.previewUrl) && !cliOptions.forceBuildPreview,
docsMode: !!cliOptions.docs,
configType: 'PRODUCTION',
cache,

View File

@ -47,6 +47,7 @@ export async function getDevCli(packageJson: {
'--preview-url <string>',
'Disables the default storybook preview and lets your use your own'
)
.option('--force-build-preview', 'Build the preview iframe even if you are using --preview-url')
.option('--docs', 'Build a documentation-only site using addon-docs')
.option('--modern', 'Use modern browser modules')
.parse(process.argv);

View File

@ -15,6 +15,7 @@ export interface ProdCliOptions {
uiDll?: boolean;
debugWebpack?: boolean;
previewUrl?: string;
forceBuildPreview?: boolean;
docs?: boolean;
modern?: boolean;
}
@ -42,6 +43,7 @@ export function getProdCli(packageJson: {
'--preview-url <string>',
'Disables the default storybook preview and lets your use your own'
)
.option('--force-build-preview', 'Build the preview iframe even if you are using --preview-url')
.option('--docs', 'Build a documentation-only site using addon-docs')
.option('--modern', 'Use modern browser modules')
.parse(process.argv);