File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ const stat = promisify(require('fs').stat)
1111const writeFile = promisify ( require ( 'fs' ) . writeFile )
1212const { resolve } = require ( 'path' )
1313
14+ const SKIP = Symbol ( 'SKIP' )
15+
1416const isGlobalNpmUpdate = npm => {
1517 return npm . flatOptions . global &&
1618 [ 'install' , 'update' ] . includes ( npm . command ) &&
@@ -38,7 +40,7 @@ const updateNotifier = async (npm, spec = 'latest') => {
3840 if ( ! npm . config . get ( 'update-notifier' ) ||
3941 isGlobalNpmUpdate ( npm ) ||
4042 ciDetect ( ) ) {
41- return null
43+ return SKIP
4244 }
4345
4446 // if we're on a prerelease train, then updates are coming fast
@@ -118,6 +120,12 @@ const updateNotifier = async (npm, spec = 'latest') => {
118120// only update the notification timeout if we actually finished checking
119121module . exports = async npm => {
120122 const notification = await updateNotifier ( npm )
123+
124+ // dont write the file if we skipped checking altogether
125+ if ( notification === SKIP ) {
126+ return null
127+ }
128+
121129 // intentional. do not await this. it's a best-effort update. if this
122130 // fails, it's ok. might be using /dev/null as the cache or something weird
123131 // like that.
You can’t perform that action at this time.
0 commit comments