2019-05-31 12:50:27 +00:00
|
|
|
From 8cc2464baf61529ddbd7749c8238a89eda6930e3 Mon Sep 17 00:00:00 2001
|
2018-05-30 14:26:09 +00:00
|
|
|
From: Stephen Gallagher <sgallagh@redhat.com>
|
|
|
|
Date: Tue, 1 May 2018 08:05:30 -0400
|
2019-03-01 18:02:24 +00:00
|
|
|
Subject: [PATCH 2/3] Suppress NPM message to run global update
|
2018-05-30 14:26:09 +00:00
|
|
|
|
|
|
|
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
|
|
|
|
---
|
2018-09-11 13:39:22 +00:00
|
|
|
deps/npm/bin/npm-cli.js | 54 -----------------------------------------
|
|
|
|
1 file changed, 54 deletions(-)
|
2018-05-30 14:26:09 +00:00
|
|
|
|
|
|
|
diff --git a/deps/npm/bin/npm-cli.js b/deps/npm/bin/npm-cli.js
|
2019-05-31 12:50:27 +00:00
|
|
|
index 705aa472e7e5502311f24767adfb0aebab396772..e8aebe644f610bb09c3748338fd70e6c8c422cea 100755
|
2018-05-30 14:26:09 +00:00
|
|
|
--- a/deps/npm/bin/npm-cli.js
|
|
|
|
+++ b/deps/npm/bin/npm-cli.js
|
2019-05-31 12:50:27 +00:00
|
|
|
@@ -66,69 +66,15 @@
|
2018-09-11 13:39:22 +00:00
|
|
|
if (conf.usage && npm.command !== 'help') {
|
|
|
|
npm.argv.unshift(npm.command)
|
|
|
|
npm.command = 'help'
|
|
|
|
}
|
|
|
|
|
|
|
|
- var isGlobalNpmUpdate = conf.global && ['install', 'update'].includes(npm.command) && npm.argv.includes('npm')
|
|
|
|
-
|
2018-05-30 14:26:09 +00:00
|
|
|
// now actually fire up npm and run the command.
|
|
|
|
// this is how to use npm programmatically:
|
|
|
|
conf._exit = true
|
|
|
|
npm.load(conf, function (er) {
|
|
|
|
if (er) return errorHandler(er)
|
2018-08-07 14:49:16 +00:00
|
|
|
- if (
|
2018-09-11 13:39:22 +00:00
|
|
|
- !isGlobalNpmUpdate &&
|
2018-08-07 14:49:16 +00:00
|
|
|
- npm.config.get('update-notifier') &&
|
|
|
|
- !unsupported.checkVersion(process.version).unsupported
|
|
|
|
- ) {
|
2018-05-30 14:26:09 +00:00
|
|
|
- const pkg = require('../package.json')
|
|
|
|
- let notifier = require('update-notifier')({pkg})
|
2018-09-11 13:39:22 +00:00
|
|
|
- const isCI = require('ci-info').isCI
|
2018-05-30 14:26:09 +00:00
|
|
|
- if (
|
|
|
|
- notifier.update &&
|
2018-09-11 13:39:22 +00:00
|
|
|
- notifier.update.latest !== pkg.version &&
|
|
|
|
- !isCI
|
2018-05-30 14:26:09 +00:00
|
|
|
- ) {
|
|
|
|
- const color = require('ansicolors')
|
|
|
|
- const useColor = npm.config.get('color')
|
|
|
|
- const useUnicode = npm.config.get('unicode')
|
|
|
|
- const old = notifier.update.current
|
|
|
|
- const latest = notifier.update.latest
|
|
|
|
- let type = notifier.update.type
|
|
|
|
- if (useColor) {
|
|
|
|
- switch (type) {
|
|
|
|
- case 'major':
|
|
|
|
- type = color.red(type)
|
|
|
|
- break
|
|
|
|
- case 'minor':
|
|
|
|
- type = color.yellow(type)
|
|
|
|
- break
|
|
|
|
- case 'patch':
|
|
|
|
- type = color.green(type)
|
|
|
|
- break
|
|
|
|
- }
|
|
|
|
- }
|
2018-08-07 14:49:16 +00:00
|
|
|
- const changelog = `https://github.com/npm/cli/releases/tag/v${latest}`
|
2018-05-30 14:26:09 +00:00
|
|
|
- notifier.notify({
|
|
|
|
- message: `New ${type} version of ${pkg.name} available! ${
|
|
|
|
- useColor ? color.red(old) : old
|
|
|
|
- } ${useUnicode ? '→' : '->'} ${
|
|
|
|
- useColor ? color.green(latest) : latest
|
|
|
|
- }\n` +
|
|
|
|
- `${
|
|
|
|
- useColor ? color.yellow('Changelog:') : 'Changelog:'
|
|
|
|
- } ${
|
|
|
|
- useColor ? color.cyan(changelog) : changelog
|
|
|
|
- }\n` +
|
|
|
|
- `Run ${
|
|
|
|
- useColor
|
|
|
|
- ? color.green(`npm install -g ${pkg.name}`)
|
|
|
|
- : `npm i -g ${pkg.name}`
|
|
|
|
- } to update!`
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
npm.commands[npm.command](npm.argv, function (err) {
|
|
|
|
// https://genius.com/Lin-manuel-miranda-your-obedient-servant-lyrics
|
|
|
|
if (
|
|
|
|
!err &&
|
|
|
|
npm.config.get('ham-it-up') &&
|
|
|
|
--
|
2019-04-10 01:23:05 +00:00
|
|
|
2.21.0
|
2018-05-30 14:26:09 +00:00
|
|
|
|