File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed
Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 11'use strict'
2- const got = require ( 'got' )
2+ // const got = require('got')
33const semver = require ( 'semver' )
44const _cache = new Map ( )
55
@@ -59,15 +59,21 @@ function resolveAlias (versions, alias) {
5959}
6060
6161function getSchedule ( cache ) {
62- return got ( 'https://raw.githubusercontent.com/nodejs/Release/master/schedule.json' , {
63- cache
64- } ) . json ( )
62+ const cached = cache . get ( 'schedule' )
63+ if ( cached ) {
64+ return Promise . resolve ( cached )
65+ }
66+ return fetch ( 'https://raw.githubusercontent.com/nodejs/Release/master/schedule.json' )
67+ . then ( ( res ) => res . json ( ) )
6568}
6669
6770function getVersions ( cache , mirror ) {
68- return got ( mirror . replace ( / \/ $ / , '' ) + '/index.json' , {
69- cache
70- } ) . json ( )
71+ const cached = cache . get ( 'versions' )
72+ if ( cached ) {
73+ return Promise . resolve ( cached )
74+ }
75+ return fetch ( mirror . replace ( / \/ $ / , '' ) + '/index.json' )
76+ . then ( ( res ) => res . json ( ) )
7177}
7278
7379async function getLatestVersionsByCodename ( now , cache , mirror ) {
Original file line number Diff line number Diff line change 3434 "release" : " npm t && standard-version && npm publish"
3535 },
3636 "dependencies" : {
37- "got" : " ^11.8.3" ,
3837 "semver" : " ^7.1.1" ,
3938 "yargs" : " ^16.2.0"
4039 },
4140 "devDependencies" : {
41+ "@types/node" : " ^20.14.11" ,
4242 "gen-esm-wrapper" : " ^1.1.3" ,
4343 "mocha" : " ^10.6.0" ,
4444 "standard" : " ^17.1.0" ,
You can’t perform that action at this time.
0 commit comments