-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[docs] Improved demo transpiling #15438
Conversation
No bundle size changes comparing 6bff226...1b63f39 |
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.
@merceyz Really dig the new script. Just added some minor tweaks to the code structure.
Makes working with the docs a nicer experience
Looks a lot cleaner 👍 |
@eps1lon I added "cache" support, so that it wont transpile or hit the drive at all when it doesn't have to (disabled in CI builds). |
@merceyz 👌. This change can inspire us for a few improvements in the API generation logic, e.g. the caching 👀. |
I have a few more ideas for this, hold off on merging please |
@merceyz It's already a nice improvement. We don't mind two pull requests. Let us know :). |
@oliviertassinari I was trying to make babel automatically generate propTypes from the TypeScript definitions, but the plugin is unable to handle all the cases. Go ahead and merge, i'll look at it another time. |
Making this work would be amazing. This would require a rewrite of our api parser since we extract prop API docs from the propTypes. Verifying that propTypes and type definitions match would already be a huge improvement. Those get out of sync pretty easily (seems like we get an issue every 1 or 2 weeks about this). |
I have followed (at least) the PR section of the contributing guide.
formattedTSDemos.js
--watch
JavaScript
version is newer, can be disabled with--disable-cache
fixBabelGeneratorIssues
to detect the line endings used, instead of always using\n
, if no line ending is found, it uses the OS defaultfixBabelGeneratorIssues
not working with\r\n
line endingspackage.json
yarn docs:typescript
to useformattedTSDemos.js
in watch mode, this fixes it outputting with incorrect formattingcircleci
docs:typescript:formatted
with--disable-cache
Other:
docs/babel.config.ts.js
anddocs/ts-demo-ignore.json
, moved intoformattedTSDemos.js
, editedCONTRIBUTING.md
to reflect this