-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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: Make prettier
an optional peer dependency
#29223
Core: Make prettier
an optional peer dependency
#29223
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 41d8e09. 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 targetSent with 💌 from NxCloud. |
I've tested this with npm, Yarn PnP and pnpm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
We use prettier v1 and our builds started to break. Should this have been in a major release? |
@news-manishpatel could you elaborate a bit more on how your builds are starting to break? |
@JReinhold We use prettier v1 and with storybook v8.3.x this works fine but with 8.4.x this breaks. |
@JReinhold should we broaden the version range to include prettier v1? |
Closes #29084
What I did
Made
prettier
an optional peer dependency of@storybook/core
. The Save from Controls that is using Prettier to format the output according to the project's options, is already written to support environments where Prettier isn't installed.storybook/code/core/src/common/utils/formatter.ts
Lines 1 to 6 in d3f5ad9
kept
prettier
as an internal for the@storybook/core/components
entrypoint, because the syntax highlighter uses it when formatting is enabled. It uses the lighter weightprettier/standalone
and html plugin.https://github.com/storybookjs/storybook/blob/d3f5ad98982d4320fde6dac9c901440d48496be8/code/core/src/components/components/syntaxhighlighter/formatter.ts
(Given that it only supports formatting
html
and notjs
/jsx
, etc. I question how valuable it is. I've added a bullet in the 9.0 changes to consider removing it)Before
After
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
prettier
isn't polluted into the project.to test formatting in the syntax highlighter:
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal
,ci:merged
orci:daily
GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli/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-29223-sha-d3f5ad98
. Try it out in a new sandbox by runningnpx storybook@0.0.0-pr-29223-sha-d3f5ad98 sandbox
or in an existing project withnpx storybook@0.0.0-pr-29223-sha-d3f5ad98 upgrade
.More information
0.0.0-pr-29223-sha-d3f5ad98
29084-minimize-the-bundling-of-prettier-in-storybookcore
d3f5ad98
1727383795
)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=29223
Greptile Summary
This PR makes Prettier an optional peer dependency in @storybook/core and @storybook/cli, while retaining it as an internal dependency for specific components.
code/core/package.json
to make Prettier an optional peer dependencycode/core/scripts/entries.ts
to include Prettier as an internal dependency for the syntax highlighter componentcode/lib/cli/package.json