geerlingguy / drupal-vm

A VM for Drupal development
https://www.drupalvm.com/
MIT License
1.37k stars 647 forks source link

Add yarn to list of installed_extras #1128

Closed heddn closed 7 years ago

heddn commented 7 years ago

Issue Type

Feature Idea

Your Environment

n/a

Your OS

n/a

Full console output

Summary

Based on the docs @ https://yarnpkg.com/en/docs/install, they recommend installing the software globally, instead of via an npm global package. For now, I'm using

nodejs_npm_global_packages
  - name: yarn

But here's a request to add yarn as a package in the list of installed_extras.

Why yarn? There's a lot circulating about it, but https://platform.sh/2016/11/platformsh-yarn/ is a recent post that does a good job explaining why.

geerlingguy commented 7 years ago

Here's the only philosophical reason I'd argue against it.

In the beginning, there was npm. Then there was bower. Then there was gulp and grunt, which aren't the same thing at all but are confused all the time. Then there was webpack. And browserify. And now there's yarn.

I think every single project I've worked on with a more structured theme has used an entirely different setup when it comes to a dependency manager and a task runner. And sometimes it uses the same thing for both. Or it uses two package managers. Or it uses one package manager to install another one. And to install two task runners.

Or there's a task runner that installs a dependency manager.

What guarantees do we have that yarn won't be re-subsumed by npm again once someone decides to improve npm and make yarn more or less useless?

And npm-cache seems to be a decent way to stick with npm but with the speedups yarn promises, right?

In most software communities, the community decides that building twenty different package managers that have identical features is a waste of time... and then one rises above the rest (PHP/Composer, Python/Pip, Obj-C/CocoaPods, Ruby/Gem, Java/Maven, etc.).

Yarn does seem like the new hotness in the frontend dependency management world. But Bower was just a couple weeks ago...

geerlingguy commented 7 years ago

Basically, I can easily see everyone using Yarn jump right back to using NPM again (just like what happened with Bower) within a year or two, once NPM's maintainers decide to incorporate caching directly into NPM.

geerlingguy commented 7 years ago

Sorry for the rant... just the Node community's fickle behavior annoys me to no end :P

heddn commented 7 years ago

Thanks for the rant. I was a little hesitant to suggest adding yarn. However, I'm still using bower for js assets. I have a lot more flexibility with it than with npm.

geerlingguy commented 7 years ago

@heddn - No problem; I think it's still too project-specific to be a default. And sometimes I like to sneak in defaults that I think would be 'best practices'. It's just too early in yarn's lifetime to determine whether it will subsume npm usage or not :/