dpa99c / cordova-check-plugins

A CLI tool to check for / manage plugin updates in Cordova/Phonegap projects.
216 stars 25 forks source link

Not detecting new version available when using @1.0.1 #8

Closed alejandromagnorsky closed 8 years ago

alejandromagnorsky commented 8 years ago

Hello. Very nice and useful plugin! Unluckily, is not working for me though: Here is the output of cordova-check-plugins --verbose:

Checking latest npm registry version for 'cordova-plugin-geolocation' using 'cordova-plugin-geolocation@1.0.1'
plugin: cordova-plugin-geolocation
source: npm://cordova-plugin-geolocation@1.0.1
installed version: 1.0.1
remote version: 1.0.1

For adding that plugin I used the command: cordova add plugin cordova-plugin-geolocation@1.0.1 Because I want to have full control over the versions I'm using. The idea of using this plugin is to detect if there is a new version of the plugin I use or not (similar to how npm-check-updates works).

dpa99c commented 8 years ago

I understand what you're saying, but this needs a bit of consideration.

I myself often constrain plugins to the major version, e.g cordova-plugin-geolocation@1. In this case, I only want to know about new minor versions/builds, so if the remote versions available were 1.0.1, 1.0.2, 1.1.0, 2.0.0, I'd want to see 1.1.0 being returned as the available remote version, not 2.0.0.

So if I completely unconstrain the remote version in this tool (i.e. ignore everything after @) then I think this will also be a problem.

I see two possibilities:

  1. If the specified version number specifies an exact version (i.e. @X.Y.Z), ignore the specified version number and return the highest available remote version. In the above example, cordova-plugin-geolocation@1.0.1 would return 2.0.0. But @X' or@X.Y(e.gcordova-plugin-geolocation@1`) would still return 1.1.0.
  2. Add a command-line flag to unconstrain the version number (e.g. --unconstrainVersion). This would effectively ignore the specified version number following the @ and return the highest available remote version. So, using the example above, both cordova-plugin-geolocation@1.0.1 and cordova-plugin-geolocation@1.0 would return a remote version of 2.0.0.

What do you think?

alejandromagnorsky commented 8 years ago

I believe the best option is number 2. Is simpler to understand as well. Thanks!

alejandromagnorsky commented 8 years ago

Awesome. Working like a charm. Thanks!