Skip to content

Conversation

@benmccann
Copy link
Contributor

@benmccann benmccann commented May 7, 2025

Progress towards #29227

What I did

The addons project has been migrated to tinyglobby already. This updates the codemod package as well

Checklist for Contributors

Testing

I'm assuming the codemod library is already covered by tests. I'm not sure what kind

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>

Greptile Summary

This PR replaces the globby package with tinyglobby in the Storybook codemod package, part of an effort to streamline dependencies across the Storybook ecosystem.

  • Replaces globby v14.0.1 with tinyglobby v0.2.13 in code/lib/codemod/package.json
  • Updates import statement from globby to tinyglobby in code/lib/codemod/src/index.ts
  • Maintains existing glob pattern matching functionality while reducing dependency size
  • Contributes to issue Investigate replacing glob and globby with tinyglobby #29227 for optimizing glob-related dependencies

💡 (2/5) Greptile learns from your feedback when you react with 👍/👎!

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

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

@nx-cloud
Copy link

nx-cloud bot commented May 7, 2025

View your CI Pipeline Execution ↗ for commit 6a5711c

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

☁️ Nx Cloud last updated this comment at 2025-09-02 15:48:42 UTC

@storybook-app-bot
Copy link

storybook-app-bot bot commented May 7, 2025

Package Benchmarks

Commit: 6a5711c, ran on 2 September 2025 at 12:10:44 UTC

The following packages have significant changes to their size or dependencies:

@storybook/cli

Before After Difference
Dependency count 219 204 🎉 -15 🎉
Self size 879 KB 879 KB 🚨 +90 B 🚨
Dependency size 81.81 MB 81.58 MB 🎉 -228 KB 🎉
Bundle Size Analyzer Link Link

@storybook/codemod

Before After Difference
Dependency count 188 173 🎉 -15 🎉
Self size 35 KB 35 KB 🚨 +54 B 🚨
Dependency size 76.88 MB 76.66 MB 🎉 -228 KB 🎉
Bundle Size Analyzer Link Link

@yannbf
Copy link
Member

yannbf commented May 8, 2025

Hey @benmccann thanks for the PR In the issue it was mentioned about something important:

One reason why globby was selected for the Save from Controls feature is that it respects .gitignore and doesn't involve ignored files in search results. We should keep that in mind when migrating away from it

Can you check whether that is already supported by tinyglobby?

@benmccann
Copy link
Contributor Author

benmccann commented May 8, 2025

Ah, thanks. I only read the issue description and missed the comment. Unfortunately tinyglobby doesn't yet have support for that. I'm not sure if there's a large codebase you'd like to test this on to see if it matters or not. Although, I wonder if it wouldn't be an issue already since the addons package uses it?

@benmccann
Copy link
Contributor Author

benmccann commented Jun 26, 2025

@yannbf I just realized there very clearly won't be any performance regression in this PR related to that feature because globby's gitignore option is false by default, so that was never being used. In fact, I expect this change should improve performance as tinyglobby is generally faster than globby (at least on tinyglobby's main branch where they just added some benchmarks this morning demonstrating that)

@yannbf
Copy link
Member

yannbf commented Jul 24, 2025

@yannbf I just realized there very clearly won't be any performance regression in this PR related to that feature because globby's gitignore option is false by default, so that was never being used. In fact, I expect this change should improve performance as tinyglobby is generally faster than globby (at least on tinyglobby's main branch where they just added some benchmarks this morning demonstrating that)

Hey Ben! I'm sorry for taking so long to reply. We do use the gitignore option in a few places in Storybook, specially on the "Create story from component" feature which is important and should ignore such files when displaying them in the dropdown.

Regardless, I spoke with the team about this and we are planning on (@JReinhold suggestion):

  • Aim towards using tinyglobby everywhere
  • Do extensive QA
  • Gradually migrate on a per-package level
  • The logic that handles user's stories globs must be migrated in a major
  • Figure out what to do with gitignore in Save from Controls

@yannbf yannbf assigned JReinhold and unassigned yannbf Jul 24, 2025
@benmccann
Copy link
Contributor Author

Thanks! Yes, I did see the gitignore option used in another package. My plan there would be to work with the tinyglobby folks not to support it directly in tinyglobby (to avoid adding extra dependencies there), but to create some docs showing how to do it in conjunction with another package.

This PR was meant as part of the gradually migrate on a per-package level approach, which is what I'd had in mind as well. I'm not sure if this particular package needs to be migrated in a major or not, but hopefully this PR should be good to go whenever you are ready to accept it.

@benmccann benmccann removed the Stale label Sep 2, 2025
@JReinhold JReinhold changed the title refactor(codemod): replace globby with tinyglobby Codemod: Replace globby with tinyglobby Sep 2, 2025
Copy link
Contributor

@JReinhold JReinhold left a comment

Choose a reason for hiding this comment

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

I manually QA'ed this in a small project with

A. A regular file
B. A file that was gitignored
C. A file that was symlinked into the directory the glob matched

All files where modified similar to the existing behavior.

Great job, and thanks for the patience! 🙏

@JReinhold JReinhold merged commit 109d310 into storybookjs:next Sep 2, 2025
51 of 54 checks passed
@github-actions github-actions bot mentioned this pull request Sep 2, 2025
8 tasks
@benmccann benmccann deleted the tinyglobby-codemod branch September 2, 2025 18:48
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.

4 participants