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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish: Don't distribute src files or unnecessary template files #23853

Merged
merged 3 commits into from Aug 17, 2023

Conversation

shilman
Copy link
Member

@shilman shilman commented Aug 16, 2023

Closes N/A

What I did

This pull request excludes the src directories from the files fields in the package.json files of all the addons and builders in the Storybook monorepo. This reduces the package sizes and avoids publishing unnecessary source files.

How to test

Need to do a canary release

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests)
  • Make sure to add/update documentation regarding your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

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/src/sandbox-templates.ts
  • Make sure this PR contains one of the labels below.

["cleanup", "BREAKING CHANGE", "feature request", "bug", "build", "documentation", "maintenance", "dependencies", "other"]

馃 Canary release

This pull request has been released as version 0.0.0-pr-23853-sha-93b33e06. Install it by pinning all your Storybook dependencies to that version.

More information
Published version 0.0.0-pr-23853-sha-93b33e06
Triggered by @shilman
Repository storybookjs/storybook
Branch shilman/reduce-publish-size
Commit 93b33e06
Datetime Wed Aug 16 08:48:33 UTC 2023 (1692175713)
Workflow run 5876660633

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=23853

@shilman shilman added maintenance User-facing maintenance tasks performance issue ci:normal labels Aug 16, 2023
@shilman shilman changed the title Don't distribute src files or unnecessary template files Publish: Don't distribute src files or unnecessary template files Aug 16, 2023
@shilman
Copy link
Member Author

shilman commented Aug 16, 2023

Before

shilman@MBP14 test-vite % du -sh node_modules/@storybook
59M    node_modules/@storybook

After

shilman@MBP14 test-vite % du -sh node_modules/@storybook
 51M    node_modules/@storybook

Copy link
Member

@yannbf yannbf left a comment

Choose a reason for hiding this comment

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

Fantastic 馃憦

@@ -56,7 +56,8 @@
"dist/**/*",
"README.md",
"*.js",
"*.d.ts"
"*.d.ts",
"!src/**/*"
Copy link
Member

@IanVS IanVS Aug 16, 2023

Choose a reason for hiding this comment

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

Just curious, how was src being included in the first place? Was it the "*.js"? Most of our src files are typescript, so I'm wondering how you're saving so many MB.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, the *.js match would include things in src such as src/__mockdata__/someStory.js and things like that.
The biggest chunk that got shaved off doesn't come from that, it comes from changes like this:

-    "template/**/*",
+    "template/cli/**/*",

because we were introducing a lot of example stories that only matter for our sandboxes (a little over 800kb)

@shilman shilman merged commit 3dfc417 into next Aug 17, 2023
14 of 15 checks passed
@shilman shilman deleted the shilman/reduce-publish-size branch August 17, 2023 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants