Search code examples
react-admin

Install React-Admin package from specific branch or with open pull request


I am having difficulties trying to install a development branch of React-Admin packages with NPM in an active project, specifically:

  • ra-tree-ui-materialui
  • ra-tree-core

To have the changes made in this PR https://github.com/marmelab/react-admin/pull/3379

Is there any way of doing this in a similar way to how you normally would put this in package.json ("username/repo#branch")


Solution

  • It is difficult to install a local version of one of React Admin's package, because we use a mono-repository that contains all the packages.

    I see two solutions to your needs.

    Install the alpha builds

    The core team had just published an alpha for the next version of React Admin. It's not stable yet, but you can try it by running :

    npm install --save ra-tree-core@next
    npm install --save ra-tree-ui-materialui@next
    

    Install a local version for development

    If you want to tweak the React Admin packages while you are using them, you can fork the whole repo and use symbolic links.

    # On a separate folder
    git clone [email protected]:marmelab/react-admin.git
    cd react-admin
    make install
    make build
    cd packages/ra-tree-core
    npm link # This will make this package available for linking
    

    And on your project, then run:

    npm link ra-tree-core
    

    This will create a symbolic link between your local ra-tree-core and your node_module folder.

    I showed these examples with npm, but yarn link works too.