Is it possible to use different apps as git submodules in a nx workspace?
Asked Answered
T

1

17

I want to build a nestjs backend which is used by a angular frontend application. Each of them for now in a single repository. I stumbled over nrwl-nx for monorepo tooling and am really intrigued to use it.

But my question now is: is it possible to have different apps in the workspace, but each as an own git submodule? Like so:

workspace_folder
|- apps
|  |- application1 <--- git submodule 1
|  |- application2 <--- git submodule 2
|- libs
|...

How would the process be to set them up correctly? Can it be done completely by the nx CLI? I couldn't find anything specific to that in the nx documentation.

Twig answered 4/3, 2020 at 12:52 Comment(1)
And maybe you find a solution for that problem?Resorcinol
P
5

Yes! I believe you can do this using Yarn workspace in conjunction with Nx tooling.

So in essence you need to navigate to your apps folder and run:

  • git submodule add https://github.com/[URL for your application 1] application1
  • git submodule add https://github.com/[URL for your application 2] application2

More Details here: https://blog.nrwl.io/dev-workflow-using-git-submodules-and-yarn-workspaces-14fd06c07964

An example will be like this: https://github.com/nrwl/nx-example-multirepo

Prussianism answered 9/8, 2021 at 14:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.