Skip to content

Commit

Permalink
Overly eager update-notifier usage in react-devtools (facebook#20078)
Browse files Browse the repository at this point in the history
Co-authored-by: abhyuday <abhyuday@miqdigital.com>
  • Loading branch information
2 people authored and koto committed Jun 15, 2021
1 parent 393d80c commit 9c98653
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/react-devtools/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 9c98653

Please sign in to comment.