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

[core] Use main repo as source of truth #144

Merged
merged 4 commits into from
Aug 7, 2020

Conversation

Comment on lines 1 to 9
import MyApp from '@material-ui/monorepo/docs/pages/_app';

export default MyApp;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The beauty of the approach

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How aboutexport {default as MyApp} from...? 1 line

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know, named export doesn't work with Next.js custom App: https://nextjs.org/docs/advanced-features/custom-app.

We could probably do

export { default } from '@material-ui/monorepo/docs/pages/_app';

But the commit the comment is based on is outdated, the file has grown to:

import MyApp from '@material-ui/monorepo/docs/pages/_app';
import { LicenseInfo } from '@material-ui/x-grid';

// Remove the license warning from demonstration purposes
LicenseInfo.setLicenseKey(
  '0f94d8b65161817ca5d7f7af8ac2f042T1JERVI6TVVJLVN0b3J5Ym9vayxFWFBJUlk9MTY1NDg1ODc1MzU1MCxLRVlWRVJTSU9OPTE=',
);

export default MyApp;

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Aug 2, 2020

@dtassone It seems that we could move forward with the approach. There is still a lot to clean up (+123k LOC diff is wrong, should probably be 1/10 that figure), but a possible architecture is in place:

  1. Install mui-org/material-ui as a dependency under @material-ui/monorepo
  2. Use the sources from the mono repo for all the modules we want to share (prettier scripts, eslint config, documentation components, test scripts etc)
  3. Have a new and second documentation website, hosted on material-ui-x.netlify.
  4. Have the pages we are interested into proxied. We would have material-ui.com/components/data-grid proxy to material-ui-x.netlify.app/components/data-grid.

Et voilà, we can focus on building features, not infrastructure :D.

Advantages

  • High consistency, we enforce with code that the two repositories stay aligned.
  • Low effort, high impact, it should quickly work.

Drawbacks

  • We will need to be careful with the versions of the dependencies, probably have to replicate what the docs folder has in the mono-repository anytime we update.
  • Adding new pages will require to send a pull request on mui-org/material-ui as the source of truth for the overall navigation (sidenav + proxy). Hopefully, this is not everyday we add new documentation pages to cover new features.
  • Can be seen as "dirty" as we transpile the node_modules/@material-ui/mono folder.

Overall, I think for us, it worth it. Thoughts?

@oliviertassinari oliviertassinari changed the title [core] Try with mono-repo as git dependency [core] Use mono-repo as source of truth Aug 4, 2020
@oliviertassinari oliviertassinari changed the title [core] Use mono-repo as source of truth [core] Use main repo as source of truth Aug 4, 2020
@oliviertassinari oliviertassinari force-pushed the mono-repo-git branch 2 times, most recently from 9ee5b33 to a2185c4 Compare August 4, 2020 23:33
@eps1lon
Copy link
Member

eps1lon commented Aug 4, 2020

Have you considered using git submodules instead?

@oliviertassinari
Copy link
Member Author

Have you considered using git submodules instead?

@eps1lon I haven't seen git submodules in use since my first internship in the industry in 2014 but that doesn't mean they can't be a better solution to documenting the components. I'm looking into it.

@eps1lon
Copy link
Member

eps1lon commented Aug 5, 2020

I used them for https://github.com/eps1lon/material-ui-playroom to use the docs demos. Maybe something similar works too. Probably easier to handle than the indirection with another repo that needs to be published.

@dtassone
Copy link
Member

dtassone commented Aug 5, 2020

I think this is a great temporary solution.

I tend to think that we should rethink the solution as a whole, Core, docs, and X.

I wouldn't spend more time on this, for now, as the solution will get to where we want.

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Aug 5, 2020

For the little exploration I did with git submodules, it seems to shine especially in the case where work is required in material-ui in order to accommodate for constraints of material-ui-x. Is this a case we should optimize for? Not sure it will be very frequent. Outside of that, I didn't find anything (yet?) that is significantly better.

Also, it seems that we can switch between yarn git and git submodules without a massive refactorization, so maybe we could keep the same direction and course correct if we hit something compelling enough to switch later on?

@oliviertassinari oliviertassinari force-pushed the mono-repo-git branch 4 times, most recently from a11e460 to 467b121 Compare August 6, 2020 22:10
@dtassone
Copy link
Member

dtassone commented Aug 7, 2020

Nice one 👍

@oliviertassinari oliviertassinari merged commit 1e17c08 into mui:master Aug 7, 2020
@oliviertassinari oliviertassinari deleted the mono-repo-git branch August 7, 2020 10:57
@oliviertassinari
Copy link
Member Author

I'm not sure if the best part of the pull request is the −2,180 deleted lines (e.g. with eslintrc) or the fact that we have most of the infrastructure to put the documentation in production.

@dtassone
Copy link
Member

dtassone commented Aug 7, 2020

Infra for doc 👍
eslintrc cleanup is the extra bit :)

@oliviertassinari
Copy link
Member Author

@dtassone Should I migrate the first page, as an example so we can then parallelize the work?

@dtassone
Copy link
Member

dtassone commented Aug 7, 2020

Sounds like a plan 😄

@oliviertassinari oliviertassinari added the core Infrastructure work going on behind the scenes label Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants