From d062b2c02a4d6d5f1a274aa8eb9c5969ca6253db Mon Sep 17 00:00:00 2001 From: isaacs Date: Thu, 6 Aug 2020 14:13:30 -0700 Subject: new npm-specific update-notifier implementation This drops our usage of the update-notifier module, in favor of checking ourselves, using the modules and UX patterns that npm already has in place. - While on a prerelease version, updates are checked for every day, instead of every week, and always checks for a new beta in the current release family. Ie, ^7.0.0-beta.2 instead of latest. - Latest version is suggested if newer than current. - If current version is newer than latest, then we check again for an update in the current version family. Ie, ^7.0.0 instead of latest, if current is 7.0.0 and latest is 6.x. - Output is printed using log.notice, at the end of all other log output, so that it's both less visually disruptive, and less likely to be missed among other warnings and notices. This has the side effect of requiring that we set npm.flatOptions as soon as config is loaded, rather than waiting for a command to be run. Since the cli runs a command immediately after loading anyway, this is not a relevant change for our purposes, but worth mentioning here. --- test/lib/npm.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'test/lib/npm.js') diff --git a/test/lib/npm.js b/test/lib/npm.js index e4e31e5d3..3c62643fc 100644 --- a/test/lib/npm.js +++ b/test/lib/npm.js @@ -115,8 +115,7 @@ t.test('npm.load', t => { t.match(npm, { loaded: true, loading: false, - // flatOptions only loaded when we run an actual command - flatOptions: null + flatOptions: {} }) t.equal(firstCalled, true, 'first callback got called') t.equal(secondCalled, true, 'second callback got called') -- cgit v1.2.3