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

WIP: CPC #27039

Draft
wants to merge 113 commits into
base: next
Choose a base branch
from
Draft

WIP: CPC #27039

wants to merge 113 commits into from

Conversation

ndelangen
Copy link
Member

@ndelangen ndelangen commented May 6, 2024

This description is incomplete

What

This PR tries to solve a variety of very complex & large problems in the storybook ecosystem:

  • package bloat, where storybook will install a large number of packages
    • installing storybook takes a long time
    • adding storybook to a project can decrease CI performance
  • hoisting issues, where storybook installs many version of itself
    • storybook is comprised of many packages that depend on each other, it's easy to get into a situation where multiple versions are installed, causing hoisting problems, and magnifying the "package bloat" problem.
  • maintenance complexity/burdon
    • share utilities/code is done through packages, but each package must be compiled
    • packages need to be published & version bumped
    • All this takes time on our local machine, and in our CI
    • packages are usually compiled with a specific target (node | browser), limiting their re-use in the other target.
  • public/private APIs
    • Due to how many packages exist it's not easy to know what is actually internal & public of our APIs.

How

How this PR achieves to solve these problem is by consolidating the storybook core packages into a singular package called @storybook/core.

Notes about the architecture now and what we're consolidating:
https://www.tldraw.com/r/3VZRrJz9gAeI2pBkrNYYs?v=395,2688,1335,1218&p=wggBXyyVFP09M7K06dXdG

The packages that are to be consolidated:

  • @storybook/channels
  • @storybook/client-logger
  • @storybook/core-common
  • @storybook/core-events
  • @storybook/csf-tools
  • @storybook/docs-tools
  • @storybook/instrumenter
  • @storybook/node-logger
  • @storybook/preview-api
  • @storybook/router
  • @storybook/telemetry
  • @storybook/theming
  • @storybook/types
  • @storybook/manager-api
  • @storybook/manager
  • @storybook/preview
  • @storybook/core-server
  • @storybook/test
  • @storybook/builder-manager
  • @storybook/components

Backwards compatible

We are doing this work in a backwards compatible way.

All the packages listed above will continue to be published, shimming the new @storybook/core package.

It will introduce the @storybook/core package as a peerDependency to all the packages listed above, which would be a breaking change, as the user will not have a satisfying dependency yet.

To remedy this we will add an automigration to add this dependency to the user's project.

In addition we will also block storybook from starting or building and tell the user they MUST run the migration to make storybook work.

Todo

  • Write automigration.
  • Add check for @storybook/core dependency presence & block start & build if not.
  • Remaining packages
  • The prep task of @storybook/core is flaky, sometimes it times out.
  • A few unit tests seem flaky
  • Figure out where the UI changes are coming from, though they look better?
  • update the MAINTENANCE.md file with instructions around the new build tooling.

@ndelangen ndelangen self-assigned this May 6, 2024
Copy link
Contributor

github-actions bot commented May 7, 2024

Fails
🚫 PR is marked with "ci: do not merge" label.

Generated by 🚫 dangerJS against b7445ee

Copy link

nx-cloud bot commented May 7, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 9bd2142. 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 2 targets

Sent with 💌 from NxCloud.

@ndelangen ndelangen marked this pull request as draft May 8, 2024 07:42
@ndelangen ndelangen changed the title WIP - CPC WIP: CPC May 16, 2024
@storybook-bot
Copy link
Contributor

Failed to publish canary version of this pull request, triggered by @yannbf. See the failed workflow run at: https://github.com/storybookjs/storybook/actions/runs/9131911289

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.

None yet

4 participants