3

Please excuse the "photo of my monitor" picture, but it really was the easiest way to do this...

So, I'm finally getting around to that to-do list item of wrapping my head around Nrwl Nx workspaces, and I stumbled onto this little gem: https://itnext.io/easy-typescript-m...

I didn't take long for the "what the fuck" moments to start cropping up, and then I decided to check what comments might have been left on Daily.dev regarding this one (see attachment).

THAT little nugget there is what led me to the ultimate "what the actually fuck" moment, which is only truly appropriate for DevRant..

Create an Nx workspaces, only to initialise a project with `npm` directly, using a path under a new `libs` folder, next to the `packages` folder, only to build the library, and literally install it into the Nx workspace's `node_modules` folder, b order to import it into the app that exist in the same workspace.

So, seriously.. like.. WHAT THE ACTUAL FUCK? What is this guy smoking?? I need to know so I can stay the fuck away from it! Wow. My brain hurts now.

Comments
  • 1
    Oh dear good, I just realised.. isn't this just more of the shite that the public ChatGPT service was trained on..? Maybe we are all just doomed after all.. lol.
  • 2
    I remember trying to use Nx / Nrwl thing once, and within the first 15 minutes I was browsing unresolved GitHub issues to at least figure what I was doing wrong and why the provided boilerplate didn't start. In the end I gave up and went with Yarn (2+) workspaces for the monorepo.
  • 1
    TLDR please for the non node folks ?
    I keep hitting a paywall on the medium article.
  • 1
    @beefdead random tip, if you open Medium backed articles in an incognito tab, it can't track your monthly views. (:

    But basically, `nx` by Nrwl has one way of doing a monorepo, and has been around for a long time. It's also not the first, not will it be the last, "monorepo system".

    As of `npm@7`, it also now has "workspaces", allowing multiple separate projects in one repo.

    So, the guy behind this article creates an Nx workspace, with an Nx generated app, and instead of an Nx generated library (of ANY project type), he creates a NPM module in a path nested alongside the Nx projects.

    This module is built, and installed into the Nx workspace dependencies... So that it can be imported into the Nx generated application.

    🤔
  • 0
    @hitko can't fight you on that one, I like the way yarn does workspaces.. it makes it just as easy as a non-"monorepo" project.

    I also really like the generators in Nx though. It does look like a crapload of boilerplate config, because.. I guess.. it actually is. But, it's not "boilerplate config" that you have to write.

    My personal view is that they all have their place, their strengths and weaknesses. This is just a stupid use of an NPM workspace. The Nx library can be imported into the application directly and automatically by name, namespaced to the workspace root.. it's literally that simple.
  • 0
    BUT most of all, that comment.... Seriously? 🤣🤣😅😂🤣
  • 0
    @ZaLiTHkA thanks for the tip. :)

    So, nx just reinvented the wheel with the new wheel having no upside. 😅
Add Comment