-
Notifications
You must be signed in to change notification settings - Fork 82
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
build(forma-36-react-components): build with tsdx #611
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
87dfc02
to
400f49f
Compare
Deploy preview for forma-36-react-components ready! Built with commit 2892a94 https://deploy-preview-611--forma-36-react-components.netlify.app |
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! Should we merge this before #610 ?
// require.resolve('babel-loader'), | ||
// require.resolve('react-docgen-typescript-loader'), | ||
// ], | ||
// }); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@gui-santos Sorry, it's not ready yet 😬 The tests aren't running, I think it's because of tsdx issues that I hope will work better after Yarn workspaces are in. |
Hmmmm I see! Should we wait to merge the workspaces because of the frozen deployment? (I'm thinking on the case that someone needs to push a hotfix in the webapp and then it would try to get forma in the pipeline) |
e599909
to
6b9379a
Compare
I got the tests running, but they're currently failing because SVGs seem to not be loaded correctly. Same issue as seen here – will look into this more later, but help is welcome. |
5523158
to
568d012
Compare
86972e7
to
c255c7a
Compare
viewBox="0 0 9 18" | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="1em" |
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.
Are these width/height
changes expected? I see a lot of them in different svgs and snapshots
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.
They're from the way @svgr/cli
generates components based on SVG files. I don't know if it would be preferable to keep the sizes locked with px?
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.
This is great!
@@ -8,9 +8,7 @@ | |||
"packages/components/*" | |||
], | |||
"nohoist": [ | |||
"@contentful/forma-36-fcss/node-sass-import", | |||
"**/tsdx", | |||
"**/tsdx/**" |
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.
Nice!
import * as React from 'react'; | ||
|
||
function SvgArrowDown(props: React.SVGProps<SVGSVGElement>) { | ||
return ( | ||
<svg width="1em" height="1em" viewBox="0 0 24 24" {...props}> | ||
<path d="M7 10l5 5 5-5z" /> | ||
<path d="M0 0h24v24H0z" fill="none" /> | ||
</svg> | ||
); | ||
} | ||
|
||
export default SvgArrowDown; |
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.
@burakukula look!
This is basically what we need for an icon package
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.
yeah! exactly! 🙂
This is perfect! Since we are dating with the idea of making a separate package for icons. Moving them to components is 50% the work already hahahaha
If it's a good eslint config, I'm ok with that
I don't this will be a problem 😄
I prefer the first option too 👍 |
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.
Looks amazing! 🎉
Thanks for that contribution and yeah, most of the work for the icon package is done 🤯 I will try take it and move it to the package in the PR proposal in the next couple of days.
0044739
to
bafe503
Compare
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.
Awesome work 🍪
I'm not sure about width="1em" height="1em"
on svgs especially since the viewbox
is still in pixels as well. If there's a way to keep them in pixels it would be awesome.
I'm going to hold of #641 until this is merged, and hope conflicts would be nice to me 😏
"package.json", | ||
"dist" | ||
"dist", | ||
"src" |
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.
Nice 👍
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.
Do we want to have src
files in the npm package?
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.
Tbh I had the same thought. It's the tsdx default, but I'm not 100% sure why they add it.
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.
None of our experience components have it: https://github.com/contentful/experience-packages/blob/master/packages/experience-components/package.json, so I'd not include it here too.
@mshaaban0 (and /cc @suevalov): SVGR automatically adds missing |
@denkristoffer are |
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.
Let's remove src
folder from the built package, but otherwise is 🎖️
Purpose of PR
This PR moves
@contentful/forma-36-react-components
to a tsdx build setup. To allow this I had to do some subtasks:tsdx
bring its own eslint config, which we cannot really extend.forma-36-react-components
test config intosrc/
to have it included in the TSrootDir
.import { CardActions } from '@contentful/forma-36-react-components/dist/components/Card/CardActions/CardActions';
don't work. Do we want to support this?Some issues
eslint doesn't allow shared configs to bring their own modules, who knew! See eslint/eslint#3458 – this is crazy to me. Anyway, that means we'll have either to "reinstall" the modules used by tsdx's eslint config, like
eslint-config-prettier
, in each package or we can avoid using hoisting. I prefer the first option because it means less duplication.PR Checklist
readme.md
file(s)