-
Notifications
You must be signed in to change notification settings - Fork 376
perf(packages): Remove babel in favor of tsc #4010
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
Conversation
|
PF4 preview: https://patternfly-react-pr-4010.surge.sh |
ddonahue007
left a comment
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
seanforyou23
left a comment
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.
A big diff.. can we split out the work of upgrading inline-edit-extension to TS? Also, might be good to squash the commits.
|
@seanforyou23 It'd take a couple hours to split out the There's a couple of merge commits in the history, so I can't easily squash them. Github will do that hard work upon merging, sorry for having to scroll to see the comments at the bottom here. |
|
Do we know if switching from |
|
@mturley Yes our compiled code is different. This PR targets ES2015 and use Typescript helpers and transforms to compile our code rather than Babel's. This allows for the use of arrow functions, although I'm not sure about async/await (but we don't have any usages of async/await in our exported codebase). Overall, I think our generated code quality has increased. Here's a diff of Also now that we clearly target ES2015 we can list browsers + versions that we support. I'll add that to the future work section of the OP. |
|
Nice! Yeah, definitely an improvement. |
This is the first time I've heard of this, have we checked with relevant teams who depend on this feature?
I think you miss the point, it's not about getting the extension to work with babel but rather not sending a PR that's so large in volume that it becomes difficult to read and follow. |
|
@redallen do you mean you'd have to get the TS version of inline-edit-extension to work with babel in order to merge that before this PR? Could we instead leave its JS as-is for now but compiled by tsc (merge this PR with the |
|
Oh, I'm seeing this now:
|
|
@redallen when you were using Even if we can't do it that way, maybe we can use |
|
I'm turn #3972 into an epic and break up this PR into smaller pieces that are easier to understand and review. |
What: Closes #3972
tscinstead ofbabelto build react-* packages.tslibdependency and use it viaimportHelpers: trueflag to avoid hundreds of spread/import helpers at the top of most files.propTypesas apeerDependencysince the babel plugintypescript-to-proptypescan no longer be used.dist/**/*.mapanddist/*.tsbuildinfofiles to each project's.npmignore.tsc's project references which are well suited for monorepos. Cold build times for ESM and CJS are ~60s. Hot build times when touching react-core are ~6s.generatescript to generate entiredistfolder for react-tokens, react-icons and react-styles without using babel. Refactor code generation to matchtsc's generated code.yarn generatecommand (which ranplop) toyarn templateoryarn plop.react-inline-edit-extensionto TS so it can compile without enablingtsc'sallowJSflag.Additional issues:
react-inline-edit-extensionhad > 200 type errors when settingallowJS: true. I refactored it to TS and removepropTypesfrom it to match the rest of our projects."project"option for the time being which brings down the cold run time to ~50s and hot run time to 1.5s.Further work:
import * as React from 'react';withimport React from 'react';ts-jestinstead ofbabel-jestto type check test files while compiling them. Combined with @jschuler 's auto generated snapshot tests this eliminates the need forreact-integrationto type check.tsc.Breaking changes
@patternfly/react-virtualized-extension
ALL PACKAGES
propTypesfor our components. Consider using our Typescript types underdist/jsinstead.