From a1d8d9d9150d00dbc908820dc3fe8b33bac3003a Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Fri, 27 Oct 2023 18:58:42 +0700 Subject: [PATCH] Drop Yarn install commands in update message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Yarn users should know how to translate from npm commands already as most packages document npm commands only. It’s also unfair to other package managers, like `pnpm` and `bun` that we don’t include them and I don’t want to maintain install commands for all of them. --- package.json | 2 -- update-notifier.js | 14 +------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/package.json b/package.json index 7d10f67..95a8d37 100644 --- a/package.json +++ b/package.json @@ -40,12 +40,10 @@ "boxen": "^7.0.0", "chalk": "^5.0.1", "configstore": "^6.0.0", - "has-yarn": "^3.0.0", "import-lazy": "^4.0.0", "is-ci": "^3.0.1", "is-installed-globally": "^0.4.0", "is-npm": "^6.0.0", - "is-yarn-global": "^0.4.0", "latest-version": "^7.0.0", "pupa": "^3.1.0", "semver": "^7.3.7", diff --git a/update-notifier.js b/update-notifier.js index 69abbd5..7d6c141 100644 --- a/update-notifier.js +++ b/update-notifier.js @@ -10,8 +10,6 @@ import semverDiff from 'semver-diff'; import latestVersion from 'latest-version'; import {isNpmOrYarn} from 'is-npm'; import isInstalledGlobally from 'is-installed-globally'; -import isYarnGlobal from 'is-yarn-global'; -import hasYarn from 'has-yarn'; import boxen from 'boxen'; import {xdgConfig} from 'xdg-basedir'; import isCi from 'is-ci'; @@ -134,20 +132,10 @@ export default class UpdateNotifier { options = { isGlobal: isInstalledGlobally, - isYarnGlobal: isYarnGlobal(), ...options, }; - let installCommand; - if (options.isYarnGlobal) { - installCommand = `yarn global add ${this._packageName}`; - } else if (options.isGlobal) { - installCommand = `npm i -g ${this._packageName}`; - } else if (hasYarn()) { - installCommand = `yarn add ${this._packageName}`; - } else { - installCommand = `npm i ${this._packageName}`; - } + const installCommand = options.isGlobal ? `npm i -g ${this._packageName}` : `npm i ${this._packageName}`; const defaultTemplate = 'Update available ' + chalk.dim('{currentVersion}')