[internal] Generate index.ts to keep it up to date
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
Summary 💡
It's easy for the global index.ts to get out of date with new components added to the repo - I just created https://github.com/mui/material-ui/pull/33982 to fix the current mismatch in @mui/joy. It's very easy to generate the index based on some rules in the directory naming - this way (with a "golden" test - checking that the submitted code matches the generated one) the index should never be out of date.
Current index.ts can be generated by adding:
export { default as colors } from './colors';
export * from './styles';
followed by one of these for each directory staring with [A-Z]:
export { default as DirName } from './DirName';
export * from './DirName';
Random notes:
- this probably could be done for other packages as well, I'm guessing @mui/joy is under most active development, that's why it got out of sync
- it's probably a good idea to add a comment at the top of the file saying something "this file is generated, run <command> to update it"
I'm happy to make a PR with this script, but would love to hear your thoughts first.
Examples 🌈
No response
Motivation 🔦
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with packages/mui-joy/src/index.ts and inspect how its exports correspond to the package directories whose names begin with uppercase letters. Define the generation rules described in the issue, then verify that a golden test can detect when the checked-in index differs from generated output; done means the index stays synchronized and documents how to regenerate it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100