From 3c9c8456c668c6c479aae8768e5b84441d3f99ae Mon Sep 17 00:00:00 2001 From: abhyuday Date: Thu, 22 Oct 2020 00:03:43 +0530 Subject: [PATCH] react-devtools update-notifier interval change to 7 days & msg updated with yarn command --- packages/react-devtools/bin.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/react-devtools/bin.js b/packages/react-devtools/bin.js index 99780a2d9a4c9..ced9dce48c2b1 100755 --- a/packages/react-devtools/bin.js +++ b/packages/react-devtools/bin.js @@ -15,8 +15,19 @@ const argv = process.argv.slice(2); const pkg = require('./package.json'); const updateNotifier = require('update-notifier'); -// notify if there's an update -updateNotifier({pkg}).notify({defer: false}); +// Notify if there's an update in 7 days' interval +const notifier = updateNotifier({ + pkg, + updateCheckInterval: 1000 * 60 * 60 * 24 * 7, +}); + +if (notifier.update) { + const updateMsg = + `Update available ${notifier.update.current} -> ${notifier.update.latest}` + + '\nTo update:' + + '\n"npm i [-g] react-devtools" or "yarn add react-devtools"'; + notifier.notify({defer: false, message: updateMsg}); +} const result = spawn.sync(electron, [require.resolve('./app')].concat(argv), { stdio: 'ignore',