Skip to content

Commit

Permalink
cli: remove donation prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
evenstensberg committed Jun 23, 2019
1 parent 002a6ac commit a37477d
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 91 deletions.
25 changes: 0 additions & 25 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,31 +332,6 @@ For more information, see https://webpack.js.org/api/cli/.`);
const statsString = stats.toString(outputOptions);
const delimiter = outputOptions.buildDelimiter ? `${outputOptions.buildDelimiter}\n` : "";
if (statsString) stdout.write(`${statsString}\n${delimiter}`);

/**
* 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 now = new Date();
if (now.getDay() === MONDAY) {
const { access, constants, statSync, utimesSync } = require("fs");
const stat = statSync(openCollectivePath);
const lastPrint = stat.atime;
const fileOwnerId = stat.uid;
const lastPrintTS = new Date(lastPrint).getTime();
const timeSinceLastPrint = now.getTime() - lastPrintTS;
if (timeSinceLastPrint > SIX_DAYS) {
require(openCollectivePath);
// On windows we need to manually update the atime
// Updating utime requires process owner is as same as file owner
access(openCollectivePath, constants.W_OK, e => {
if (!e && fileOwnerId === process.getuid()) utimesSync(openCollectivePath, now, now);
});
}
}
}
if (!options.watch && stats.hasErrors()) {
process.exitCode = 2;
Expand Down
Loading

0 comments on commit a37477d

Please sign in to comment.