Closed JReinhold closed 1 month ago
CI is running/has finished running commands for commit 41d8e095fd44869d0b6399458638d7fcac31a825. 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
Sent with π from NxCloud.
I've tested this with npm, Yarn PnP and pnpm
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. https://github.com/storybookjs/storybook/blob/d3f5ad98982d4320fde6dac9c901440d48496be8/code/core/src/common/utils/formatter.ts#L1-L6kept
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
Checklist for Maintainers
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
| | | | --- | --- | | **Published version** | [`0.0.0-pr-29223-sha-d3f5ad98`](https://npmjs.com/package/storybook/v/0.0.0-pr-29223-sha-d3f5ad98) | | **Triggered by** | @JReinhold | | **Repository** | [storybookjs/storybook](https://github.com/storybookjs/storybook) | | **Branch** | [`29084-minimize-the-bundling-of-prettier-in-storybookcore`](https://github.com/storybookjs/storybook/tree/29084-minimize-the-bundling-of-prettier-in-storybookcore) | | **Commit** | [`d3f5ad98`](https://github.com/storybookjs/storybook/commit/d3f5ad98982d4320fde6dac9c901440d48496be8) | | **Datetime** | Thu Sep 26 20:49:55 UTC 2024 (`1727383795`) | | **Workflow run** | [11060034306](https://github.com/storybookjs/storybook/actions/runs/11060034306) | To request a new release of this pull request, mention the `@storybookjs/core` team. _core team members can create a new canary release [here](https://github.com/storybookjs/storybook/actions/workflows/canary-release-pr.yml) 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