nstudio / xplat

Cross-platform (xplat) tools for Nx workspaces.
MIT License
368 stars 52 forks source link

[Feature Request] Group Libraries by Feature #244

Open wSedlacek opened 3 years ago

wSedlacek commented 3 years ago

The problem

Right not libraries are grouped by platform with the base not having a sub directory.

libs
- core
- scss
- features
  - users
- nativescript
  - core
  - scss
   - features
     - users
- web
  - core
  - scss
   - features
     - users

This places the features/users in 3 distant locations which while on a command line isn't a problem but when looking at the tree in an IDE it feels a bit disconnected.

The Request

It would be my preference to have it grouped by feature which would look something more like this.

libs
- core
  - base
  - nativescript
  - web
- scss
  - base
  - nativescript
  - web
- features
  - users
    - base
    - nativescript
    - web

Additional context

As an aside, I believe group this way would better balance the opinions of xplat's structure with other patterns like DDD. For example DDD with xplat might look something like this.

libs
  - booking
    - domain
    - api
      - base
      - nativescript
      - web
    - feature-manage
      - base
      - nativescript
      - web
  - boarding
    - domain
    - feature-cancel
      - base
      - nativescript
      - web
    - feature-search
      - base
      - nativescript
      - web
  - shared
    - domain
    - core
      - base
      - nativescript
      - web
    - ui
      - common
        - base
        - nativescript
        - web
      - scss
        - base
        - nativescript
        - web
    - utils

This pattern feels a lot more familiar with me personally as I come from other library frameworks. I suspect others will feel the same. It would be super cool if other schematics like DDD could enhanced via Higher Order Functions to simply split each library they generate by platform. domain modules are platform agnostic so they would not be split. It would be my expectation that many of the items currently in core of xplat (like services, environments, etc.) would be moved to shared/domain with them being exposed to applications via shared/core/<platform>

User Story

As a full stack developer, I want to have a single folder for a given feature, because the specific feature is more important to me than the platform that feature is for.

kattsushi commented 3 years ago

nice to have!

csimpi commented 3 years ago

as a full-stack, this makes much more sense for me too