Skip to content

Commit

Permalink
Meta tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Sep 29, 2017
1 parent 6f2b074 commit 6008ccf
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 23 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1 +1,2 @@
node_modules
node_modules
yarn.lock
1 change: 1 addition & 0 deletions .npmrc
@@ -0,0 +1 @@
package-lock=false
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -46,7 +46,7 @@
"ava": "*",
"clear-module": "^2.1.0",
"fixture-stdout": "^0.2.1",
"strip-ansi": "^3.0.1",
"strip-ansi": "^4.0.0",
"xo": "^0.18.2"
}
}
14 changes: 11 additions & 3 deletions readme.md
Expand Up @@ -8,14 +8,22 @@ Inform users of your package of updates in a non-intrusive way.

#### Contents

- [Examples](#examples)
- [Install](#install)
- [Usage](#usage)
- [How](#how)
- [API](#api)
- [About](#about)
- [Users](#users)


## Examples
## Install

```
$ npm install update-notifier
```


## Usafe

### Simple

Expand Down Expand Up @@ -168,7 +176,7 @@ There are a bunch projects using it:
- [Pageres](https://github.com/sindresorhus/pageres) - Capture website screenshots
- [Node GH](http://nodegh.io) - GitHub command line tool

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


## License
Expand Down
2 changes: 1 addition & 1 deletion test/fs-error.js
Expand Up @@ -8,7 +8,7 @@ test.before(() => {
// Set configstore.config to something
// that requires root access
process.env.XDG_CONFIG_HOME = '/usr';
updateNotifier = require('../');
updateNotifier = require('..');
});

test('fail gracefully', t => {
Expand Down
30 changes: 14 additions & 16 deletions test/notify.js
Expand Up @@ -7,15 +7,15 @@ import test from 'ava';
const stderr = new FixtureStdout({
stream: process.stderr
});
let updateNotifier = require('../');
let updateNotifier = require('..');

test.before(() => {
['.', 'is-npm'].forEach(clearModule);
['npm_config_username', 'npm_package_name', 'npm_config_heading'].forEach(name => {
delete process.env[name];
});
process.stdout.isTTY = true;
updateNotifier = require('../');
updateNotifier = require('..');
});

function Control() {
Expand Down Expand Up @@ -44,23 +44,21 @@ test.afterEach(() => {
test('use pretty boxen message by default', t => {
const notifier = new Control();
notifier.notify({defer: false});
t.is(stripAnsi(errorLogs), [
'',
'',
' ╭───────────────────────────────────────────────────╮',
' │ │',
' │ Update available 0.0.2 → 1.0.0 │',
' │ Run npm i -g update-notifier-tester to update │',
' │ │',
' ╰───────────────────────────────────────────────────╯',
'',
''
].join('\n'));

t.is(stripAnsi(errorLogs), `
╭───────────────────────────────────────────────────╮
│ │
│ Update available 0.0.2 → 1.0.0 │
│ Run npm i -g update-notifier-tester to update │
│ │
╰───────────────────────────────────────────────────╯
`);
});

test('exclude -g argument when `isGlobal` option is `false`', t => {
const notifier = new Control();
notifier.notify({defer: false, isGlobal: false});
t.not(-1, stripAnsi(errorLogs)
.indexOf('Run npm i update-notifier-tester to update'));
t.not(stripAnsi(errorLogs).indexOf('Run npm i update-notifier-tester to update'), -1);
});
2 changes: 1 addition & 1 deletion test/update-notifier.js
@@ -1,6 +1,6 @@
import fs from 'fs';
import test from 'ava';
import updateNotifier from '../';
import updateNotifier from '..';

const generateSettings = options => {
options = options || {};
Expand Down

0 comments on commit 6008ccf

Please sign in to comment.