Skip to content

Commit a1d8d9d

Browse files
committedOct 27, 2023
Drop Yarn install commands in update message
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.
1 parent 3046d0f commit a1d8d9d

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed
 

‎package.json

-2
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,10 @@
4040
"boxen": "^7.0.0",
4141
"chalk": "^5.0.1",
4242
"configstore": "^6.0.0",
43-
"has-yarn": "^3.0.0",
4443
"import-lazy": "^4.0.0",
4544
"is-ci": "^3.0.1",
4645
"is-installed-globally": "^0.4.0",
4746
"is-npm": "^6.0.0",
48-
"is-yarn-global": "^0.4.0",
4947
"latest-version": "^7.0.0",
5048
"pupa": "^3.1.0",
5149
"semver": "^7.3.7",

‎update-notifier.js

+1-13
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import semverDiff from 'semver-diff';
1010
import latestVersion from 'latest-version';
1111
import {isNpmOrYarn} from 'is-npm';
1212
import isInstalledGlobally from 'is-installed-globally';
13-
import isYarnGlobal from 'is-yarn-global';
14-
import hasYarn from 'has-yarn';
1513
import boxen from 'boxen';
1614
import {xdgConfig} from 'xdg-basedir';
1715
import isCi from 'is-ci';
@@ -134,20 +132,10 @@ export default class UpdateNotifier {
134132

135133
options = {
136134
isGlobal: isInstalledGlobally,
137-
isYarnGlobal: isYarnGlobal(),
138135
...options,
139136
};
140137

141-
let installCommand;
142-
if (options.isYarnGlobal) {
143-
installCommand = `yarn global add ${this._packageName}`;
144-
} else if (options.isGlobal) {
145-
installCommand = `npm i -g ${this._packageName}`;
146-
} else if (hasYarn()) {
147-
installCommand = `yarn add ${this._packageName}`;
148-
} else {
149-
installCommand = `npm i ${this._packageName}`;
150-
}
138+
const installCommand = options.isGlobal ? `npm i -g ${this._packageName}` : `npm i ${this._packageName}`;
151139

152140
const defaultTemplate = 'Update available '
153141
+ chalk.dim('{currentVersion}')

0 commit comments

Comments
 (0)
Please sign in to comment.