nx
nx copied to clipboard
NX does not work against a multirepo set up
We love nx but one of our largest projects has a multirepo set up that we must maintain for some time.
Current Behavior
nx appears not to recognize the packages under our multirepo project
- nx graph is empty
- commands wont run
- no nxdeps.json is generated
- etc
Expected Behavior
Based on my limited dive into the nx code, it seems like the git commands run would be ok in either a monorepo or a multirepo set up
Steps to Reproduce
Our workspaces are internal but found one on opensource that also reproduces the issue and adjusted it to make it more like our internal one: https://github.com/csgibson/nxtest The readme there has some steps to recreate the issue
Failure Logs
Environment
> nx "report"
> NX Report complete - copy this into the issue template
Node : 16.15.0
OS : linux x64
pnpm : 7.11.0
nx : 14.7.5
@nrwl/angular : Not Found
@nrwl/cypress : 14.7.5
@nrwl/detox : Not Found
@nrwl/devkit : 14.7.5
@nrwl/eslint-plugin-nx : Not Found
@nrwl/express : Not Found
@nrwl/jest : 14.7.5
@nrwl/js : 14.7.5
@nrwl/linter : 14.7.5
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : 14.7.5
@nrwl/nx-cloud : Not Found
@nrwl/nx-plugin : Not Found
@nrwl/react : Not Found
@nrwl/react-native : Not Found
@nrwl/schematics : Not Found
@nrwl/storybook : Not Found
@nrwl/web : Not Found
@nrwl/workspace : 14.7.5
typescript : 4.8.3
---------------------------------------
Local workspace plugins:
---------------------------------------
Community plugins:
slack ref: https://nrwlcommunity.slack.com/archives/CMFKWPU6Q/p1663264619089729
Hiya ! I feel this is another instalment of #5214 ? I don't believe there is any way around the problem at the moment. Hopefully this gets on Nrwl's radar in the short future.
Ahah! I found your issue.
First, I wouldn't recommend simply doing a git clone
in a gitignore'd
directory. Rather I would use git submodules. Which achieves something pretty similar. We'll return to this in a bit.
The reason why Nx can't find your project, is because it is gitignored. Therefore, nx also ignores it.
Now, if we go with git submodules.. instead of running git clone
in the workspace
directory, we can do this from the root instead:
- Remove the
workspace/*
line from.gitignore
. - Run this
git submodule add https://github.com/ngageoint/opensphere workspace/opensphere
which will "clone" the repository into the workspace/opensphere directory. However, it will not commit all the files in the repository. Rather, git will track the history in a separate repo. - Run
nx graph
, your project is now there! :tada:
I suggest you read up more here.
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.