Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(npm): fetching npm versions not working #270

Merged
merged 2 commits into from
Dec 9, 2023
Merged

Conversation

Mairu
Copy link
Contributor

@Mairu Mairu commented Dec 9, 2023

Sadly a change that I was unaware of broke the installation of npm versions, fixed that and prepared a new version.

@nullivex
Copy link
Member

nullivex commented Dec 9, 2023

Doesn’t the semver package handle version breakdowns?

The regular expression could be redundant to that.

@Mairu Mairu self-assigned this Dec 9, 2023
@Mairu Mairu requested a review from marcelklehr December 9, 2023 10:05
@Mairu
Copy link
Contributor Author

Mairu commented Dec 9, 2023

As described in the comment the npm/cli repository also has many releases of other libraries which are not npm, so the version regex is used to filter out these libraries -> https://github.com/npm/cli/releases

The problem with the former fix was that it is no object but just the version names returned by the previous function.

The unfiltered cli array looks like that:

[
  "v10.2.5",
  "libnpmversion-v5.0.2",
  "libnpmteam-v6.0.1",
  "libnpmsearch-v7.0.1",
  "libnpmpublish-v9.0.3",
  "libnpmpack-v6.0.4",
  "libnpmorg-v6.0.2",
  "libnpmhook-v10.0.1",
  "libnpmfund-v5.0.2",
  "libnpmexec-v7.0.5",
  "libnpmdiff-v6.0.4",
  "libnpmaccess-v8.0.2",
  "config-v8.0.3",
  "arborist-v7.2.2",
  "v10.2.4",
  "v9.9.2",
  "libnpmpublish-v9.0.2",
  "libnpmpublish-v7.5.1",
  "libnpmexec-v7.0.4",
  "config-v8.0.2",
  "v9.9.1",
  "v10.2.3",
  "v10.2.2",
  "libnpmversion-v5.0.1",
  "libnpmpack-v6.0.3",
  "libnpmfund-v5.0.1",
  "libnpmexec-v7.0.3",
  "libnpmdiff-v6.0.3",
  "arborist-v7.2.1",
  "v10.2.1",
  "config-v8.0.1",
  "v9.9.0",
  "libnpmpack-v5.0.20",
  "libnpmfund-v4.2.1",
  "libnpmfund-v4.2.0",
  "libnpmexec-v6.0.4",
  "libnpmdiff-v5.0.20",
  "config-v6.4.0",
  "config-v6.3.0",
  "arborist-v6.5.0",
  "arborist-v6.4.0",
  "v10.2.0",
  "libnpmpublish-v9.0.1",
  "libnpmpack-v6.0.2",
  "libnpmorg-v6.0.1",
  "libnpmfund-v5.0.0",
  "libnpmexec-v7.0.2",
  "libnpmdiff-v6.0.2",
  "libnpmaccess-v8.0.1",
  "config-v8.0.0",
  "arborist-v7.2.0",
  "v10.1.0",
  "libnpmpack-v6.0.1",
  "libnpmfund-v4.1.1",
  "libnpmexec-v7.0.1",
  "libnpmdiff-v6.0.1",
  "config-v7.2.0",
  "arborist-v7.1.0",
  "v10.0.0",
  "v10.0.0-pre.1",
  "libnpmversion-v5.0.0",
  "libnpmteam-v6.0.0",
  "libnpmsearch-v7.0.0",
  "libnpmpublish-v9.0.0",
  "libnpmpack-v6.0.0",
  "libnpmorg-v6.0.0",
  "libnpmhook-v10.0.0",
  "libnpmfund-v4.1.0",
  "libnpmfund-v4.0.20",
  "libnpmexec-v7.0.0",
  "libnpmdiff-v6.0.0",
  "libnpmaccess-v8.0.0",
  "config-v7.1.0",
  "config-v7.0.1",
  "arborist-v7.0.0",
  "libnpmversion-v5.0.0-pre.0",
  "libnpmteam-v6.0.0-pre.0",
  "libnpmsearch-v7.0.0-pre.0",
  "libnpmpublish-v9.0.0-pre.0",
  "libnpmpack-v6.0.0-pre.0",
  "libnpmorg-v6.0.0-pre.0",
  "libnpmhook-v10.0.0-pre.0",
  "libnpmexec-v7.0.0-pre.0",
  "libnpmdiff-v6.0.0-pre.0",
  "libnpmaccess-v8.0.0-pre.0",
  "arborist-v7.0.0-pre.0",
  "v10.0.0-pre.0",
  "libnpmpublish-v8.0.0",
  "config-v7.0.0",
  "v9.8.1",
  "libnpmexec-v6.0.3",
  "v9.8.0",
  "libnpmpublish-v7.5.0",
  "libnpmpack-v5.0.19",
  "libnpmfund-v4.0.19",
  "libnpmexec-v6.0.2",
  "libnpmdiff-v5.0.19",
  "arborist-v6.3.0",
  "v9.7.2",
  "libnpmpublish-v7.4.0",
  "libnpmpack-v5.0.18",
  "libnpmfund-v4.0.18",
  "libnpmexec-v6.0.1",
  "libnpmdiff-v5.0.18",
  "config-v6.2.1",
  "arborist-v6.2.10",
  "v9.7.1",
  "v9.7.0",
  "libnpmpublish-v7.3.0",
  "libnpmexec-v6.0.0",
  "config-v6.2.0",
  "v9.6.7",
  "libnpmpublish-v7.2.0",
  "config-v6.1.7",
  "v9.6.6",
  "libnpmpublish-v7.1.4",
  "libnpmpack-v5.0.17",
  "libnpmorg-v5.0.4",
  "libnpmfund-v4.0.17",
  "libnpmexec-v5.0.17",
  "libnpmdiff-v5.0.17",
  "arborist-v6.2.9",
  "v9.6.5",
  "libnpmpack-v5.0.16",
  "libnpmfund-v4.0.16",
  "libnpmexec-v5.0.16",
  "libnpmdiff-v5.0.16",
  "config-v6.1.6",
  "arborist-v6.2.8",
  "v9.6.4",
  "libnpmpack-v5.0.15",
  "libnpmfund-v4.0.15",
  "libnpmexec-v5.0.15",
  "libnpmdiff-v5.0.15",
  "arborist-v6.2.7",
  "v9.6.3",
  "libnpmpublish-v7.1.3",
  "libnpmpack-v5.0.14",
  "libnpmfund-v4.0.14",
  "libnpmexec-v5.0.14",
  "libnpmdiff-v5.0.14",
  "config-v6.1.5",
  "arborist-v6.2.6",
  "v9.6.2",
  "libnpmpublish-v7.1.2",
  "config-v6.1.4",
  "v9.6.1",
  "libnpmpublish-v7.1.1",
  "libnpmpack-v5.0.13",
  "libnpmfund-v4.0.13",
  "libnpmexec-v5.0.13",
  "libnpmdiff-v5.0.13",
  "arborist-v6.2.5",
  "v9.6.0",
  "libnpmpack-v5.0.12",
  "libnpmfund-v4.0.12",
  "libnpmexec-v5.0.12",
  "libnpmdiff-v5.0.12",
  "arborist-v6.2.4",
  "v9.5.1",
  "libnpmpack-v5.0.11",
  "libnpmfund-v4.0.11",
  "libnpmexec-v5.0.11",
  "libnpmdiff-v5.0.11",
  "arborist-v6.2.3",
  "v9.5.0",
  "libnpmteam-v5.0.3",
  "libnpmpublish-v7.1.0",
  "v8.19.4",
  "v9.4.2",
  "libnpmpublish-v7.0.8",
  "libnpmpack-v5.0.10",
  "libnpmorg-v5.0.3",
  "libnpmhook-v9.0.3",
  "libnpmfund-v4.0.10",
  "libnpmexec-v5.0.10",
  "libnpmdiff-v5.0.10",
  "config-v6.1.3",
  "arborist-v6.2.2",
  "v9.4.1",
  "libnpmversion-v4.0.2",
  "libnpmteam-v5.0.2",
  "libnpmsearch-v6.0.2",
  "libnpmpublish-v7.0.7",
  "libnpmpack-v5.0.9",
  "libnpmorg-v5.0.2",
  "libnpmhook-v9.0.2",
  "libnpmfund-v4.0.9",
  "libnpmexec-v5.0.9",
  "libnpmdiff-v5.0.9",
  "libnpmaccess-v7.0.2",
  "config-v6.1.2",
  "arborist-v6.2.1",
  "v9.4.0",
  "libnpmpack-v5.0.8",
  "libnpmfund-v4.0.8",
  "libnpmexec-v5.0.8",
  "libnpmdiff-v5.0.8",
  "arborist-v6.2.0",
  "v9.3.1",
  "v9.3.0",
  "libnpmpack-v5.0.7",
  "libnpmfund-v4.0.7",
  "libnpmexec-v5.0.7",
  "libnpmdiff-v5.0.7",
  "config-v6.1.1",
  "arborist-v6.1.6",
  "v6.14.18",
  "v9.2.0",
  "libnpmteam-v5.0.1",
  "libnpmsearch-v6.0.1",
  "libnpmpublish-v7.0.6",
  "libnpmpack-v5.0.6",
  "libnpmorg-v5.0.1",
  "libnpmhook-v9.0.1",
  "libnpmfund-v4.0.6",
  "libnpmexec-v5.0.6",
  "libnpmdiff-v5.0.6",
  "libnpmaccess-v7.0.1",
  "arborist-v6.1.5",
  "v9.1.3",
  "libnpmpublish-v7.0.5",
  "libnpmpack-v5.0.5",
  "libnpmfund-v4.0.5",
  "libnpmexec-v5.0.5",
  "libnpmdiff-v5.0.5",
  "arborist-v6.1.4",
  "v9.1.2",
  "libnpmpublish-v7.0.4",
  "libnpmpack-v5.0.4",
  "libnpmfund-v4.0.4",
  "libnpmexec-v5.0.4",
  "libnpmdiff-v5.0.4",
  "arborist-v6.1.3",
  "v9.1.1",
  "libnpmpublish-v7.0.3",
  "libnpmpack-v5.0.3",
  "libnpmfund-v4.0.3",
  "libnpmexec-v5.0.3",
  "libnpmdiff-v5.0.3",
  "arborist-v6.1.2",
  "v8.19.3",
  "libnpmfund-v3.0.5",
  "libnpmexec-v4.0.14",
  "arborist-v5.6.3",
  "v9.1.0",
  "libnpmversion-v4.0.1",
  "libnpmpublish-v7.0.2",
  "libnpmpack-v5.0.2",
  "libnpmfund-v4.0.2",
  "libnpmexec-v5.0.2",
  "libnpmdiff-v5.0.2",
  "config-v6.1.0",
  "arborist-v6.1.1",
  "v9.0.1",
  "libnpmpublish-v7.0.1",
  "libnpmpack-v5.0.1",
  "libnpmfund-v4.0.1",
  "libnpmexec-v5.0.1",
  "libnpmdiff-v5.0.1",
  "arborist-v6.1.0",
  "v9.0.0",
  "v9.0.0-pre.6",
  "libnpmversion-v4.0.0",
  "libnpmteam-v5.0.0",
  "libnpmsearch-v6.0.0",
  "libnpmpublish-v7.0.0",
  "libnpmpack-v5.0.0",
  "libnpmorg-v5.0.0",
  "libnpmhook-v9.0.0",
  "libnpmfund-v4.0.0",
  "libnpmexec-v5.0.0",
  "libnpmdiff-v5.0.0",
  "libnpmaccess-v7.0.0",
  "arborist-v6.0.0",
  "libnpmversion-v4.0.0-pre.1",
  "libnpmteam-v5.0.0-pre.1",
  "libnpmsearch-v6.0.0-pre.1",
  "libnpmpublish-v7.0.0-pre.4",
  "libnpmpack-v5.0.0-pre.4",
  "libnpmorg-v5.0.0-pre.1",
  "libnpmhook-v9.0.0-pre.1",
  "libnpmfund-v4.0.0-pre.5",
  "libnpmexec-v5.0.0-pre.5",
  "libnpmdiff-v5.0.0-pre.3",
  "libnpmaccess-v7.0.0-pre.2",
  "arborist-v6.0.0-pre.5",
  "v9.0.0-pre.5",
  "libnpmpublish-v7.0.0-pre.3",
  "libnpmpack-v5.0.0-pre.3",
  "v9.0.0-pre.4",
  "libnpmpublish-v7.0.0-pre.2",
  "libnpmpack-v5.0.0-pre.2",
  "libnpmfund-v4.0.0-pre.4",
  "libnpmexec-v5.0.0-pre.4",
  "libnpmdiff-v5.0.0-pre.2",
  "arborist-v6.0.0-pre.4",
  "v9.0.0-pre.3",
  "libnpmpublish-v7.0.0-pre.1",
  "libnpmpack-v5.0.0-pre.1",
  "libnpmfund-v4.0.0-pre.3",
  "libnpmexec-v5.0.0-pre.3",
  "libnpmdiff-v5.0.0-pre.1",
  "arborist-v6.0.0-pre.3",
  "v9.0.0-pre.2",
  "libnpmfund-v4.0.0-pre.2",
  "libnpmexec-v5.0.0-pre.2",
  "arborist-v6.0.0-pre.2",
  "v9.0.0-pre.1",
  "libnpmfund-v4.0.0-pre.1",
  "libnpmexec-v5.0.0-pre.1",
  "libnpmaccess-v7.0.0-pre.1",
  "arborist-v6.0.0-pre.1",
  "v8.19.2",
  "libnpmfund-v3.0.4",
  "libnpmexec-v4.0.13",
  "arborist-v5.6.2",
  "v9.0.0-pre.0",
  "libnpmversion-v4.0.0-pre.0",
  "libnpmteam-v5.0.0-pre.0",
  "libnpmsearch-v6.0.0-pre.0",
  "libnpmpublish-v7.0.0-pre.0",
  "libnpmpack-v5.0.0-pre.0",
  "libnpmorg-v5.0.0-pre.0",
  "libnpmhook-v9.0.0-pre.0",
  "libnpmfund-v4.0.0-pre.0",
  "libnpmexec-v5.0.0-pre.0",
  "libnpmdiff-v5.0.0-pre.0",
  "libnpmaccess-v7.0.0-pre.0",
  "arborist-v6.0.0-pre.0",
  "v8.19.1",
  "libnpmteam-v4.0.4",
  "libnpmpublish-v6.0.5",
  "libnpmorg-v4.0.4",
  "libnpmaccess-v6.0.4",
  "v8.19.0",
  "libnpmversion-v3.0.7",
  "libnpmsearch-v5.0.4",
  "libnpmpack-v4.1.3",
  "libnpmhook-v8.0.4",
  "libnpmfund-v3.0.3",
  "libnpmexec-v4.0.12",
  "libnpmdiff-v4.0.5",
  "arborist-v5.6.1",
  "v8.18.0",
  "libnpmexec-v4.0.11",
  "arborist-v5.6.0",
  "v8.17.0",
  "libnpmexec-v4.0.10",
  "arborist-v5.5.0",
  "v8.16.0",
  "libnpmexec-v4.0.9",
  "arborist-v5.4.0",
  "v8.15.1",
  "arborist-v5.3.1",
  "v8.15.0",
  "v8.14.0",
  "arborist-v5.3.0",
  "v8.13.2",
  "v8.13.1",
  "libnpmversion-v3.0.6",
  "libnpmpack-v4.1.2",
  "libnpmexec-v4.0.8",
  "arborist-v5.2.3",
  "v8.13.0",
  "libnpmversion-v3.0.5",
  "libnpmpack-v4.1.1",
  "libnpmexec-v4.0.7",
  "libnpmdiff-v4.0.4",
  "arborist-v5.2.2",
  "v8.12.2",
  "v8.12.1",
  "v8.12.0",
  "libnpmexec-v4.0.6",
  "arborist-v5.2.1",
  "v8.11.0",
  "libnpmpack-v4.1.0",
  "v8.10.0",
  "arborist-v5.2.0",
  "v8.9.0",
  "v6.14.17",
  "v8.8.0",
  "libnpmversion-v3.0.4",
  "libnpmpublish-v6.0.4",
  "libnpmexec-v4.0.5",
  "arborist-v5.1.1",
  "libnpmexec-v4.0.4",
  "arborist-v5.1.0",
  "v8.7.0",
  "libnpmversion-v3.0.3",
  "arborist-v5.0.6",
  "libnpmversion-v3.0.2",
  "libnpmteam-v4.0.3",
  "libnpmsearch-v5.0.3",
  "libnpmpublish-v6.0.3",
  "libnpmpack-v4.0.3",
  "libnpmorg-v4.0.3",
  "libnpmhook-v8.0.3",
  "libnpmfund-v3.0.2",
  "libnpmexec-v4.0.3",
  "libnpmdiff-v4.0.3",
  "libnpmaccess-v6.0.3",
  "arborist-v5.0.5",
  "arborist-v5.0.4",
  "v8.6.0",
  "v8.5.5",
  "libnpmteam-v4.0.2",
  "libnpmsearch-v5.0.2",
  "libnpmpublish-v6.0.2",
  "libnpmpack-v4.0.2",
  "libnpmorg-v4.0.2",
  "libnpmhook-v8.0.2",
  "libnpmexec-v4.0.2",
  "libnpmdiff-v4.0.2",
  "libnpmaccess-v6.0.2",
  "arborist-v5.0.3",
  "v8.5.4",
  "arborist-v5.0.2",
  "libnpmversion-v3.0.1",
  "libnpmteam-v4.0.1",
  "libnpmsearch-v5.0.1",
  "libnpmpack-v4.0.1",
  "libnpmorg-v4.0.1",
  "libnpmhook-v8.0.1",
  "libnpmexec-v4.0.1",
  "libnpmdiff-v4.0.1",
  "libnpmaccess-v6.0.1",
  "libnpmpublish-v6.0.1",
  "libnpmfund-v3.0.1",
  "arborist-v5.0.1",
  "v8.5.3",
  "v8.5.2",
  "v8.5.1",
  "v8.5.0",
  "v8.4.1",
  "v8.4.0",
  "v8.3.2",
  "v6.14.16",
  "v8.3.1",
  "v8.3.0",
  "v8.2.0",
  "v8.1.4",
  "v8.1.3",
  "v8.1.2",
  "v8.1.1",
  "v8.1.0",
  "v8.0.0",
  "v7.24.2",
  "v7.24.1",
  "v7.24.0",
  "v7.23.0",
  "v7.22.0",
  "v7.21.1",
  "v6.14.15",
  "v7.21.0",
  "v7.20.6",
  "v7.20.5",
  "v7.20.4",
  "v7.20.3",
  "v7.20.2",
  "v6.14.14",
  "v7.20.1",
  "v7.20.0",
  "v7.19.1",
  "v7.19.0",
  "v7.18.1",
  "v7.18.0",
  "v7.17.0",
  "v7.16.0",
  "v7.15.1",
  "v7.15.0",
  "v7.14.0",
  "v7.13.0",
  "v7.12.1",
  "v7.12.0",
  "v7.11.2",
  "v7.11.1",
  "v7.11.0",
  "v7.10.0",
  "v6.14.13",
  "v7.9.0",
  "v7.8.0",
  "v7.7.6",
  "v7.7.5",
  "v6.14.12",
  "v7.7.4",
  "v7.7.3",
  "v7.7.2",
  "v7.7.1",
  "v7.7.0",
  "v7.6.3",
  "v7.6.2",
  "v7.6.1",
  "v7.6.0",
  "v7.5.5",
  "v7.5.4",
  "v7.5.3",
  "v7.5.2",
  "v7.5.1",
  "v7.5.0",
  "v7.4.3",
  "v7.4.2",
  "v7.4.1",
  "v6.14.11",
  "v7.4.0",
  "v7.3.0",
  "v6.14.10",
  "v7.2.0",
  "v7.1.2",
  "v7.1.1",
  "v7.1.0",
  "v7.0.15",
  "v7.0.14",
  "v7.0.13",
  "v6.14.9",
  "v7.0.12",
  "v7.0.11",
  "v7.0.10",
  "v7.0.9",
  "v7.0.8",
  "v7.0.7",
  "v7.0.6",
  "v7.0.5",
  "v7.0.4",
  "v7.0.3",
  "v7.0.2",
  "v7.0.1",
  "v7.0.0",
  "v7.0.0-rc.4",
  "v7.0.0-rc.3",
  "v7.0.0-rc.2",
  "v7.0.0-rc.1",
  "v7.0.0-rc.0",
  "v7.0.0-beta.13",
  "v7.0.0-beta.12",
  "v7.0.0-beta.11",
  "v7.0.0-beta.10",
  "v7.0.0-beta.9",
  "v7.0.0-beta.8",
  "v7.0.0-beta.7",
  "v7.0.0-beta.6",
  "v7.0.0-beta.5",
  "v6.14.8",
  "v6.14.7",
  "v6.14.6",
  "v6.14.5",
  "v6.14.4",
  "v6.14.3",
  "v6.14.2",
  "v6.14.1",
  "v6.14.0",
  "v6.13.7",
  "v6.13.6",
  "v6.13.5",
  "v6.13.4",
  "v6.13.3",
  "v6.13.2",
  "v6.13.1",
  "v6.13.0",
  "v6.12.1",
  "v6.12.0",
  "v6.12.0-next.0",
  "v6.11.3",
  "v6.11.2",
  "v6.11.1",
  "v6.11.0",
  "v6.10.3",
  "v6.10.2",
  "v6.10.1",
  "v6.10.0",
  "v6.10.0-next.0",
  "v6.9.2",
  "v6.9.1",
  "v6.9.1-next.0",
  "v6.9.0",
  "v6.9.0-next.0",
  "v6.8.0",
  "v6.8.0-next.2",
  "v6.8.0-next.1",
  "v6.8.0-next.0",
  "v6.7.0",
  "v6.6.0",
  "v6.6.0-next.1",
  "v6.6.0-next.0",
  "v6.5.0",
  "v6.5.0-next.0",
  "v6.4.1",
  "v6.4.1-next.0",
  "v6.4.0",
  "v6.4.0-next.0",
  "v6.3.0",
  "v6.3.0-next.0",
  "v6.2.0"
]

assert.ifError(error);
debug('listVersions: ' + result);
assert.ok(Array.isArray(result));
result.forEach((version) => assert.match(version, versionRegex));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to have a test for this :)

@Mairu Mairu merged commit 941d2ca into master Dec 9, 2023
2 checks passed
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