Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat(opencollective prompt): work on windows setting atime by code
  • Loading branch information
misterdev committed Mar 13, 2019
1 parent c2351b1 commit 3af73a8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions bin/cli.js
Expand Up @@ -478,12 +478,15 @@ For more information, see https://webpack.js.org/api/cli/.`);
const now = new Date();
const MONDAY = 1;
const SIX_DAYS = 518400000;
const openCollectivePath = __dirname + "/opencollective.js";
if (now.getDay() === MONDAY) {
const statSync = require("fs").statSync;
const lastPrint = statSync(__dirname + "/opencollective.js").atime;
const { statSync, utimesSync } = require("fs");
const lastPrint = statSync(openCollectivePath).atime;
const lastPrintTS = new Date(lastPrint).getTime();
if (now.getTime() - lastPrintTS > SIX_DAYS) {
require("./opencollective");
require(openCollectivePath);
// On windows we need to update the atime
utimesSync(openCollectivePath, now, now);
}
}
}
Expand Down

0 comments on commit 3af73a8

Please sign in to comment.