Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop redundant dependency #236

Merged
merged 3 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"latest-version": "^9.0.0",
"pupa": "^3.1.0",
"semver": "^7.6.3",
"semver-diff": "^4.0.0",
Copy link
Contributor Author

@fregante fregante Aug 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

semver-diff imports the whole of semver anyway: https://github.com/sindresorhus/semver-diff/blob/main/index.js

"xdg-basedir": "^5.1.0"
},
"devDependencies": {
Expand Down
7 changes: 4 additions & 3 deletions update-notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import path from 'node:path';
import {format} from 'node:util';
import ConfigStore from 'configstore';
import chalk from 'chalk';
import semver from 'semver';
import semverDiff from 'semver-diff';
// Only import what we need for performance
import semverDiff from 'semver/functions/diff.js';
import semverGt from 'semver/functions/gt.js';
import latestVersion from 'latest-version';
import {isNpmOrYarn} from 'is-npm';
import isInstalledGlobally from 'is-installed-globally';
Expand Down Expand Up @@ -126,7 +127,7 @@ export default class UpdateNotifier {

notify(options) {
const suppressForNpm = !this._shouldNotifyInNpmScript && isNpmOrYarn;
if (!process.stdout.isTTY || suppressForNpm || !this.update || !semver.gt(this.update.latest, this.update.current)) {
if (!process.stdout.isTTY || suppressForNpm || !this.update || !semverGt(this.update.latest, this.update.current)) {
return this;
}

Expand Down