Skip to content

Commit

Permalink
fix: support x.y packagist semver format
Browse files Browse the repository at this point in the history
  • Loading branch information
gabidobo committed Sep 28, 2023
1 parent ae88832 commit 3aefc78
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/graph/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,22 @@ const processDependenciesForPackage = ({
};

const processPlaceholders = ({newPackage, placeholders}) => {
let newVersion = newPackage.version;
if (newVersion.startsWith('v')) {
newVersion = newVersion.slice(1);
}
placeholders
.filter(
({dependencyName, semverRule}) =>
newPackage.name === dependencyName && semverLib.satisfies(newPackage.version, semverRule),
)
.filter(({dependencyName, semverRule}) => {
let placeholderSemverRule = semverRule;
if (placeholderSemverRule.startsWith('v')) {
placeholderSemverRule = placeholderSemverRule.slice(1);
}
return (
newPackage.name === dependencyName &&
(newVersion === placeholderSemverRule ||
semverLib.satisfies(newVersion, placeholderSemverRule))
);
})
.forEach((placeholder) => {
// eslint-disable-next-line no-param-reassign
placeholder.targetPackage[placeholder.dependencyType][newPackage.name] = newPackage;
Expand Down

0 comments on commit 3aefc78

Please sign in to comment.