xmlking / ngx-starter-kit

:a: Angular :rocket: NestJS :monkey: Starter Kit
https://xmlking.gitbook.io/ngx-starter-kit/v/develop/
MIT License
587 stars 130 forks source link

[Question] Dedicated Package.JSON Files? #30

Closed johannesschobel closed 5 years ago

johannesschobel commented 5 years ago

Hey @xmlking ,

i was just wondering, if it would be benefitial to have dedicated package.json files in each \libs and \apps folder (i.e., each app handles their own dependencies). Is there a specific reason, why you don't follow this approach?

All the best and thanks a lot for your time and effort

xmlking commented 5 years ago

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

johannesschobel commented 5 years ago

Dear @xmlking ,

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

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 ;)

johannesschobel commented 5 years ago

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

Cons

Lerna

Pros

Cons

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,

xmlking commented 5 years ago

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

johannesschobel commented 5 years ago

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:

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:

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

xmlking commented 5 years ago

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

xmlking commented 5 years ago

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

please test and let us know...

https://github.com/xmlking/ngx-starter-kit/commit/0b53f15b20289d80ed14c62e43eef816ffec1a6b

xmlking commented 5 years ago

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