0

I was taking a look at the react slingshot starter kit and I couldn't understand why the project uses npm and yarn at the same time.

The repo's url is: https://github.com/coryhouse/react-slingshot

Can someone give me an explanation about that?

I heard that if you have yarn.lock (as the project does) you should use yarn. However all the command line commands are based on npm. Why?

Vikas Yadav
  • 3,094
  • 2
  • 20
  • 21
Leoni
  • 116
  • 9
  • It doesn't really make a difference what you use. – Marco Dec 27 '17 at 23:02
  • But why yarn is installed in this repo then? I mean, if there's no difference, shouldn't they use only one? – Leoni Dec 27 '17 at 23:03
  • 1
    Let's say it like that: From usage wise they are pretty similar, but some hidden/performance stuff is different and you can choose whatever you want(Here you can read a bit about the differences: https://www.sitepoint.com/yarn-vs-npm/) – Marco Dec 27 '17 at 23:12
  • I think another reasons that went into this decision was that for a starter kit it is easier to show the different ways and have the user select and remove than it is to use only one and leave users that want the other to fend for themselves. – kwelch Jan 05 '18 at 15:41

1 Answers1

4

The package-lock.json is to support installing dependencies with NPM 5x +.

The yarn.lock is to support for people installing dependencies with Yarn.

With this package, they are now required to commit both because they are actively supporting both package managers.

My opinion is that they only need to commit one, as they run the risk of lock files becoming out of sync, so its one convenience at the cost of another.

Maybe I'm missing something obvious but I wouldn't recommend taking this approach to anyone starting a new project or package. 1 package manager is enough

random-forest-cat
  • 33,652
  • 11
  • 120
  • 99
  • That is a good point. A PR or an issues to raise this would be welcomed! – kwelch Jan 05 '18 at 15:31
  • I could not edit, so I will reply again (sorry). I have opened this issue to start the conversation of package managers. Thanks! – kwelch Jan 05 '18 at 15:39