Skip to content

Commit 002352a

Browse files
committed
fix: don't filter picks based on modified date after all
1 parent 9e462b5 commit 002352a

4 files changed

Lines changed: 16 additions & 20 deletions

File tree

modules/runtime/server/cache.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,14 @@ function getMockForUrl(url: string): MockResult | null {
246246
return {
247247
data: {
248248
hits: [
249-
{ name: 'nuxt', downloadsLast30Days: 500_000, modified: new Date().toISOString() },
250-
{ name: 'pnpm', downloadsLast30Days: 800_000, modified: new Date().toISOString() },
251-
{ name: 'express', downloadsLast30Days: 1_000_000, modified: new Date().toISOString() },
252-
{ name: 'minimatch', downloadsLast30Days: 600_000, modified: new Date().toISOString() },
253-
{ name: 'next', downloadsLast30Days: 700_000, modified: new Date().toISOString() },
254-
{ name: 'axios', downloadsLast30Days: 900_000, modified: new Date().toISOString() },
255-
{ name: 'remix', downloadsLast30Days: 400_000, modified: new Date().toISOString() },
256-
{ name: 'webpack', downloadsLast30Days: 750_000, modified: new Date().toISOString() },
249+
{ name: 'nuxt', downloadsLast30Days: 500_000 },
250+
{ name: 'pnpm', downloadsLast30Days: 800_000 },
251+
{ name: 'express', downloadsLast30Days: 1_000_000 },
252+
{ name: 'minimatch', downloadsLast30Days: 600_000 },
253+
{ name: 'next', downloadsLast30Days: 700_000 },
254+
{ name: 'axios', downloadsLast30Days: 900_000 },
255+
{ name: 'remix', downloadsLast30Days: 400_000 },
256+
{ name: 'webpack', downloadsLast30Days: 750_000 },
257257
],
258258
},
259259
}

server/api/picks.get.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
NPMX_LETTERS,
44
ALGOLIA_POOL_SIZE,
55
MIN_DOWNLOADS_LAST_30_DAYS,
6-
MAX_MODIFIED_AGE_MS,
76
LIKES_SAMPLE_SIZE,
87
selectPicks,
98
type NpmxLetter,
@@ -27,7 +26,6 @@ function randomSample<T>(arr: T[], n: number): T[] {
2726
interface AlgoliaHit {
2827
name: string
2928
downloadsLast30Days: number
30-
modified: string
3129
isDeprecated?: boolean
3230
}
3331

@@ -62,7 +60,6 @@ export default defineCachedEventHandler(
6260
const pool = algoliaResponse.hits.filter(hit => {
6361
if (hit.isDeprecated) return false
6462
if (hit.downloadsLast30Days < MIN_DOWNLOADS_LAST_30_DAYS) return false
65-
if (now - new Date(hit.modified).getTime() > MAX_MODIFIED_AGE_MS) return false
6663
return true
6764
})
6865

server/utils/picks.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export type NpmxLetter = (typeof NPMX_LETTERS)[number]
55

66
export const MIN_LIKES = 5
77
export const MIN_DOWNLOADS_LAST_30_DAYS = 10_000
8-
export const MAX_MODIFIED_AGE_MS = 730 * 24 * 60 * 60 * 1000
98
export const ALGOLIA_POOL_SIZE = 500
109
export const LIKES_SAMPLE_SIZE = 30
1110

test/fixtures/mock-routes.cjs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -527,14 +527,14 @@ function matchGitHubApi(urlString) {
527527
function matchAlgoliaApi(_urlString) {
528528
return json({
529529
hits: [
530-
{ name: 'nuxt', downloadsLast30Days: 500000, modified: new Date().toISOString() },
531-
{ name: 'pnpm', downloadsLast30Days: 800000, modified: new Date().toISOString() },
532-
{ name: 'express', downloadsLast30Days: 1000000, modified: new Date().toISOString() },
533-
{ name: 'minimatch', downloadsLast30Days: 600000, modified: new Date().toISOString() },
534-
{ name: 'next', downloadsLast30Days: 700000, modified: new Date().toISOString() },
535-
{ name: 'axios', downloadsLast30Days: 900000, modified: new Date().toISOString() },
536-
{ name: 'remix', downloadsLast30Days: 400000, modified: new Date().toISOString() },
537-
{ name: 'webpack', downloadsLast30Days: 750000, modified: new Date().toISOString() },
530+
{ name: 'nuxt', downloadsLast30Days: 500000 },
531+
{ name: 'pnpm', downloadsLast30Days: 800000 },
532+
{ name: 'express', downloadsLast30Days: 1000000 },
533+
{ name: 'minimatch', downloadsLast30Days: 600000 },
534+
{ name: 'next', downloadsLast30Days: 700000 },
535+
{ name: 'axios', downloadsLast30Days: 900000 },
536+
{ name: 'remix', downloadsLast30Days: 400000 },
537+
{ name: 'webpack', downloadsLast30Days: 750000 },
538538
],
539539
})
540540
}

0 commit comments

Comments
 (0)