Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reverted from v. 2

...

POC Analysis Overview

POC BRANCH IS AVAILABLE HERE

What we've done

Standalone migration

...

Benefits

  • Easier future refactorings

    • Moving to other folders

    • Moving to libraries (nx)

  • Smoother learning curve for new devs

    • Junior devs don’t have to understand or see what SharedModule has imported and exported

    • Easier to reason about what the components depends on

  • Easier lazy loading

    • Before standalone we couldn’t safely lazy load a component without also loading it’s module (missing providers), while now we can lazy load them and be sure that it won’t break at runtime

    • Easier routing lazy loading per component using loadComponent

    • No need for {FEATURE}RoutingModule to do lazy loading of routes

  • Better compilation time

    • Because the angular compilation scope will have to compile everything that’s changed, when using a SharedModule all the components will be affected if we change a component, while when using standalone the compilation is optimized because only that component and its dependants will have to be compiled.

...

Angular CLI is great, until the project becomes too big and compilation time reaches 15 minutes and ng serve takes 4 minutes. That’s not Angular’s fault, but just current tools being used by Angular CLI to compile our apps. The solution to performance for almost all things in programming is caching. Angular CLI does implement caching in cold builds (filesystem caching), but it’s not enough to fix our issue. Here comes NX, NX in the beginning was just Angular CLI on steroids, but it has grown to be much more than that. With NX we can create libraries that have their own compilation scope, and that need to be compiled only when changed, and their compilation result will be re-used until it’s changed again.

...

If we chunk our app into smaller buildable libraries we can shrink down that compilation time from 15 minutes to 2-3 minute in best case scenarios.

...

Parallel builds

...

Build graph tools

...

Task orchestration

...

Issues with the migration and possible roadmap:

...

We have a big SharedModule and CoreModule that depend on each other, so migrating these to libraries is not easily doable without the standalone migration.

...

We have to start with components or util function that don’t depend on anything else except themselves (finding root files) and they are not so easy to find in this big project

...

We have to define the folder architecture we want to follow based on our needs

...

It will move a lot of files around in folders, so maybe this is an issue for clients that have extended Dspace in their own branches (syncing repos becomes harder)

...

It is hard to chunk services as they have a lot of hidden deps because of module providers

...

Things to keep in mind:

Image Removed
Image Removed