diff --git a/CHANGELOG.md b/CHANGELOG.md index a38ddb377030..90261c655782 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 8.1.9 + +- Addon-a11y: Workaround for Vite 5.3.0 compat - [#28241](https://github.com/storybookjs/storybook/pull/28241), thanks @shilman! +- CLI: Add `--no-dev` option to `init` - [#26918](https://github.com/storybookjs/storybook/pull/26918), thanks @fastfrwrd! +- CLI: Fix `init --skip-install` - [#28226](https://github.com/storybookjs/storybook/pull/28226), thanks @shilman! + ## 8.1.8 - Automigrations: Make VTA "learn more" link clickable - [#28020](https://github.com/storybookjs/storybook/pull/28020), thanks @deiga! diff --git a/code/addons/a11y/src/a11yRunner.ts b/code/addons/a11y/src/a11yRunner.ts index ec33803558c3..0a2c87bb2b1f 100644 --- a/code/addons/a11y/src/a11yRunner.ts +++ b/code/addons/a11y/src/a11yRunner.ts @@ -29,7 +29,7 @@ const run = async (storyId: string, input: A11yParameters = defaultParameters) = if (!active) { active = true; channel.emit(EVENTS.RUNNING); - const axe = (await import('axe-core')).default; + const { default: axe } = await import('axe-core'); const { element = '#storybook-root', config, options = {} } = input; const htmlElement = document.querySelector(element as string); diff --git a/code/lib/cli/src/generate.ts b/code/lib/cli/src/generate.ts index b5aa64f7f77d..a1a3d83ddfbb 100644 --- a/code/lib/cli/src/generate.ts +++ b/code/lib/cli/src/generate.ts @@ -58,6 +58,17 @@ command('init') .option('-y --yes', 'Answer yes to all prompts') .option('-b --builder ', 'Builder library') .option('-l --linkable', 'Prepare installation for link (contributor helper)') + // due to how Commander handles default values and negated options, we have to elevate the default into Commander, and we have to specify `--dev` + // alongside `--no-dev` even if we are unlikely to directly use `--dev`. https://github.com/tj/commander.js/issues/2068#issuecomment-1804524585 + .option( + '--dev', + 'Launch the development server after completing initialization. Enabled by default', + process.env.CI !== 'true' && process.env.IN_STORYBOOK_SANDBOX !== 'true' + ) + .option( + '--no-dev', + 'Complete the initialization of Storybook without launching the Storybook development server' + ) .action((options: CommandOptions) => { initiate(options).catch(() => process.exit(1)); }); diff --git a/code/lib/cli/src/generators/types.ts b/code/lib/cli/src/generators/types.ts index 763df2c4d1a6..5a8f7350f9bf 100644 --- a/code/lib/cli/src/generators/types.ts +++ b/code/lib/cli/src/generators/types.ts @@ -53,4 +53,5 @@ export type CommandOptions = { disableTelemetry?: boolean; enableCrashReports?: boolean; debug?: boolean; + dev?: boolean; }; diff --git a/code/lib/cli/src/initiate.ts b/code/lib/cli/src/initiate.ts index 4d83666780b2..dabe81cb2fcb 100644 --- a/code/lib/cli/src/initiate.ts +++ b/code/lib/cli/src/initiate.ts @@ -405,7 +405,7 @@ export async function doInitiate(options: CommandOptions): Promise< ); return { - shouldRunDev: process.env.CI !== 'true' && process.env.IN_STORYBOOK_SANDBOX !== 'true', + shouldRunDev: !!options.dev && !options.skipInstall, projectType, packageManager, storybookCommand, diff --git a/code/lib/cli/src/sandbox.ts b/code/lib/cli/src/sandbox.ts index d06c633c1a4d..621d62976c10 100644 --- a/code/lib/cli/src/sandbox.ts +++ b/code/lib/cli/src/sandbox.ts @@ -225,6 +225,7 @@ export const sandbox = async ({ process.chdir(templateDestination); // we run doInitiate, instead of initiate, to avoid sending this init event to telemetry, because it's not a real world project await doInitiate({ + dev: process.env.CI !== 'true' && process.env.IN_STORYBOOK_SANBOX !== 'true', ...options, }); process.chdir(before); diff --git a/code/package.json b/code/package.json index 6ec5f491aec9..e905339a2b48 100644 --- a/code/package.json +++ b/code/package.json @@ -299,5 +299,6 @@ "Dependency Upgrades" ] ] - } + }, + "deferredNextVersion": "8.1.9" } diff --git a/docs/api/cli-options.md b/docs/api/cli-options.md index 7177cce8caef..ae2cb3d779f1 100644 --- a/docs/api/cli-options.md +++ b/docs/api/cli-options.md @@ -119,6 +119,7 @@ Options include: | `--debug` | Outputs more logs in the CLI to assist debugging
`storybook init --debug` | | `--disable-telemetry` | Disables Storybook's telemetry. Learn more about it [here](../configure/telemetry.md#how-to-opt-out)
`storybook init --disable-telemetry` | | `--enable-crash-reports` | Enables sending crash reports to Storybook's telemetry. Learn more about it [here](../configure/telemetry.md#crash-reports-disabled-by-default)
`storybook init --enable-crash-reports` | +| `--no-dev` | Complete the initialization of Storybook without running the Storybook dev server
`storybook init --no-dev` | ### `add` diff --git a/docs/versions/latest.json b/docs/versions/latest.json index 7e0d5e15e8f8..c892c38e5271 100644 --- a/docs/versions/latest.json +++ b/docs/versions/latest.json @@ -1 +1 @@ -{"version":"8.1.8","info":{"plain":"- Automigrations: Make VTA \\\"learn more\\\" link clickable - [#28020](https://github.com/storybookjs/storybook/pull/28020), thanks @deiga!\n- CLI: Fix `init --skip-install` - [#28226](https://github.com/storybookjs/storybook/pull/28226), thanks @shilman!"}} +{"version":"8.1.9","info":{"plain":"- Addon-a11y: Workaround for Vite 5.3.0 compat - [#28241](https://github.com/storybookjs/storybook/pull/28241), thanks @shilman!\n- CLI: Add `--no-dev` option to `init` - [#26918](https://github.com/storybookjs/storybook/pull/26918), thanks @fastfrwrd!\n- CLI: Fix `init --skip-install` - [#28226](https://github.com/storybookjs/storybook/pull/28226), thanks @shilman!"}}