-
Notifications
You must be signed in to change notification settings - Fork 640
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
Changes from 12 commits
a5dbefa
2034662
ad4b7c9
165f271
6d8842d
0d1e801
fd92156
5c57d43
6ea1c21
a4bf6ee
27fcb0d
0faadad
6ce63e0
8463b5e
c941367
0c786ce
1d60b44
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@primer/styled-react': minor | ||
| --- | ||
|
|
||
| Create the `@primer/styled-react` package to help with bridging between styled-components and Primer React | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,33 @@ | ||||||
| # @primer/styled-react | ||||||
|
|
||||||
| > A temporary package that bridges the gap between Primer React and styled-components | ||||||
|
|
||||||
| ## Getting started | ||||||
|
|
||||||
| To install `@primer/styled-react` in your project, you will need to run the following | ||||||
| command using [npm](https://www.npmjs.com/): | ||||||
|
|
||||||
| ```bash | ||||||
| npm install -S @primer/styled-react | ||||||
| ``` | ||||||
|
|
||||||
| ## Usage | ||||||
|
|
||||||
| 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. | ||||||
|
||||||
| 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. |
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.
Just pushed an update, let me know what you think!
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| { | ||
| "name": "@primer/styled-react", | ||
| "version": "0.0.0", | ||
| "type": "module", | ||
| "exports": { | ||
| ".": { | ||
| "types": "dist/index.d.ts", | ||
| "default": "dist/index.js" | ||
| }, | ||
| "./deprecated": { | ||
| "types": "dist/deprecated.d.ts", | ||
| "default": "dist/deprecated.js" | ||
| }, | ||
| "./experimental": { | ||
| "types": "dist/experimental.d.ts", | ||
| "default": "dist/experimental.js" | ||
| } | ||
| }, | ||
| "files": [ | ||
| "README.md", | ||
| "dist" | ||
| ], | ||
| "scripts": { | ||
| "build": "script/build", | ||
| "clean": "rimraf dist", | ||
| "type-check": "tsc --noEmit" | ||
| }, | ||
| "devDependencies": { | ||
| "@babel/preset-typescript": "^7.27.1", | ||
| "@primer/react": "^37.29.1", | ||
| "@rollup/plugin-babel": "^6.0.4", | ||
| "@types/react": "18.3.11", | ||
| "@types/react-dom": "18.3.1", | ||
| "react": "18.3.1", | ||
| "react-dom": "18.3.1", | ||
| "rimraf": "^6.0.1", | ||
| "rollup": "4.45.1", | ||
| "rollup-plugin-typescript2": "^0.36.0", | ||
| "styled-components": "5.3.11", | ||
| "typescript": "^5.8.2" | ||
| }, | ||
| "peerDependencies": { | ||
| "@primer/react": "^37.29.1", | ||
| "@types/react": "18.x || 19.x", | ||
| "@types/react-dom": "18.x || 19.x", | ||
| "@types/react-is": "18.x || 19.x", | ||
| "@types/styled-components": "^5.1.11", | ||
| "react": "18.x || 19.x", | ||
| "react-dom": "18.x || 19.x", | ||
| "react-is": "18.x || 19.x", | ||
| "styled-components": "5.x" | ||
| }, | ||
| "peerDependenciesMeta": { | ||
| "@types/react": { | ||
| "optional": true | ||
| }, | ||
| "@types/react-dom": { | ||
| "optional": true | ||
| }, | ||
| "@types/react-is": { | ||
| "optional": true | ||
| }, | ||
| "@types/styled-components": { | ||
| "optional": true | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import babel from '@rollup/plugin-babel' | ||
| import {defineConfig} from 'rollup' | ||
| import typescript from 'rollup-plugin-typescript2' | ||
| import packageJson from './package.json' with {type: 'json'} | ||
|
|
||
| const dependencies = [ | ||
| ...Object.keys(packageJson.peerDependencies ?? {}), | ||
| ...Object.keys(packageJson.dependencies ?? {}), | ||
| ...Object.keys(packageJson.devDependencies ?? {}), | ||
| ] | ||
|
|
||
| function createPackageRegex(name) { | ||
| return new RegExp(`^${name}(/.*)?`) | ||
| } | ||
|
|
||
| export default defineConfig({ | ||
| input: ['src/index.ts', 'src/experimental.ts', 'src/deprecated.ts'], | ||
| external: dependencies.map(createPackageRegex), | ||
| plugins: [ | ||
| typescript({ | ||
| tsconfig: 'tsconfig.build.json', | ||
| }), | ||
| babel({ | ||
| presets: ['@babel/preset-typescript'], | ||
| extensions: ['.ts', '.tsx'], | ||
| babelHelpers: 'bundled', | ||
| }), | ||
| ], | ||
| output: { | ||
| dir: 'dist', | ||
| format: 'esm', | ||
| }, | ||
| }) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| #!/bin/bash | ||
|
|
||
| npx rollup -c |
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.
Just double checking we're defaulting minor for all releases of this project?
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.
That was my default but no preference on my end!