Initiate: Fix used port flag handling#33544
Conversation
…port assignment when using an alternative port.
|
View your CI Pipeline Execution ↗ for commit f7e9934
☁️ Nx Cloud last updated this comment at |
📝 WalkthroughWalkthroughThe change refactors port flag handling in Storybook dev initialization. Instead of unconditionally appending a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (5)**/*.{js,jsx,ts,tsx,json,md,html,css,scss}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.{js,jsx,json,html,ts,tsx,mjs}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
code/{core,lib,addons,builders,frameworks,presets}/**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
🧠 Learnings (1)📚 Learning: 2025-11-05T09:38:47.712ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
✏️ Tip: You can disable this entire section by setting Comment |
What I did
@yannbf found out that the previous fix causes this to happen:

I'm trying to fix this, so the existing flag gets replaced, if it's there, and the shorthand is always used for consistency
I'm releasing a canary of this, to test it.
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
Ensure you have a storybook running on the default port
6006, then runnpx storybook@next init.You should see that storybook starts without asking you for which port, and it should start on the next available port automatically.
I've manually tested this.
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsMake sure this PR contains one of the labels below:
Available labels
bug: Internal changes that fixes incorrect behavior.maintenance: User-facing maintenance tasks.dependencies: Upgrading (sometimes downgrading) dependencies.build: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup: Minor cleanup style change. Will not show up in release changelog.documentation: Documentation only changes. Will not show up in release changelog.feature request: Introducing a new feature.BREAKING CHANGE: Changes that break compatibility in some way with current major version.other: Changes that don't fit in the above categories.🦋 Canary release
This pull request has been released as version
0.0.0-pr-33544-sha-f7e9934d. Try it out in a new sandbox by runningnpx storybook@0.0.0-pr-33544-sha-f7e9934d sandboxor in an existing project withnpx storybook@0.0.0-pr-33544-sha-f7e9934d upgrade.More information
0.0.0-pr-33544-sha-f7e9934dnorbert/more-fallbacks-to-init-port-fixf7e9934d1768467231)To request a new release of this pull request, mention the
@storybookjs/coreteam.core team members can create a new canary release here or locally with
gh workflow run --repo storybookjs/storybook publish.yml --field pr=33544Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.