Skip to content

Commit

Permalink
feat: new warning if download count is low
Browse files Browse the repository at this point in the history
  • Loading branch information
lirantal committed Mar 4, 2024
1 parent e32ba2a commit 89275d9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/marshalls/downloads.marshall.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
'use strict'

const BaseMarshall = require('./baseMarshall')
const Warning = require('../helpers/warning')
const { marshallCategories } = require('./constants')

const MARSHALL_NAME = 'downloads'
const DOWNLOAD_COUNT_THRESHOLD = 20 // threshold per month
const DOWNLOAD_COUNT_THRESHOLD = 100 // threshold per month
const DOWNLOAD_COUNT_UPPER_THRESHOLD = 10000 // threshold per month

class Marshall extends BaseMarshall {
constructor(options) {
Expand All @@ -25,6 +27,12 @@ class Marshall extends BaseMarshall {
)
}

if (downloadCount < DOWNLOAD_COUNT_UPPER_THRESHOLD) {
throw new Warning(
`detected a low relatively low download-count package (${downloadCount} downloads last month)`
)
}

return downloadCount
})
}
Expand Down

0 comments on commit 89275d9

Please sign in to comment.