NativeScript / nx

NativeScript for Nx.
Other
61 stars 15 forks source link

[Question] shared core codebase with different {N} frontends for mobile? #20

Open lambourn opened 3 years ago

lambourn commented 3 years ago

I wonder if this Nx plugin could satisfy the requirement to create multiple variants of a {N} application where core parts (non-UI) are shared and the concrete variants have custom (Angular) application tier logic and UI.

The variants would need their own metadata (final app name, signing, bundle identifiers, package names, etc.) so they would come with their own build & packaging time configuration (Info.plist, AndroidManifest.xml, code signing etc.)

Would that work?

mahmoudajawad commented 3 years ago

I'm working on something similar now. This is one of the reasons I'm so excited about having the ability to use nativescript with nx. Basically, you can have your business-logic abstracted as shared lib and then your apps would be simple presentational components that do only pass the input values to the business-logic shared lib, and receive back the results and present them to the user.

sergegl commented 3 years ago

I'm working on something similar now. This is one of the reasons I'm so excited about having the ability to use nativescript with nx. Basically, you can have your business-logic abstracted as shared lib and then your apps would be simple presentational components that do only pass the input values to the business-logic shared lib, and receive back the results and present them to the user.

I was thinking of separating into a base libs as well. However, since we have bunch of angular web apps, I am thinking of using web apps as the base classes for mobile apps.

mahmoudajawad commented 3 years ago

@sergegl, you know your project better and can decide, but the idea of using an app as base for another seems risky for many reasons, such as, web implementations are not available in NativeScript (which you would hit sooner than later), and ending-up with much fragile codebase that tries to work with two platforms rather than having good separation of concern across the apps.

Shared lib in the other hand asserts you don't hit this issue, because you will always abstract the part of the business logic that is platform-non-independent, while keeping your platform-specific parts at apps.

mahmoudajawad commented 3 years ago

@sergegl, I was able to produce a PoC. Mainly, in my team we are investigating the best approach and so far this is what we are at, though we might consider other approaches. For now, I'm sharing this with you to give you an idea about the approach I WA suggesting: https://github.com/mahmoudajawad/nx-ns-shared