Giter Club home page Giter Club logo

Comments (8)

johannesschobel avatar johannesschobel commented on August 18, 2024 3

I will just add some more thoughts on this - maybe you are willing to contribute and share your opinions?

I am thinking about using a Monorepository approach to build my next project. However, i am currently stuck between Lerna and nrwl/nx - obviously, both are quite awesome.

nrwl/nx

Pros

  • Very easy-to-use console commands to create apps & libs. Everything is automatically wired up by the framework - no manual tasks
  • powerful schematics
  • very tightly coupled with angular (well, you can also list this as a con 😆 )
  • provides a clear structure for the repository (and apps and libs)

Cons

  • only one "big" package.json file that contain all dependencies from all apps / libs in your project. This may become huge very fast. Furthermore, it does not allow to use different versions of the same library in different apps (because everything is managed within one single package.json file)
  • you cannot have different "build scripts" (or rather - the overhead to do so is very high!)

Lerna

Pros

  • seems very battle tested and follows a more "each package is a separate buildable / deployable entity" approach (e.g., each package has its own package.json file to manage their own dependencies).
  • libs are more reusable (e.g., all dependencies are directly managed by the lib itself)

Cons

  • more "manual" work (e.g., wiring it all together)
  • no explicit project / package structure given
  • using different package.json files may dramatically increase the required disk space

What is your opinion on this? Can you provide more pros / cons on both approaches / frameworks?
All the best and thank you very much for your time and effort,

from ngx-starter-kit.

xmlking avatar xmlking commented on August 18, 2024 2

now we have dedicated package.json files for workspace, webapp and API app.

from ngx-starter-kit.

xmlking avatar xmlking commented on August 18, 2024 1

this is an other motivational blog...
https://medium.com/naresh-bhatia/sharing-ui-components-with-lerna-and-yarn-workspaces-be1ebca06efe

https://medium.com/@zachary.n.feldman/harmony-with-angular-lerna-and-yarn-workspaces-6a7394f08da

from ngx-starter-kit.

xmlking avatar xmlking commented on August 18, 2024

I am also thinking in this line. we already have package.json for publishable lib modules e.g., ngx-utils, led etc. I wanted to have app specific package.json for apps/api, apps/webapp ,apps/mobile as they generally don't share dependencies and one workspace level package.json with common dependencies.
For this I have to switch to Yarn Lerna. at this moment I wanted to keep it native to node and default npm for package management.

on the pro side if we split package.json at apps level, we could have faster CI/CD builds and docker multistage builds

from ngx-starter-kit.

johannesschobel avatar johannesschobel commented on August 18, 2024

Dear @xmlking ,

yeah, i think, switching to Lerna may be a good idea, because this would

  • reduce the build-time and -resources
  • make it possible to "update" specific dependencies per project / app / library (e.g., lib1 may use dep1.0 and lib2 may use dep2.0). So it would be possible to "incrementally" update applications / dependencies more easily..
  • you could build, test, ... each library / application more easily

Do you consider switching? because this starter package is actually really (!) awesome.. And i would love to have such an awesome angular-nestjs-whatever-starter package with Lerna ;)

from ngx-starter-kit.

xmlking avatar xmlking commented on August 18, 2024

Lerna is splitting package.json , nrwl/nx is angularCli++
I think we could use both together. I have to research.

from ngx-starter-kit.

johannesschobel avatar johannesschobel commented on August 18, 2024

oh.. using Lerna and nrwl/nx together may be an awesome idea.. Don't know if this works.. But using the best from both worlds may be really cool..

Maybe these articles / issues / comments are helpful:

You can add lerna. Nothing in the nx workspace prevents you from using it.

In fact, after a lot of tests, both with lerna and workspaces, my conclusion is that we don't need such tools, even if we have package.json files for the libs we build with ng-packagr and publish on our npm repository.

As in some articles the use of git submodules is mentioned. I would suggest to not follow this git submodules approach because the use of submodules may get very dirty ;) But that's just my opinion...

To be honest, after reading so much about lerna and nx, i am not sure which approach is better.. For now, I am considering the following stack:

  • angular for the web frontend,
  • nestjs as a backend and
  • ionic for smart mobile devices

My main concern is, that ionic 4 (latest version) just switched to angular 7, which may be "outdated" in a few months because angular 8 is just around the corner (beta already started).. So i think, having independent package.json files may be benefitial, because you would not be able to upgrade the main web application to angular 8 until ionic supports it..

All the best

from ngx-starter-kit.

xmlking avatar xmlking commented on August 18, 2024

@johannesschobel we got experimental integration of Lerna with this commit. I also switched to Yarn from default npm

please test and let us know...

0b53f15

from ngx-starter-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.