Skip to content

Commit

Permalink
Drop Yarn install commands in update message
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sindresorhus committed Oct 27, 2023
1 parent 3046d0f commit a1d8d9d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 1 addition & 13 deletions update-notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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}')
Expand Down

0 comments on commit a1d8d9d

Please sign in to comment.