npm-upgrade icon indicating copy to clipboard operation
npm-upgrade copied to clipboard

Feature suggestion: Create separate commits per upgraded package

Open olpeh opened this issue 6 years ago • 3 comments

Hello, thanks for an amazing tool.

I want to update packages with separate commits (including lockfile) per package and I recently started working on a PoC for that feature in a fork.

However, I thought you might actually find this feature useful because it's such a tiny addition.

My PoC that works assuming yarn: https://github.com/th0r/npm-upgrade/compare/master...olpeh:5897e9f68c5d6d4d1d4f3afccdd0ba7579e82f95

What do you think about this? If this is something that sounds useful, I can try to improve this PoC and create a PR about it.

Some things to be solved though:

  • How to know if the user wants to use yarn or npm?
  • How to check if a yarn.lock or package-lock.json exists?

olpeh avatar Sep 17 '19 05:09 olpeh

Hello, thanks for an amazing tool.

Thanks!

What do you think about this? If this is something that sounds useful, I can try to improve this PoC and create a PR about it.

It's an interesting feature but it doesn't replicate the way I upgrade modules in my projects - I do it in one run so I don't think it will be useful for me.

Let's see if this issue collects a noticeable amount of "thumb up"s I'll be happy to review and merge your PR.

  • How to check if a yarn.lock or package-lock.json exists?

Just check existence of the corresponding file in the project?

  • How to know if the user wants to use yarn or npm?

Here is the flow I would use:

  1. Introduce an option in .npm-upgrade.json which will store the name of the package manager used in current project. This option is not mandatory and may not be specified.
  2. If it present, use it. If it's not, goto 3.
  3. Search for yarn.lock or package-lock.json files. If they present, use corresponding package manager (without setting an option in config file).
  4. If lock files are not there, ask user in commit phase about package manager and set it in the config.

th0r avatar Sep 17 '19 10:09 th0r

Alright, thanks for the reply. I'll improve my PoC and create a PR of it whenever I have some time.

olpeh avatar Sep 19 '19 05:09 olpeh

This sounds like a useful feature!

I'd never be patient enough to do the splitting by hand, but sure would appreciate the separate commits when e.g. bisecting after discovering something broke later.

jareware avatar Sep 19 '19 06:09 jareware