diff --git a/bin/cli.js b/bin/cli.js index 431009b4a1c..40cef49f4c9 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -474,18 +474,22 @@ For more information, see https://webpack.js.org/api/cli/.`); const delimiter = outputOptions.buildDelimiter ? `${outputOptions.buildDelimiter}\n` : ""; if (statsString) stdout.write(`${statsString}\n${delimiter}`); - - const now = new Date(); + /** + * Show a hint to donate to our Opencollective + * once a week, only on Monday + */ + const openCollectivePath = __dirname + "/opencollective.js"; const MONDAY = 1; const SIX_DAYS = 518400000; - const openCollectivePath = __dirname + "/opencollective.js"; + const now = new Date(); if (now.getDay() === MONDAY) { const { statSync, utimesSync } = require("fs"); const lastPrint = statSync(openCollectivePath).atime; const lastPrintTS = new Date(lastPrint).getTime(); - if (now.getTime() - lastPrintTS > SIX_DAYS) { + const timeSinceLastPrint = now.getTime() - lastPrintTS; + if (timeSinceLastPrint > SIX_DAYS) { require(openCollectivePath); - // On windows we need to update the atime + // On windows we need to manually update the atime utimesSync(openCollectivePath, now, now); } }