You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ma...@apache.org on 2026/04/25 18:52:28 UTC
(cordova-lib) branch pr-handle-prerelease-platform-versions created (now a2feb32b)
This is an automated email from the ASF dual-hosted git repository.
GitToTheHub pushed a change to branch pr-handle-prerelease-platform-versions
in repository https://gitbox.apache.org/repos/asf/cordova-lib.git
at a2feb32b fix: handle prerelease platform versions in engine requirement checks
This branch includes the following new commits:
new a2feb32b fix: handle prerelease platform versions in engine requirement checks
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
(cordova-lib) 01/01: fix: handle prerelease platform versions in engine requirement checks
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
GitToTheHub pushed a commit to branch pr-handle-prerelease-platform-versions
in repository https://gitbox.apache.org/repos/asf/cordova-lib.git
commit a2feb32b2a573a4ae991a37109d62ff6532484bb
Author: Manuel Beck <ma...@outlook.de>
AuthorDate: Sat Apr 25 20:52:17 2026 +0200
fix: handle prerelease platform versions in engine requirement checks
- 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 <co...@github.com>
---
spec/cordova/plugin/add.spec.js | 6 ++++++
src/cordova/plugin/add.js | 12 ++++++++++--
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/spec/cordova/plugin/add.spec.js b/spec/cordova/plugin/add.spec.js
index ec96cf60..7d828fad 100644
--- a/spec/cordova/plugin/add.spec.js
+++ b/spec/cordova/plugin/add.spec.js
@@ -449,6 +449,12 @@ describe('cordova/plugin/add', function () {
it('should return an array with failed platform requirements ', function () {
expect(add.getFailedRequirements({ 'cordova-android': '>=6.0.0' }, {}, { android: '5.5.0' }, '7.0.0')).toEqual([{ dependency: 'cordova-android', installed: '5.5.0', required: '>=6.0.0' }]);
});
+ it('should treat prerelease platform versions as the matching release version', function () {
+ expect(add.getFailedRequirements({ 'cordova-ios': '>=7.0.0' }, {}, { ios: '8.0.2-dev.0' }, '12.0.0').length).toBe(0);
+ });
+ it('should return failed platform requirements for prerelease versions below minimum', function () {
+ expect(add.getFailedRequirements({ 'cordova-ios': '>=7.0.0' }, {}, { ios: '6.9.9-dev.0' }, '12.0.0')).toEqual([{ dependency: 'cordova-ios', installed: '6.9.9-dev.0', required: '>=7.0.0' }]);
+ });
});
describe('listUnmetRequirements helper method', function () {
it('should emit warnings for failed requirements', function () {
diff --git a/src/cordova/plugin/add.js b/src/cordova/plugin/add.js
index 91af02a5..54d8f864 100644
--- a/src/cordova/plugin/add.js
+++ b/src/cordova/plugin/add.js
@@ -518,8 +518,16 @@ function getFailedRequirements (reqs, pluginMap, platformMap, cordovaVersion) {
} else if (trimmedReq.indexOf('cordova-') === 0) {
// Might be a platform constraint
const platform = trimmedReq.substring(8);
- if (platformMap[platform] && !semver.satisfies(platformMap[platform], reqs[req])) {
- badInstalledVersion = platformMap[platform];
+ if (platformMap[platform]) {
+ let platformVersion = platformMap[platform];
+ if (semver.prerelease(platformVersion)) {
+ // Keep prerelease behavior consistent with the "cordova" version check above.
+ platformVersion = semver.inc(platformVersion, 'patch');
+ }
+
+ if (!semver.satisfies(platformVersion, reqs[req])) {
+ badInstalledVersion = platformMap[platform];
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org