apache / apache/cordova-lib

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

Open
#790 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
231
Forks
242
Avg merge
2h 51m
Merged PRs (30d)
7

Description

# 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?

```cmd
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

- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above

Contributor guide

Open the contributing guide

Research direction

Trace the cordova plugin add dependency check and compare it with the requirement shown in the cordova-plugin-splashscreen package.json link. Reproduce the setup with cordova-windows 7.1.0-dev, then verify that its prerelease version satisfies the plugin's >=4.4.0 requirement and no older plugin version is selected.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
mobile-dev, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.