From e32ba2abfa0bf9f6540a86340c9072fc248e29ec Mon Sep 17 00:00:00 2001 From: Liran Tal Date: Mon, 4 Mar 2024 08:30:15 +0200 Subject: [PATCH 1/2] fix: remove console.log --- lib/marshalls/author.marshall.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/marshalls/author.marshall.js b/lib/marshalls/author.marshall.js index b8333e0..9a8b217 100644 --- a/lib/marshalls/author.marshall.js +++ b/lib/marshalls/author.marshall.js @@ -70,7 +70,6 @@ class Marshall extends BaseMarshall { // get date in ms const currentDate = new Date() const dateDiffInMsVersionPublished = currentDate - new Date(versionPublishedDateString) - console.log(dateDiffInMsVersionPublished) let dateDiffVersionPublished = 0 if (dateDiffInMsVersionPublished > 0) { dateDiffVersionPublished = Math.round(dateDiffInMsVersionPublished / (1000 * 60 * 60 * 24)) From 89275d97cb86779e3cdee49c2430221ddeb9374a Mon Sep 17 00:00:00 2001 From: Liran Tal Date: Mon, 4 Mar 2024 08:31:36 +0200 Subject: [PATCH 2/2] feat: new warning if download count is low --- lib/marshalls/downloads.marshall.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/marshalls/downloads.marshall.js b/lib/marshalls/downloads.marshall.js index 91c5228..f464b0e 100644 --- a/lib/marshalls/downloads.marshall.js +++ b/lib/marshalls/downloads.marshall.js @@ -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) { @@ -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 }) }