From 61a3fc9789323a4a0322c5569f26248422fe8840 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Sat, 14 Sep 2024 10:05:21 +0200 Subject: [PATCH] fix version rules having extraneous >=0 --- src/cpan-versions.mjs | 6 +++--- test/get-prereqs.test.mjs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cpan-versions.mjs b/src/cpan-versions.mjs index 48ad223..be48a91 100644 --- a/src/cpan-versions.mjs +++ b/src/cpan-versions.mjs @@ -27,10 +27,10 @@ export const simpleVersion = (version) => { }; export const mergeVersions = (versionList) => { - const versions = versionList.map(v => v.split(/\s*,\s*/)).flat(); - return versions + const versions = versionList.map(v => v.split(/\s*,\s*/)).flat() .filter((value, index, array) => array.indexOf(value) === index) - .join(','); + .filter(v => v !== '>=0'); + return versions.length ? versions.join(',') : '>=0'; }; export const cpanmVersion = (version) => { diff --git a/test/get-prereqs.test.mjs b/test/get-prereqs.test.mjs index 9bf0930..1aca552 100644 --- a/test/get-prereqs.test.mjs +++ b/test/get-prereqs.test.mjs @@ -60,7 +60,7 @@ describe('getPrereqs', function () { 'Dist::Zilla::Plugin::GatherFile': '>=0', 'Dist::Zilla::Plugin::Git::GatherDir': '>=5', 'Dist::Zilla::Plugin::PodWeaver': '>=0', - 'Dist::Zilla::PluginBundle::Basic': '>=0,>=6', + 'Dist::Zilla::PluginBundle::Basic': '>=6', 'Dist::Zilla::PluginBundle::ConfigSlicer': '>=0', 'Dist::Zilla::PluginBundle::Filter': '>=2', 'Dist::Zilla::PluginBundle::Git::VersionManager': '>=0', @@ -84,7 +84,7 @@ describe('getPrereqs', function () { 'Dist::Zilla::Plugin::GatherFile': '>=0', 'Dist::Zilla::Plugin::Git::GatherDir': '>=5', 'Dist::Zilla::Plugin::PodWeaver': '>=0', - 'Dist::Zilla::PluginBundle::Basic': '>=0,>=6', + 'Dist::Zilla::PluginBundle::Basic': '>=6', 'Dist::Zilla::PluginBundle::ConfigSlicer': '>=0', 'Dist::Zilla::PluginBundle::Filter': '>=2', 'Dist::Zilla::PluginBundle::Git::VersionManager': '>=0',