Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Evaluate main config when checking 'whats new' notifications #29622

Open
wants to merge 3 commits into
base: next
Choose a base branch
from

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Nov 15, 2024

Closes #29567

What I did

This PR changes the way what's new notification checks are done, instead of using AST parsing, it evaluates the main.js file instead.

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 PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

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

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 78.2 MB 78.2 MB 0 B 1.05 0%
initSize 143 MB 143 MB 67 B 1.33 0%
diffSize 65.2 MB 65.2 MB 67 B 1.92 0%
buildSize 6.88 MB 6.88 MB 0 B 2.98 0%
buildSbAddonsSize 1.51 MB 1.51 MB 0 B - 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.9 MB 1.9 MB 0 B 2.98 0%
buildSbPreviewSize 271 kB 271 kB 0 B - 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.88 MB 3.88 MB 0 B 2.98 0%
buildPreviewSize 3 MB 3 MB 0 B - 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 21.7s 22.8s 1.1s 1.33 🔺5.1%
generateTime 22.2s 18.8s -3s -342ms -0.84 -17.7%
initTime 16.1s 13.2s -2s -936ms -1.73 🔰-22.2%
buildTime 7.3s 9.4s 2s 0.53 22%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 5.4s 5.5s 90ms -0.28 1.6%
devManagerResponsive 3.4s 3.5s 102ms -0.23 2.9%
devManagerHeaderVisible 514ms 574ms 60ms 0.2 10.5%
devManagerIndexVisible 581ms 600ms 19ms -0.36 3.2%
devStoryVisibleUncached 1.1s 920ms -192ms -0.72 -20.9%
devStoryVisible 579ms 598ms 19ms -0.19 3.2%
devAutodocsVisible 469ms 722ms 253ms 3.18 🔺35%
devMDXVisible 551ms 530ms -21ms 0.23 -4%
buildManagerHeaderVisible 539ms 508ms -31ms -0.87 -6.1%
buildManagerIndexVisible 580ms 566ms -14ms -0.36 -2.5%
buildStoryVisible 530ms 522ms -8ms -0.65 -1.5%
buildAutodocsVisible 424ms 442ms 18ms -0.42 4.1%
buildMDXVisible 391ms 466ms 75ms 0.42 16.1%

Greptile Summary

Based on the provided information, I'll create a concise summary of the pull request changes:

Modified how Storybook evaluates "What's New" notification settings by switching from AST parsing to direct main.js configuration evaluation to fix parsing issues with certain config file formats.

  • Changed to use loadMainConfig instead of readConfig in code/core/src/core-server/utils/whats-new.ts
  • Added validation check for main._exportsObject when toggling notification settings
  • Improved error handling with clearer error messages for config parsing failures
  • Simplified access to disableWhatsNewNotifications configuration property

The changes address issue #29567 where AST parsing was failing for certain main.js/ts configuration formats, particularly when using imported configurations.

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.

LGTM

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

Copy link

nx-cloud bot commented Nov 15, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit afe9ec9. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@yannbf yannbf self-assigned this Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

[Bug]: CSF Parsing error: Expected 'ObjectExpression' but found 'undefined' instead in 'Identifier'
1 participant