Skip to content

feat: add @primer/styled-react package #6417

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

Merged
merged 17 commits into from
Aug 5, 2025
Merged

Conversation

joshblack
Copy link
Member

@joshblack joshblack commented Jul 30, 2025

Closes https://github.com/github/primer/issues/5584

Add support for temporary package to help bridge between styled-components usage and @primer/react

Changelog

New

  • Add new package, @primer/styled-react that will be the adapter between styled-components usage and @primer/react when we remove support for styled-components

Changed

Removed

Copy link

changeset-bot bot commented Jul 30, 2025

🦋 Changeset detected

Latest commit: 8463b5e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/styled-react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the staff Author is a staff member label Jul 30, 2025
Copy link
Contributor

github-actions bot commented Jul 30, 2025

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 90.12 KB (0%)
packages/react/dist/browser.umd.js 90.43 KB (0%)

Copy link
Member

@jonrohan jonrohan left a comment

Choose a reason for hiding this comment

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

Image

@joshblack joshblack added the skip changeset This change does not need a changelog label Jul 31, 2025
@github-actions github-actions bot requested a deployment to storybook-preview-6417 July 31, 2025 16:52 Abandoned
@github-actions github-actions bot requested a deployment to storybook-preview-6417 July 31, 2025 16:55 Abandoned
@github-actions github-actions bot requested a deployment to storybook-preview-6417 July 31, 2025 16:59 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-6417 July 31, 2025 17:08 Inactive
@joshblack joshblack marked this pull request as ready for review August 4, 2025 21:45
@Copilot Copilot AI review requested due to automatic review settings August 4, 2025 21:45
@joshblack joshblack requested a review from a team as a code owner August 4, 2025 21:45
@joshblack joshblack requested a review from francinelucca August 4, 2025 21:45
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new temporary package @primer/styled-react to help bridge between styled-components usage and @primer/react when styled-components support is removed.

  • Creates a new npm workspace package that re-exports selected components from @primer/react
  • Sets up build tooling and configuration for the new package
  • Includes test coverage to verify component exports

Reviewed Changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/styled-react/package.json Package configuration with dependencies and peer dependencies for the bridge package
packages/styled-react/src/index.ts Main entry point re-exporting 17 components from @primer/react
packages/styled-react/src/experimental.ts Re-exports experimental Dialog component
packages/styled-react/src/deprecated.ts Re-exports deprecated Octicon component
packages/styled-react/rollup.config.js Rollup build configuration for ESM output
packages/styled-react/src/tests/exports.test.ts Tests to verify component exports with snapshot testing
packages/styled-react/src/tests/snapshots/exports.test.ts.snap Snapshot file capturing expected exports
packages/styled-react/tsconfig.json TypeScript configuration extending base config
packages/styled-react/tsconfig.build.json Build-specific TypeScript configuration
packages/styled-react/vitest.config.ts Vitest test configuration
packages/styled-react/script/build Build script using rollup
packages/styled-react/README.md Documentation explaining the package purpose and usage
.changeset/spotty-coats-post.md Changeset file for version tracking

@github-actions github-actions bot requested a deployment to storybook-preview-6417 August 4, 2025 21:48 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-6417 August 4, 2025 21:57 Inactive
@@ -0,0 +1,5 @@
---
'@primer/styled-react': minor
Copy link
Member

Choose a reason for hiding this comment

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

Just double checking we're defaulting minor for all releases of this project?

Copy link
Member Author

Choose a reason for hiding this comment

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

That was my default but no preference on my end!


This is an interim package designed to make it easy to interop between Primer
and existing styled-components usage. Over time, this component will stop
receiving updates.
Copy link
Member

Choose a reason for hiding this comment

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

Wanting some wording in here about

  • This is pre-major and will have breaking changes
  • The components in here are temporary until we have determined they've been successfully migrated away.

Not married to the wording so whatever you want to fix here is 👍🏻 with me.

Suggested change
receiving updates.
receiving updates. And the components in here will be removed when we determine they are no longer in use without a major release.

Copy link
Member Author

Choose a reason for hiding this comment

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

Just pushed an update, let me know what you think!


test('@primer/styled-react/experimental exports', () => {
expect(Object.keys(StyledReactExperimental)).toMatchSnapshot()
})
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if there's some kinda test we could write that would verify the component is the same? Not a blocker, and might be overkill.

Copy link
Member Author

Choose a reason for hiding this comment

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

We could do a type test if that would be helpful, like make sure that every type matches the one from @primer/react. That wouldn't really be behavior/visual though if that's more so what you're looking for 👀

Copy link
Member

@jonrohan jonrohan left a comment

Choose a reason for hiding this comment

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

Looks good :shipit:

@@ -0,0 +1,18 @@
export {
Copy link
Member

Choose a reason for hiding this comment

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

when does the wrapping happen? 🤔 or as we remove the sx from @primer/react we'd come here and do that wrapping? 👀

Copy link
Member Author

Choose a reason for hiding this comment

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

as we remove the sx from @primer/react we'd come here and do that wrapping?

Exactly 💯

@joshblack joshblack added this pull request to the merge queue Aug 5, 2025
Merged via the queue into main with commit 0ce5db8 Aug 5, 2025
43 checks passed
@joshblack joshblack deleted the feat/add-styled-react-package branch August 5, 2025 18:19
@primer primer bot mentioned this pull request Aug 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip changeset This change does not need a changelog staff Author is a staff member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants