Skip to content

Commit

Permalink
fix: remove api.npms.io
Browse files Browse the repository at this point in the history
The secondary npm registry we have been using seems to
have disappeared, so remove it so that it does not cause
extra 20s delay.
  • Loading branch information
tkurki committed Apr 9, 2024
1 parent 73c71cb commit e9870c7
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ function isTheServerModule(moduleName: string, config: Config) {
function findModulesWithKeyword(keyword: string) {
return new Promise((resolve, reject) => {
let errorCount = 0
let resultCount = 0
const result = {}
const handleResultWithTimeout = (fetchResult: Promise<Response>): void => {
fetchResult
Expand All @@ -236,14 +235,7 @@ function findModulesWithKeyword(keyword: string) {
},
result
)
if (resultCount++ || errorCount) {
resolve(_.values(result))
} else {
setTimeout(
() => resolve(_.values(result)),
Number(process.env.NPMREGISTRYTIMEOUT) || 20 * 1000
)
}
resolve(_.values(result))
})
.catch((e) => {
if (errorCount++) {
Expand All @@ -252,9 +244,6 @@ function findModulesWithKeyword(keyword: string) {
})
}
;[
fetch(
`https://api.npms.io/v2/search?size=250&q=keywords:${keyword}+not:deprecated`
),
fetch(
'http://registry.npmjs.org/-/v1/search?size=250&text=keywords:' +
keyword
Expand Down

0 comments on commit e9870c7

Please sign in to comment.