apache / cordova-lib

Apache Cordova Tooling Library
https://cordova.apache.org/
Apache License 2.0
221 stars 242 forks source link

`cordovaDependencies` check fails if installed dependency has a matching pre-release version #790

Open janpio opened 5 years ago

janpio commented 5 years ago

Bug Report

Problem

cordova plugin add ... errors and installs older plugin version even though the requirements of the plugin are met just fine.

What is expected to happen?

I can install the plugin.

What does actually happen?

E:\Projects\throwaway
λ cordova create cordovaLibRepro
Creating a new cordova project.

E:\Projects\throwaway
λ cd cordovaLibRepro\

E:\Projects\throwaway\cordovaLibRepro  (helloworld@1.0.0)
λ cordova platform add https://github.com/apache/cordova-windows
Using cordova-fetch for https://github.com/apache/cordova-windows
Warning: using prerelease platform windows@7.1.0-dev.
Use 'cordova platform add windows@latest' to add the latest published version instead.
Adding windows project...
Creating Cordova Windows Project:
        Path: platforms\windows
        Namespace: io.cordova.hellocordova
        Name: HelloCordova
Windows project created with cordova-windows@7.1.0-dev
Installing "cordova-plugin-whitelist" for windows

E:\Projects\throwaway\cordovaLibRepro  (helloworld@1.0.0)
λ cordova plugin add cordova-plugin-splashscreen
Unmet project requirements for latest version of cordova-plugin-splashscreen:
    cordova-windows (7.1.0-dev in project, >=4.4.0 required)
Fetching highest version of cordova-plugin-splashscreen that this project supports: 3.2.2 (latest is 5.0.3)
Installing "cordova-plugin-splashscreen" for windows
Adding cordova-plugin-splashscreen to package.json

The -dev suffix of cordova-windows master seems to confuse the comparison logic, but it shouldn't as this is valid semver for a prerelease version: https://semver.org/#spec-item-9

Information

Relevant bit of the plugin package.json: https://github.com/apache/cordova-plugin-splashscreen/blob/be85a1b14e69696b6c0355c754181c8d57d0837f/package.json#L30-L44

Version information

9.0.0 (cordova-lib@9.0.1)

Checklist

janpio commented 5 years ago

Workaround: Install the current plugin version explicitly: cordova plugin add cordova-plugin-splashscreen@5.0.3