Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip upgrading a dependency if set to a specific version? #436

Closed
oleersoy opened this issue May 9, 2018 · 8 comments
Closed

Skip upgrading a dependency if set to a specific version? #436

oleersoy opened this issue May 9, 2018 · 8 comments

Comments

@oleersoy
Copy link

oleersoy commented May 9, 2018

Based on what I'm seeing, npm check updates everything it can find to update. I was hoping it would only update things with a ^ character in the version?

For example this updates:

multer            ^0.1.8  →   ^1.0.1

But this does not

multer            0.1.8  →   0.1.8 

Thoughts?

The reason I'm requesting this is I have dependencies that are updating, like postcss-custom-properties but the build they are updating to is broken so ...

@raineorshine
Copy link
Owner

Hi, thanks for posting. I could definitely see this being useful. Currently ncu only filters against the package name. It would be a good addition to offer a command line option to filter against the specified version as well.

In the mean time, you will have to explicitly exclude packages, e.g.

ncu -x postcss-custom-properties

@yvbeek
Copy link

yvbeek commented May 30, 2018

I would expect this to be default behavior.

When I pin a version with 0.1.8 instead of ^0.1.8 I'm choosing not to update that package to the latest version, I just want to keep it at 0.1.8.

Could this perhaps be changed?
Basically just ignore all packages that have fixed versions.

@prantlf
Copy link

prantlf commented Jun 3, 2018

I upgrade all modules in package.json from time to time. I use pinned dependencies. Running ncu for modules with pinned versions is a convenient way of checking and upgrading npm modules only when wanted, being pinned or not.

If ncu should ignore npm modules with exact version, I'd prefer introducing a command line option for it, to be able to still use the original functionality. Running npm outdated checks npm modules with pinned version too.

@prantlf
Copy link

prantlf commented Jun 4, 2018

.ncurc can be used to list packages, which should not be touched by ncu, having pinned version or not.

@yvbeek
Copy link

yvbeek commented Jun 5, 2018

@prantlf I don't agree. When you specify an exact version number it is the developer's intent to stay at the specific version. There are many ways to specify a flexible version number:
https://docs.npmjs.com/misc/semver#ranges

NCU should honor these versioning rules. Upgrading pinned versions is risky, but you can always introduce something like --upgradePinned.

@raineorshine
Copy link
Owner

To clarify, the main purpose of ncu is to break versioning rules. npm is good at performing non-breaking upgrades. It is not so good at performing controlled breaking version upgrades, hence ncu. (A feature I'd love to add is the ability to run unit tests for each upgrade to determine if it actually breaks anything.)

That said, people have a variety of needs around dependency management, and there should be a flag in ncu to optionally exclude fixed version numbers.

@raineorshine
Copy link
Owner

Closed with the revive-me tag for interested contributors. See #484.

@raineorshine
Copy link
Owner

--filterVersion and --rejectVersion added in v10.2.0, allowing filtering based on the version string.

e.g. You can exclude exact versions by filtering only ranges:

ncu --filterVersion "/^[~^<>]| - |\.x$/"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants