Skip to content

CLI: Reimplement features prompt logic to handle --yes and fix --features#30534

Merged
ghengeveld merged 9 commits intonextfrom
refactor-features-prompt-logic
Feb 17, 2025
Merged

CLI: Reimplement features prompt logic to handle --yes and fix --features#30534
ghengeveld merged 9 commits intonextfrom
refactor-features-prompt-logic

Conversation

@ghengeveld
Copy link
Member

@ghengeveld ghengeveld commented Feb 13, 2025

What I did

Refactored and updated the logic around selecting features based on CLI flags and the interactive prompt. Specifically this ensures passing --yes will bypass the prompt and set the correct default value. Also removed the Development option because it will always be enabled.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make 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-30534-sha-aad85260. Try it out in a new sandbox by running npx storybook@0.0.0-pr-30534-sha-aad85260 sandbox or in an existing project with npx storybook@0.0.0-pr-30534-sha-aad85260 upgrade.

More information
Published version 0.0.0-pr-30534-sha-aad85260
Triggered by @ghengeveld
Repository storybookjs/storybook
Branch refactor-features-prompt-logic
Commit aad85260
Datetime Mon Feb 17 09:23:38 UTC 2025 (1739784218)
Workflow run 13366913550

To request a new release of this pull request, mention the @storybookjs/core team.

core team members can create a new canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=30534

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 80.6 MB 80.6 MB 1.17 kB 1.36 0%
initSize 80.6 MB 80.6 MB 1.17 kB 1.36 0%
diffSize 97 B 97 B 0 B - 0%
buildSize 7.31 MB 7.31 MB 0 B 0.44 0%
buildSbAddonsSize 1.9 MB 1.9 MB 0 B 0.36 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.88 MB 1.88 MB 0 B 0.45 0%
buildSbPreviewSize 0 B 0 B 0 B - -
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.97 MB 3.97 MB 0 B 0.36 0%
buildPreviewSize 3.34 MB 3.34 MB 0 B 0.47 0%
testBuildSize 0 B 0 B 0 B - -
testBuildSbAddonsSize 0 B 0 B 0 B - -
testBuildSbCommonSize 0 B 0 B 0 B - -
testBuildSbManagerSize 0 B 0 B 0 B - -
testBuildSbPreviewSize 0 B 0 B 0 B - -
testBuildStaticSize 0 B 0 B 0 B - -
testBuildPrebuildSize 0 B 0 B 0 B - -
testBuildPreviewSize 0 B 0 B 0 B - -
name before after diff z %
createTime 24.4s 24.9s 508ms 0.62 2%
generateTime 18.4s 20.2s 1.7s 0.43 8.8%
initTime 4.4s 4.6s 154ms 0.09 3.3%
buildTime 9.7s 9.5s -268ms 0.27 -2.8%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 5.3s 5.1s -211ms -0.5 -4.1%
devManagerResponsive 4s 3.7s -352ms -0.74 -9.4%
devManagerHeaderVisible 860ms 833ms -27ms 0.11 -3.2%
devManagerIndexVisible 871ms 866ms -5ms 0.12 -0.6%
devStoryVisibleUncached 4.1s 3.6s -528ms -0.11 -14.6%
devStoryVisible 897ms 863ms -34ms -0.13 -3.9%
devAutodocsVisible 773ms 809ms 36ms 0.3 4.4%
devMDXVisible 793ms 675ms -118ms -0.87 -17.5%
buildManagerHeaderVisible 721ms 720ms -1ms -0.64 -0.1%
buildManagerIndexVisible 807ms 779ms -28ms -0.59 -3.6%
buildStoryVisible 703ms 705ms 2ms -0.57 0.3%
buildAutodocsVisible 578ms 599ms 21ms -0.43 3.5%
buildMDXVisible 597ms 682ms 85ms 0.38 12.5%

Greptile Summary

This PR refactors the feature selection logic in Storybook's initialization process, focusing on improving the handling of the --yes flag and streamlining the feature selection experience.

  • Switched from array to Set for managing features in code/lib/create-storybook/src/initiate.ts with dev always included
  • Improved --yes flag handling to properly bypass prompts and set correct defaults
  • Removed redundant 'Development' option since it's always enabled
  • Added CI environment check to prevent auto-adding test features in non-interactive mode
  • Fixed potential feature mutation by generators by syncing features between options object and Set

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

@nx-cloud
Copy link

nx-cloud bot commented Feb 13, 2025

View your CI Pipeline Execution ↗ for commit 1955c45.

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 1m 59s View ↗

☁️ Nx Cloud last updated this comment at 2025-02-17 11:40:10 UTC

Copy link
Contributor

@valentinpalkovic valentinpalkovic left a comment

Choose a reason for hiding this comment

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

@ghengeveld CI is failing

@storybook-app-bot
Copy link

storybook-app-bot bot commented Feb 14, 2025

Package Benchmarks

Commit: bedcf63, ran on 17 February 2025 at 10:11:43 UTC

No significant changes detected, all good. 👏

@ghengeveld ghengeveld changed the title CLI: Reimplement features prompt logic to handle --yes CLI: Reimplement features prompt logic to handle --yes and fix --features flag Feb 17, 2025
@ghengeveld ghengeveld changed the title CLI: Reimplement features prompt logic to handle --yes and fix --features flag CLI: Reimplement features prompt logic to handle --yes and fix --features Feb 17, 2025
@ghengeveld ghengeveld enabled auto-merge February 17, 2025 11:06
@ghengeveld ghengeveld disabled auto-merge February 17, 2025 11:35
@ghengeveld ghengeveld merged commit 75f1c27 into next Feb 17, 2025
8 of 10 checks passed
@ghengeveld ghengeveld deleted the refactor-features-prompt-logic branch February 17, 2025 11:36
@github-actions github-actions bot mentioned this pull request Feb 17, 2025
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants