Skip to content
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

Merged
merged 18 commits into from
Apr 27, 2019
Merged

Conversation

merceyz
Copy link
Member

@merceyz merceyz commented Apr 21, 2019

  • I have followed (at least) the PR section of the contributing guide.

  • formattedTSDemos.js

    • Added support for running babel directly from the script, reducing I/O down to one read and write per demo transpiled
    • Added ignore list and babel config
    • Added support for watching for file changes with --watch
    • Added "cache" to skip transpiling if the JavaScript version is newer, can be disabled with --disable-cache
    • Added support for fixBabelGeneratorIssues to detect the line endings used, instead of always using \n, if no line ending is found, it uses the OS default
    • Fixed fixBabelGeneratorIssues not working with \r\n line endings
  • package.json

    • Changed yarn docs:typescript to use formattedTSDemos.js in watch mode, this fixes it outputting with incorrect formatting
  • circleci

    • Changed to run docs:typescript:formatted with --disable-cache
  • Other:

    • Deleted docs/babel.config.ts.js and docs/ts-demo-ignore.json, moved into formattedTSDemos.js, edited CONTRIBUTING.md to reflect this

@mui-pr-bot
Copy link

mui-pr-bot commented Apr 21, 2019

No bundle size changes comparing 6bff226...1b63f39

Generated by 🚫 dangerJS against 1b63f39

@eps1lon eps1lon self-requested a review April 22, 2019 06:38
@merceyz merceyz changed the title [docs] Refactored formattedTSDemos.js [docs] Improved demo transpiling Apr 24, 2019
docs/scripts/formattedTSDemos.js Outdated Show resolved Hide resolved
@eps1lon eps1lon self-requested a review April 24, 2019 17:04
Copy link
Member

@eps1lon eps1lon left a 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.

@eps1lon eps1lon added the core label Apr 24, 2019
@merceyz
Copy link
Member Author

merceyz commented Apr 24, 2019

Really dig the new script

Makes working with the docs a nicer experience

Just added some minor tweaks to the code structure.

Looks a lot cleaner 👍

@merceyz
Copy link
Member Author

merceyz commented Apr 24, 2019

@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).
Running yarn docs:typescript:formatted went from always taking 5+ seconds to ~0,5 seconds, if there is nothing to transpile. If you could do another review that would be great.

@eps1lon eps1lon self-requested a review April 25, 2019 06:46
CONTRIBUTING.md Show resolved Hide resolved
docs/scripts/formattedTSDemos.js Show resolved Hide resolved
docs/scripts/formattedTSDemos.js Outdated Show resolved Hide resolved
@oliviertassinari
Copy link
Member

@merceyz 👌. This change can inspire us for a few improvements in the API generation logic, e.g. the caching 👀.

@merceyz
Copy link
Member Author

merceyz commented Apr 26, 2019

I have a few more ideas for this, hold off on merging please

@oliviertassinari
Copy link
Member

@merceyz It's already a nice improvement. We don't mind two pull requests. Let us know :).

@merceyz
Copy link
Member Author

merceyz commented Apr 26, 2019

@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.

@eps1lon
Copy link
Member

eps1lon commented Apr 27, 2019

@oliviertassinari I was trying to make babel automatically generate propTypes from the TypeScript definitions, but the plugin is unable to handle all the cases.

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).

@merceyz merceyz deleted the formatted-ts branch April 27, 2019 10:56
@zannager zannager added the docs Improvements or additions to the documentation label Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants