From 7c253d8dd67e4d9741cacb99cf580d098e2c4035 Mon Sep 17 00:00:00 2001 From: Wes Todd Date: Tue, 16 Jul 2024 16:46:56 -0700 Subject: [PATCH 1/2] feat!: removed got and replaced it with fetch --- index.js | 24 ++++++++++++++---------- package.json | 2 +- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/index.js b/index.js index 269fa43..2831d8f 100644 --- a/index.js +++ b/index.js @@ -1,8 +1,6 @@ 'use strict' const { readFile } = require('fs/promises') const { join } = require('path') - -const got = require('got') const semver = require('semver') const _cache = new Map() @@ -81,16 +79,22 @@ function resolveAlias (versions, alias) { } } -function getSchedule (cache) { - return got('https://raw.githubusercontent.com/nodejs/Release/master/schedule.json', { - cache - }).json() +async function getSchedule (cache) { + const cached = cache.get('schedule') + if (cached) { + return cached + } + return fetch('https://raw.githubusercontent.com/nodejs/Release/master/schedule.json') + .then((res) => res.json()) } -function getVersions (cache, mirror) { - return got(mirror.replace(/\/$/, '') + '/index.json', { - cache - }).json() +async function getVersions (cache, mirror) { + const cached = cache.get('versions') + if (cached) { + return cached + } + return fetch(mirror.replace(/\/$/, '') + '/index.json') + .then((res) => res.json()) } async function getLatestVersionsByCodename ({ now, cache, mirror, ignoreFutureReleases }) { diff --git a/package.json b/package.json index 894e6d1..68c22d6 100644 --- a/package.json +++ b/package.json @@ -36,11 +36,11 @@ "release": "npm t && standard-version && npm publish" }, "dependencies": { - "got": "^11.8.6", "semver": "^7.1.1", "yargs": "^16.2.0" }, "devDependencies": { + "@types/node": "^20.14.11", "gen-esm-wrapper": "^1.1.3", "mocha": "^10.6.0", "standard": "^17.1.2", From d686329d5557e1dab46c2a398110797cc0bb11ad Mon Sep 17 00:00:00 2001 From: Wes Todd Date: Mon, 25 Aug 2025 10:02:15 -0500 Subject: [PATCH 2/2] fix: drop support for 24" } }