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] Folder structure proposal #3670

Closed
alitaheri opened this issue Mar 12, 2016 · 12 comments · Fixed by #3749
Closed

[Core] Folder structure proposal #3670

alitaheri opened this issue Mar 12, 2016 · 12 comments · Fixed by #3749

Comments

@alitaheri
Copy link
Member

After having a good discussion with @mbrookes we came up with this proposal on how we should structure our folders to make imports easier and to express what's internal and what's not:

src/
  - internal/
    - styles/
      - transformers/...
    - InkBar.jsx
    - EnhancedButton.jsx
    - ...
  - TextField/...
  - GridList/...
  - Toolbar/...
  - ToolbarTitle/...
  - getMuiTheme/...
  - colors.js
  - index.js
  - MuiThemeProvider.jsx
  - muiThemeable.jsx
  - ...

Some notes:

  1. No more styles and utils under the src folder!
  2. Everything internal with any structure will go in the internal folder
  3. Everything public will go in the src folder with flat structure
  4. Utility modules will be files under the src folder
  5. Components will have their own folder under the src folder
  6. All internal shared components will go under the src/internal folder

This will help us easily write publish script to put everything under the root folder before publishing.
And the end result will have absolutely flat structure, helps users do this:

import {cyan500} from 'material-ui/colors';
import TextField from 'material-ui/TextField';
import TextField from 'material-ui/TextField/stateless';
import MuiThemeProvider from 'material-ui/MuiThemeProvider';
import muiThemeable from 'material-ui/muiThemeable';

Ain't that beautiful? @callemall/material-ui? 😍

@oliviertassinari
Copy link
Member

I really like this idea.
Regarding the publish script and the folder organization for the releases. What do you think about having everything under a packages folder?
That would looks like:

    packages/
      ├── material-ui/
      |  ├── TextField/
      |  ├── Toolbar/
      |  ├── ...
      ├── eslint-plugin-material-ui/
      |  └── ...
      └── material-ui-native/
         └── ...

@alitaheri
Copy link
Member Author

even the docs site 👍 I really like this 👍 👍 😍

@oliviertassinari oliviertassinari added this to the 0.16.0 Release milestone Mar 12, 2016
@nathanmarks
Copy link
Member

@oliviertassinari I think that's a great idea!

@nathanmarks
Copy link
Member

@alitaheri Thanks, this is looking awesome 👍

Let me know if you need any hand with a publish script etc

@mbrookes
Copy link
Member

@oliviertassinari I must be missing something here. What do we get by nesting everything under packages that we don't already get with everything nested under /?

    /
      ├── material-ui/
      |  ├── TextField/
      |  ├── Toolbar/
      |  ├── ...
      ├── eslint-plugin-material-ui/
      |  └── ...
      └── material-ui-native/
         └── ...

(Other than renaming src to material-ui...)

@oliviertassinari
Copy link
Member

What do we get by nesting everything under packages

Aside from being more coherent with React and Babel, we get that people can expect everything inside the packages folder to be an npm package.
So I think that it's cleaner and more intuitive.
I don't think that we will have as many folders as Babel, but how knows?

@newoga
Copy link
Contributor

newoga commented Mar 13, 2016

What do you think about having everything under a packages folder?

Yeah this is what I had in mind too 👍: https://github.com/newoga/material-ui/tree/monorepo-directories/src/packages/material-ui

I would even consider not having the /internal folder but have something like a material-ui-internal or material-ui-utils package in the packages folder. It'd be better if people didn't even have access to those files/components when they were importing from 'material-ui' 😉

I think we can borrow the project structure and scripts pretty heavily from recompose, I think it does a pretty good job setting this up.

@mbrookes
Copy link
Member

: https://github.com/newoga/material-ui/tree/monorepo-directories/src/packages/material-ui

Without /src though, right?

/packages/material-ui replaces /src...

@newoga
Copy link
Contributor

newoga commented Mar 13, 2016

I'm fine without /src. Recompose uses a base /src/packages folder, React uses a base /packages folder. I say we pick the best of both and whatever makes sense for us 😄

@mbrookes
Copy link
Member

Going back to the original proposed structure, where do the base themes go? Not internal/styles/baseThemes that's for sure!

/themes?

(and presumably getMuiTheme also goes in root?).

@alitaheri
Copy link
Member Author

@mbrookes The lightBaseTheme doesn't really need to be external as it's the default, how about just putting the dark on the root, and the lightBaseTheme... well we shove it in getMuiTheme 😆

I was also thinking, there is no need to have spacing, zIndex, typography files while we can just put them inside the getMuiTheme!

(and presumably getMuiTheme also goes in root?).

true

@mbrookes
Copy link
Member

@oliviertassinari Sorry, I had closed in favour of #2679, but you're right, this is a subset of that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants