Skip to content

Commit 55992a4

Browse files
committed
docs(opencollective prompt): improve code clarity
1 parent 3af73a8 commit 55992a4

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

bin/cli.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -474,18 +474,22 @@ For more information, see https://webpack.js.org/api/cli/.`);
474474
const delimiter = outputOptions.buildDelimiter ? `${outputOptions.buildDelimiter}\n` : "";
475475
if (statsString) stdout.write(`${statsString}\n${delimiter}`);
476476

477-
478-
const now = new Date();
477+
/**
478+
* Show a hint to donate to our Opencollective
479+
* once a week, only on Monday
480+
*/
481+
const openCollectivePath = __dirname + "/opencollective.js";
479482
const MONDAY = 1;
480483
const SIX_DAYS = 518400000;
481-
const openCollectivePath = __dirname + "/opencollective.js";
484+
const now = new Date();
482485
if (now.getDay() === MONDAY) {
483486
const { statSync, utimesSync } = require("fs");
484487
const lastPrint = statSync(openCollectivePath).atime;
485488
const lastPrintTS = new Date(lastPrint).getTime();
486-
if (now.getTime() - lastPrintTS > SIX_DAYS) {
489+
const timeSinceLastPrint = now.getTime() - lastPrintTS;
490+
if (timeSinceLastPrint > SIX_DAYS) {
487491
require(openCollectivePath);
488-
// On windows we need to update the atime
492+
// On windows we need to manually update the atime
489493
utimesSync(openCollectivePath, now, now);
490494
}
491495
}

0 commit comments

Comments
 (0)