@samitouri / QOS-React-2 / commits / 3314115cb4

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

Co-authored-by: abhyuday <abhyuday@miqdigital.com>

Abhyuday Bharat committed Oct 22, 2020 at 18:22 UTC 3314115cb484af42e7090180503ea9850aaa1e1a
1 file changed +13 -2
packages/react-devtools/bin.js
+13 -2
@@ -15,8 +15,19 @@ const argv = process.argv.slice(2);
15 const pkg = require('./package.json');
16 const updateNotifier = require('update-notifier');
17
18 -// notify if there's an update
19 -updateNotifier({pkg}).notify({defer: false});
18 +// Notify if there's an update in 7 days' interval
19 +const notifier = updateNotifier({
20 + pkg,
21 + updateCheckInterval: 1000 * 60 * 60 * 24 * 7,
22 +});
23 +
24 +if (notifier.update) {
25 + const updateMsg =
26 + `Update available ${notifier.update.current} -> ${notifier.update.latest}` +
27 + '\nTo update:' +
28 + '\n"npm i [-g] react-devtools" or "yarn add react-devtools"';
29 + notifier.notify({defer: false, message: updateMsg});
30 +}
31
32 const result = spawn.sync(electron, [require.resolve('./app')].concat(argv), {
33 stdio: 'ignore',