How to use NX like Lerna?

155 views Asked by At

my goal is to create Monorepo. I am an Angular Developer, so I expect to start my first project as Angular. But in the future I expect other developer to may use React/Next.js. The point is: I do not want to constraint my developer to a specific framework.

My definition of a Monorepo is as follow:

  1. Each project should have its own package.json with expectation:

    1. a remote can be an Angular 15 / 16, React, Next.js.
    2. a host can share state between remote.
  2. (optional) I hope I can put the backend in this repo as well. So we can avoid "version difference between Frontend and Backend" and other things such as "this model is outdated, and no one know about it"

  3. host-project1 -> Angular 16 application.

    1. route to landingEditor.
    2. route to searchEngine.
    3. route to editor.
  4. landingEditor -> Angular 16 application.

  5. searchEngine -> Angular 16 application.

  6. editor -> Angular 16 application.

What I've tried:

  1. I can use Angular Workspace to create the Angular applications. Then, I can create host-project1 Angular application with only 1 responsibility: to route to the Angular applications.

    The problem is host-project Angular application route to the source code of these Angular applications. This violates my definition of monorepo. "To make development faster, a developer can choose to run specific Angular application (i.e. just the landingPage) and still access it through host-project1".

    Proof of concept

  2. Use NX

    The problem is I do not see package.json in each of the remote folder. In the future, I expect that we run different version of Angular, and sometime maybe use React or Next.js. This is where Lerna shine, but I read that Lerna is taken over by NX.

    Proof of concept

What I am planning:

  1. Use Lerna.
0

There are 0 answers