Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Commit

Permalink
Refactor based on request from review
Browse files Browse the repository at this point in the history
  • Loading branch information
magraina committed Jul 30, 2024
1 parent 84212b2 commit 3f612e0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### Bug fixes

* Fixes version check does not support composer version ranges.
* Fixes plugin binary version checks to support composer version constraints.

## 4.0.0

Expand Down
14 changes: 7 additions & 7 deletions lib/commands/compatibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const Chalk = require('chalk');
const Program = require('commander');
const { compareVersions, compareVersionsWithComperator } = require('composer-version-constraint-evaluator');
const { compareVersions, compareVersionsWithComparator } = require('composer-version-constraint-evaluator');
const { promisify } = require('util');

const ShopwareStoreCommander = require('../shopwareStoreCommander');
Expand Down Expand Up @@ -74,19 +74,19 @@ async function main() {
).shift().name;
}

if (compareVersionsWithComperator(Program.opts().minVersion, minCompatibleVersion, '<')) {
if (compareVersionsWithComparator(Program.opts().minVersion, minCompatibleVersion, '<')) {
// Add new version compatibility entries to lower the minimum compatibility
console.log(`Lowering minimum compatible Shopware version of binary ${binary.version} to ${Program.opts().minVersion}...`);
binary.compatibleSoftwareVersions = binary.compatibleSoftwareVersions.concat(shopwareVersions.filter(
version => version.selectable
&& compareVersionsWithComperator(version.name, Program.opts().minVersion, '>=')
&& compareVersionsWithComperator(version.name, minCompatibleVersion, '<'),
&& compareVersionsWithComparator(version.name, Program.opts().minVersion, '>=')
&& compareVersionsWithComparator(version.name, minCompatibleVersion, '<'),
));
} else if (compareVersionsWithComperator(Program.opts().minVersion, minCompatibleVersion, '>')) {
} else if (compareVersionsWithComparator(Program.opts().minVersion, minCompatibleVersion, '>')) {
// Remove some version compatibilities to raise the minimum compatibility
console.log(`Raising minimum compatible Shopware version of binary ${binary.version} to ${Program.opts().minVersion}...`);
binary.compatibleSoftwareVersions = binary.compatibleSoftwareVersions.filter(
version => version.selectable && compareVersionsWithComperator(version.name, Program.opts().minVersion, '>='),
version => version.selectable && compareVersionsWithComparator(version.name, Program.opts().minVersion, '>='),
);
} else {
console.log(`Minimum compatible Shopware version of binary ${binary.version} already matches ${Program.opts().minVersion}`);
Expand All @@ -97,7 +97,7 @@ async function main() {
if (binary.compatibleSoftwareVersions.length === 0) {
// Add at least the minimum compatible shopware version
binary.compatibleSoftwareVersions = [
shopwareVersions.find(version => version.selectable && compareVersionsWithComperator(version.name, Program.opts().minVersion, '=')),
shopwareVersions.find(version => version.selectable && compareVersionsWithComparator(version.name, Program.opts().minVersion, '=')),
];
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@
"node": ">=18.0.0"
},
"preferGlobal": true
}
}

0 comments on commit 3f612e0

Please sign in to comment.