tarsisexistence/routerkit

Support for Nx monorepo setup

Opened this issue · 1 comments

What is this feature?

When developing in a nx.dev monorepo setup the following setup is quite normal: An app has two (lazy loading) feature modules mounted:

  • BooksModule mounted under books
  • OrdersModule mounted under orders

In a loosely coupled way, both features contain components that point to components of the other feature. For example, books has a routerLink pointing to orders/new and orders/{orderId} has a routerLink which points to books/{bookId}.

One of the advantages of using nx.dev is that libraries (the feature modules) can be reused in multiple apps. Currently RouterKit supports generating routes based upon an Angular app, resulting in {ROOT}/{APP_NAME}.routes.d.ts. Referencing the routes created from app 'A' in a feature lib is actually putting the dependency the wrong way around. From the internal dependency graph which the nx.dev tooling creates for you, app 'A' is using the feature lib. With the (described below) new features RouterKit can (probably) be used in a nx-dev monorepo setup.

How the feature should work?

I think the following is needed so RouterKit can be used in a nx-dev monorepo setup:

  • support for generating routing types for a lazy loaded feature lib (it currently does not support it, an error is thrown: Can't find file with relative path @my-solution/app/feature/feature.module.ts)
  • configuration of the output path of the resulting routing types, as they probably should end up in a separate library so nx.dev tooling can determine the dependency graph properly

Is your feature request related to a problem?

Yes, it's described in issue #49.

@JoepKockelkorn thanks

We will back to this after major release 😊