r/javascript • • Mar 26 '18

Modern Frontend Developer in 2018

https://medium.com/tajawal-engineering/modern-frontend-developer-in-2018-4c2072fa2b9c
558 Upvotes

91 comments sorted by

View all comments

18

u/thilehoffer Mar 26 '18

Quick question about package managers. Does it make sense to use more than a few packages and always be keeping them up to date? Why not just add a package to your site and leave it? Wouldn’t updating multiple packages to a new version increase your risk of issues / bugs with each deployment?

11

u/vinnl Mar 26 '18

There's always potential security issues and bugs in the versions you're already using, which means it's good for you to update. Furthermore, there's going to be new features that, if not you yourself, other packages you are or will be using might want to use. For example, if you're still on React 0.13, you won't be able to introduce react-redux to your project without also upgrading React, which makes the cost of introducing that a lot larger.

6

u/thilehoffer Mar 26 '18

Sure, but do you need to always be current? Wouldn’t be better to update all your packages once per year. Then do a build with no other changes, QA that release and deploy? Seems like that would be much less risk, and a lot easier then always updating.

18

u/vinnl Mar 26 '18

That's a philosophy that some people (sometimes implicitly) entertain. However, the trend appears to be to move to a "release early, release often" strategy (see: continuous integration/delivery and devops). The idea is that when you do a lot of small changes continuously, you will run into potential problems early and are able to fix them while they are still small. Updates can and do have side effects that may be difficult to track down, and if you batch a lot of them together, it can be far more work to find the source of problems. Also, it's going to be more work to do in a single go, which makes you more prone to postponing.

(Obviously you will always have to keep an eye on pressing security concerns, and being able to fix them quickly is an advantage as well.)

To provide a real-world example from my work: dependencies.io regularly and automatically clones my repository, checks which dependencies are out-of-date, and submits separate pull requests for every dependency that needs updating (usually no more than three, and most of the times fewer). Each of those pull requests than automatically runs a CI pipeline that builds the code with the new dependencies, runs the tests, deploys it to a separate environment, and starts a browser that performs a few actions on that environment as if a user were controlling it.

Keeping the project up-to-date is then usually a simple click to accept the pull request, sometimes after a manual check of the environment if I suspect the update to have some risk of breaking. And rarely, but still a few times a year, something will have broken that I can then address on short notice, and it's still relatively clear what will then have broken it.

As you can see, the risk of something breaking and making it into the mainline code is relatively low, and it's still low effort to keep things up-to-date. It's pretty sweet. (The project is open source, so if you want to see this in action, see this pull request from last week.)

That said: it's dependency management is a notoriously difficult problem and there are different schools of thought, so unfortunately there's no quick and definite answer to your quick question :)

1

u/BirdToTheWise Mar 26 '18

Is there any alternative services to dependencies.io?

2

u/variegatedEncyclopod Mar 27 '18

Greenkeeper is the one I use (https://greenkeeper.io/). Incredibly useful to get PRs automatically to update dependencies. +1 for a tool like this.

0

u/vinnl Mar 27 '18

There are quite a few - Greenkeeper, Gemnasium are two I can think of off the top of my head. As GitHub, GitLab and the likes integrate this functionality, some of them are bound to disappear though.

1

u/plafoucr Mar 28 '18

Gemnasium has been acquired by gitlab, and the later is now proposing a lot of similar features with the security products.