From 3af73a87291abb94cf4b0f550a5f6dce7e48877f Mon Sep 17 00:00:00 2001 From: "devid.farinelli@gmail.com" Date: Wed, 13 Mar 2019 20:55:38 +0100 Subject: [PATCH] feat(opencollective prompt): work on windows setting atime by code --- bin/cli.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/cli.js b/bin/cli.js index 9bb50482867..431009b4a1c 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -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); } } }