Skip to content

Improve CONTRIBUTING.md #14760

Closed
Closed
@Yzrsah

Description

@Yzrsah

If we can make it easier to contribute to Material-UI, then it could help the project with more contributions.

  • There is no web page with reproducible steps for making a working dev setup.
  • CONTRIBUTING.md has incomplete information for making a link-able dev setup, only making reference to tell you that you should use yarn link.
  • The material-ui workspace does not have scripts to produce a link-able build.
  • A new contributor must spend days debugging imports, following errors, writing build scripts, opening issues, etc.
  • To get started

The script

This is not documented:

curl https://codeload.github.com/mui-org/material-ui/tar.gz/next | tar -xz --strip=2 material-ui-next/examples/create-react-app-next
pushd create-react-app-next
    git clone https://github.com/mui-org/material-ui.git --branch next --single-branch --depth 1
    pushd material-ui
        yarn install
        yarn workspace @material-ui/utils build
        pushd packages/material-ui-utils/build
            yarn link
        popd
        yarn workspace @material-ui/system build
        pushd packages/material-ui-system/build
            yarn link
        popd
        pushd packages/material-ui-styles
            yarn link @material-ui/utils
            yarn build
            pushd build
                yarn link
            popd
        popd
        pushd packages/material-ui
            yarn link @material-ui/system
            yarn link @material-ui/utils
            yarn build
            pushd build
                yarn link
            popd
        popd
    popd
    yarn link @material-ui/core
    yarn link @material-ui/styles
    yarn link @material-ui/system
    yarn link @material-ui/utils
    yarn install
    npx yarn-list-link
    yarn start

All commands complete successfully and the dev server starts up, and then fails.

  • Is this script even correct?
  • How would a contributor know if it's correct or not, if it's not documented anywhere?
  • And if it's not automated in the workspace's "scripts":?
  • Is every contributor supposed to figure out the link-ed build dependency order so that the builds don't use the wrong links?
  • (The script failed)

Errors with relative imports outside of src/

./src/withRoot.js
Module not found: You attempted to import ../esm/CssBaseline/index.js which falls outside of the project src/ directory. Relative imports outside of src/ are not supported.

NextJs version errors with hooks invariant violation:

curl https://codeload.github.com/mui-org/material-ui/tar.gz/next | tar -xz --strip=2 material-ui-next/examples/nextjs-next
pushd nextjs-next
...
Note that pages will be compiled when you first load them.
{ Invariant Violation: Hooks can only be called inside the body of a function component. (https://fb.me/react-invalid-hook-call)
    at invariant (/Users/foo/Source/nextjs-next/material-ui/node_modules/react/cjs/react.development.js:88:15)
    at resolveDispatcher (/Users/foo/Source/nextjs-next/material-ui/node_modules/react/cjs/react.development.js:1436:28)
    at Object.useContext (/Users/foo/Source/nextjs-next/material-ui/node_modules/react/cjs/react.development.js:1441:20)
    at StylesProvider (/Users/foo/Source/nextjs-next/material-ui/packages/material-ui-styles/build/StylesProvider.js:56:37)
    at processChild (/Users/foo/Source/nextjs-next/node_modules/react-dom/cjs/react-dom-server.node.development.js:2871:14)
    at resolve (/Users/foo/Source/nextjs-next/node_modules/react-dom/cjs/react-dom-server.node.development.js:2795:5)
    at ReactDOMServerRenderer.render (/Users/foo/Source/nextjs-next/node_modules/react-dom/cjs/react-dom-server.node.development.js:3185:22)
    at ReactDOMServerRenderer.read (/Users/foo/Source/nextjs-next/node_modules/react-dom/cjs/react-dom-server.node.development.js:3144:29)
    at renderToString (/Users/foo/Source/nextjs-next/node_modules/react-dom/cjs/react-dom-server.node.development.js:3629:27)
    at render (/Users/foo/Source/nextjs-next/node_modules/next-server/dist/server/render.js:42:16)
    at Object.renderPage (/Users/foo/Source/nextjs-next/node_modules/next-server/dist/server/render.js:102:16)
    at Function.module.exports../pages/_document.js.MyDocument.getInitialProps (/Users/foo/Source/nextjs-next/.next/server/static/development/pages/_document.js:2256
:18)
    at Object.loadGetInitialProps (/Users/foo/Source/nextjs-next/node_modules/next-server/dist/lib/utils.js:45:35)
    at Object.renderToHTML (/Users/foo/Source/nextjs-next/node_modules/next-server/dist/server/render.js:106:36) name: 'Invariant Violation', framesToPop: 1 }

This can be improved

  • Can we make a testable, standardized script that will produce a working link-able local dev setup for Material-UI?

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsImprovements or additions to the documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions