Render and Nx
I’m currently using two mono-repos, both of them use Nx. While Nx supports both integrated and package based setups. Render is made to support package based mono-repos, but not integrated ones. I think it’s a good idea to mention this or at least support Nx. When I deploy my Nx mono-repo I have to keep the root directory, then specify where the build folder is. I also have to specify the build command.
An Integrated Mono-repo is a repo that only has one node modules folder and uses that one to support multiple projects. Nx uses this concept as the main way of creating mono-repos. It also supports package-based mono-repos but I’m not using that. The way render decides what build command to execute is based off which package manager you are using, it does not detect Nx at all.
I’m asking for it to detect mono-repo tools as well. I want to be able to tell it whether I’m using something like Lerna or Nx.
Nx uses a nx.json
file for the project root and project.json
files for each project in a repo. Nx can also auto-detect scripts based on the package.json
files available. Most Nx projects will have them.
A nx.json
file is a file that is used to tell Nx how commands are supposed to be used. It’s the file that tells it all the plugins that are being used. It has the configuration for all the commands that are used in the repo., It also has the name of the repo it’s called the "npmScope"
.
A project.json
file is a file that tells Nx information about a project that is in the repo. It has all commands inside of it. This is the file that can be used to detect where the build command is. There are two important properties in this file. The projectType
it specifies that the project is either an app or a library. The second configuration is called the sourceRoot
. It tells Nx where the source file is starting from the root.
How to support Nx
To support Nx the user can specify whether they are using a mono-repo or a standalone app. Then they could specify which mono-repo tool they are using. If they are using Nx Render can detect this by using the nx.json
file. Then it can prompt the user for which project to deploy. The project name can be used for this. Nx runs commands by using nx run [Project Name]:[command]
. Render could also detect the names of each project by using the project.json
file and looking for the name:
property.
More Info
For more information you can go to Nx