Let’s pretend I’ve decided to manage my JavaScript projects with package managers.
I’ve done some programming projects before, and I think I have a pretty good idea of what I need: Node.js, a simple package manager, maybe npm
, yarn
, or something like that.
If I were going to manage multiple large-scale projects, rather than just a small app, I’d still need a package manager to handle dependencies, versioning, and scripts (among other things).
So, I go to the Node.js documentation to find out which package manager I should use, and I ask the community, “Hey, which package manager should I start with?”
“npm
?” someone asks. “Well, that’s kind of old-fashioned now.”
Surprised, I ask why.
“Well, the problem with npm
is that it’s quite basic. You install a package, but it doesn’t have the fancy features some people need for complex projects. What if you later decide you need better caching, multiple workspaces, or more advanced dependency management? You’d need to switch to a different package manager.”
“Hmmmmmm. Well, I suppose that makes sense. So what should I use?”
“Try yarn
,” they suggest. “It’s got lots of extra features, better speed, and supports workspaces.”
“Okay, sounds great. Where do I get yarn
?”
“Actually, we don’t recommend regular yarn
anymore. Now there’s Yarn Berry!”
“Yarn Berry? What’s that?”
“Yarn Berry is a package manager package manager! Not only does it handle all your dependencies, but it also allows you to install multiple versions of itself. It’s faster, stricter with dependencies, and gives you a whole new level of control.”
“So, it’s the new standard?”
“Well… it’s a bit more complex, and not all tools support it yet. Plus, it comes with its own new configuration files, plugins, and sometimes requires a custom shell.”
“That sounds… a bit much.”
“Actually, managing multiple versions of a package manager with a package manager isn’t for everyone. So, now we have corepack
.”
“Corepack? What’s that?”
“Corepack is a package manager package manager package manager. It allows you to manage different package manager package managers like yarn
, npm
, and pnpm
. With corepack
, you get ultimate flexibility for all your package manager needs.”
“So, where do I find corepack
?”
“It’s bundled with Node.js now, but you still need to manually enable it and configure it to choose the right package manager package manager for each of your projects.”
“I see…”
“But wait! Managing a package manager package manager package manager is too much hassle for many users. So, what you really need is a version manager for Node.js itself. That’s where nvm
comes in.”
“But I just wanted to install a few packages for my project…”
“Don’t worry! nvm
is a version manager for Node.js, which allows you to switch between different versions of Node.js. It’s essential for managing your Node.js environment. You’ll need to set it up in your shell, and it you will run it every time you switch directories.”
“So, no simple package managers at all?”
“Nope! If you want to manage a modern JavaScript project, you desperately need something more advanced than a simple package manager.”
“And everyone is doing it this way?”
“Absolutely.”
“Well… all right. If this is the way things are done now, I guess I’d better learn how to do it.”
“Great attitude! Just don’t forget to start by reading all the GitHub issues, even the closed ones.”
“This thing comes with documentation, right?”
▧
Comments
There are no comments yet.
Please discuss this topic anywhere and let me know any great comments or media coverage I should link here.