Skip to content

Commit ccaf686

Browse files
committed
Update dependencies
1 parent b1525e6 commit ccaf686

File tree

5 files changed

+27
-35
lines changed

5 files changed

+27
-35
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class UpdateNotifier {
5555
// after the set interval, so not to bother users right away
5656
lastUpdateCheck: Date.now()
5757
});
58-
} catch (error) {
58+
} catch (_) {
5959
// Expecting error code EACCES or EPERM
6060
const message =
6161
chalk().yellow(format(' %s update check failed ', options.pkg.name)) +
@@ -122,7 +122,7 @@ class UpdateNotifier {
122122
}
123123

124124
notify(options) {
125-
const suppressForNpm = !this.shouldNotifyInNpmScript && isNpm().isNpm;
125+
const suppressForNpm = !this.shouldNotifyInNpmScript && isNpm().isNpmOrYarn;
126126
if (!process.stdout.isTTY || suppressForNpm || !this.update) {
127127
return this;
128128
}

package.json

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "Update notifications for your CLI app",
55
"license": "BSD-2-Clause",
66
"repository": "yeoman/update-notifier",
7+
"funding": "https://github.com/yeoman/update-notifier?sponsor=1",
78
"author": {
89
"name": "Sindre Sorhus",
910
"email": "[email protected]",
@@ -33,26 +34,26 @@
3334
"version"
3435
],
3536
"dependencies": {
36-
"boxen": "^3.0.0",
37-
"chalk": "^2.0.1",
38-
"configstore": "^4.0.0",
37+
"boxen": "^4.2.0",
38+
"chalk": "^3.0.0",
39+
"configstore": "^5.0.0",
3940
"has-yarn": "^2.1.0",
4041
"import-lazy": "^2.1.0",
4142
"is-ci": "^2.0.0",
42-
"is-installed-globally": "^0.1.0",
43-
"is-npm": "^3.0.0",
43+
"is-installed-globally": "^0.3.1",
44+
"is-npm": "^4.0.0",
4445
"is-yarn-global": "^0.3.0",
4546
"latest-version": "^5.0.0",
46-
"semver-diff": "^2.0.0",
47-
"xdg-basedir": "^3.0.0"
47+
"semver-diff": "^3.1.1",
48+
"xdg-basedir": "^4.0.0"
4849
},
4950
"devDependencies": {
50-
"ava": "^1.3.1",
51-
"clear-module": "^3.1.0",
51+
"ava": "^2.4.0",
52+
"clear-module": "^4.0.0",
5253
"fixture-stdout": "^0.2.1",
5354
"mock-require": "^3.0.3",
54-
"strip-ansi": "^5.2.0",
55-
"xo": "^0.24.0"
55+
"strip-ansi": "^6.0.0",
56+
"xo": "^0.25.3"
5657
},
5758
"xo": {
5859
"rules": {

readme.md

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@ Inform users of your package of updates in a non-intrusive way.
1515
- [About](#about)
1616
- [Users](#users)
1717

18-
1918
## Install
2019

2120
```
2221
$ npm install update-notifier
2322
```
2423

25-
2624
## Usage
2725

2826
### Simple
@@ -71,15 +69,13 @@ if (notifier.update) {
7169
}
7270
```
7371

74-
7572
## How
7673

7774
Whenever you initiate the update notifier and it's not within the interval threshold, it will asynchronously check with npm in the background for available updates, then persist the result. The next time the notifier is initiated, the result will be loaded into the `.update` property. This prevents any impact on your package startup performance.
7875
The update check is done in a unref'ed [child process](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options). This means that if you call `process.exit`, the check will still be performed in its own process.
7976

8077
The first time the user runs your app, it will check for an update, and even if an update is available, it will wait the specified `updateCheckInterval` before notifying the user. This is done to not be annoying to the user, but might surprise you as an implementer if you're testing whether it works. Check out [`example.js`](example.js) to quickly test out `update-notifier` and see how you can test that it works in your app.
8178

82-
8379
## API
8480

8581
### notifier = updateNotifier(options)
@@ -96,17 +92,17 @@ Type: `object`
9692

9793
##### name
9894

99-
*Required*<br>
95+
*Required*\
10096
Type: `string`
10197

10298
##### version
10399

104-
*Required*<br>
100+
*Required*\
105101
Type: `string`
106102

107103
#### updateCheckInterval
108104

109-
Type: `number`<br>
105+
Type: `number`\
110106
Default: `1000 * 60 * 60 * 24` *(1 day)*
111107

112108
How often to check for updates.
@@ -119,19 +115,19 @@ Passing a callback here will make it check for an update directly and report rig
119115

120116
#### shouldNotifyInNpmScript
121117

122-
Type: `boolean`<br>
118+
Type: `boolean`\
123119
Default: `false`
124120

125121
Allows notification to be shown when running as an npm script.
126122

127123
#### distTag
128124

129-
Type: `string`<br>
130-
Default: `latest`
125+
Type: `string`\
126+
Default: `'latest'`
131127

132128
Which [dist-tag](https://docs.npmjs.com/adding-dist-tags-to-packages) to use to find the latest version.
133129

134-
### notifier.notify([options])
130+
### notifier.notify(options?)
135131

136132
Convenience method to display a notification message. *(See screenshot)*
137133

@@ -143,33 +139,32 @@ Type: `object`
143139

144140
##### defer
145141

146-
Type: `boolean`<br>
142+
Type: `boolean`\
147143
Default: `true`
148144

149145
Defer showing the notification to after the process has exited.
150146

151147
##### message
152148

153-
Type: `string`<br>
149+
Type: `string`\
154150
Default: [See above screenshot](https://github.com/yeoman/update-notifier#update-notifier-)
155151

156152
Message that will be shown when an update is available.
157153

158154
##### isGlobal
159155

160-
Type: `boolean`<br>
161-
Default: auto-detect
156+
Type: `boolean`\
157+
Default: Auto-detect
162158

163159
Include the `-g` argument in the default message's `npm i` recommendation. You may want to change this if your CLI package can be installed as a dependency of another project, and don't want to recommend a global installation. This option is ignored if you supply your own `message` (see above).
164160

165161
##### boxenOpts
166162

167-
Type: `object`<br>
163+
Type: `object`\
168164
Default: `{padding: 1, margin: 1, align: 'center', borderColor: 'yellow', borderStyle: 'round'}` *(See screenshot)*
169165

170166
Options object that will be passed to [`boxen`](https://github.com/sindresorhus/boxen).
171167

172-
173168
### User settings
174169

175170
Users of your module have the ability to opt-out of the update notifier by changing the `optOut` property to `true` in `~/.config/configstore/update-notifier-[your-module-name].json`. The path is available in `notifier.config.path`.
@@ -180,12 +175,10 @@ The check is also skipped automatically:
180175
- on CI
181176
- in unit tests (when the `NODE_ENV` environment variable is `test`)
182177

183-
184178
## About
185179

186180
The idea for this module came from the desire to apply the browser update strategy to CLI tools, where everyone is always on the latest version. We first tried automatic updating, which we discovered wasn't popular. This is the second iteration of that idea, but limited to just update notifications.
187181

188-
189182
## Users
190183

191184
There are a bunch projects using it:
@@ -199,7 +192,6 @@ There are a bunch projects using it:
199192

200193
[And 2700+ more…](https://www.npmjs.org/browse/depended/update-notifier)
201194

202-
203195
---
204196

205197
<div align="center">

test/notify.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function Control(shouldNotifyInNpmScript) {
2121
const setupTest = isNpmReturnValue => {
2222
['..', 'is-npm'].forEach(clearModule);
2323
process.stdout.isTTY = true;
24-
mock('is-npm', {isNpm: isNpmReturnValue || false});
24+
mock('is-npm', {isNpmOrYarn: isNpmReturnValue || false});
2525
const updateNotifier = require('..');
2626
util.inherits(Control, updateNotifier.UpdateNotifier);
2727
};

test/update-notifier.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import mockRequire from 'mock-require';
44

55
mockRequire('is-ci', false);
66

7-
// eslint-disable-next-line import/first
87
import updateNotifier from '..';
98

109
const generateSettings = (options = {}) => {

0 commit comments

Comments
 (0)