Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overly eager update-notifier usage in react-devtools #20078

Merged
merged 3 commits into from
Oct 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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