Skip to content
Permalink
Browse files

cli: remove donation prompt

  • Loading branch information...
evenstensberg committed Jun 23, 2019
1 parent 002a6ac commit a37477dd37525a497728b3076d6745928bd5b974
Showing with 66 additions and 91 deletions.
  1. +0 −25 bin/cli.js
  2. +66 −66 package-lock.json
@@ -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;

0 comments on commit a37477d

Please sign in to comment.
You can’t perform that action at this time.