Skip to content

fix: handle prerelease platform versions in engine requirement checks#986

Open
GitToTheHub wants to merge 2 commits intomasterfrom
pr-handle-prerelease-platform-versions
Open

fix: handle prerelease platform versions in engine requirement checks#986
GitToTheHub wants to merge 2 commits intomasterfrom
pr-handle-prerelease-platform-versions

Conversation

@GitToTheHub
Copy link
Copy Markdown

Platforms affected

All

Motivation and Context

  • This PR fixes plugin engine requirement checks for prerelease platform versions such as 8.0.2-dev.0.
  • Added tests
  • Generated-By: GPT-5.3-Codex

Description

When adding a plugin, Cordova validates engine constraints in plugin metadata. For platform constraints, prerelease versions are compared directly with semver.satisfies(). Since semver excludes prerelease versions from normal ranges by default, versions like 8.0.2-dev.0 may not satisfy >=7.0.0, even though they should be treated as the corresponding release line.

This can trigger warnings such as:

Unmet project requirements for latest version of cordova-plugin-google-maps-sdk:
    cordova-ios (8.0.2-dev.0 in project, >=7.0.0 required)
Current project does not satisfy the engine requirements specified by any version of cordova-plugin-google-maps-sdk. Fetching latest version of plugin anyway (may be incompatible)

Root cause

The cordova requirement path already normalizes prerelease cordova versions before comparison, but platform versions were not normalized the same way.

Fix

Normalize prerelease platform versions before semver engine checks, mirroring existing behavior for the cordova version check.

Testing

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

- This PR fixes plugin engine requirement checks for prerelease platform versions such as 8.0.2-dev.0.
- Added tests
- Generated-By: GPT-5.3-Codex

Co-authored-by: Copilot <copilot@github.com>
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.61%. Comparing base (1df2446) to head (8519291).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #986   +/-   ##
=======================================
  Coverage   89.61%   89.61%           
=======================================
  Files          41       41           
  Lines        5190     5190           
=======================================
  Hits         4651     4651           
  Misses        539      539           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dpogue
Copy link
Copy Markdown
Member

dpogue commented Apr 25, 2026

I thought this issue had already been fixed by #935 but it looks like this is a slightly different spot.

Rather than modifying the version with inc, we probably want to just pass the same flags to satisfies that we did in #935 so our version handling is consistent.

- Rather than modifying the version with inc, we probably want to just pass the same flags to satisfies that we did in #935 so our version handling is consistent.
@GitToTheHub
Copy link
Copy Markdown
Author

Good point I changed it to just use satisfies with the options { loose: true, includePrerelease: true }

@GitToTheHub
Copy link
Copy Markdown
Author

GitToTheHub commented Apr 25, 2026

I see there are two other conditions above without using { loose: true, includePrerelease: true }:

            if (pluginMap[trimmedReq] && !semver.satisfies(pluginMap[trimmedReq], reqs[req])) {
                badInstalledVersion = pluginMap[req];
            } else if (trimmedReq === 'cordova' && !semver.satisfies(version, reqs[req])) {
                badInstalledVersion = cordovaVersion;

Should the options { loose: true, includePrerelease: true } added there too?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants