Skip to content

Commit

Permalink
Require Node.js 10
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Apr 21, 2020
1 parent e21ab95 commit 0df5bcb
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 20 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ language: node_js
node_js:
- '12'
- '10'
- '6'
- '4'
17 changes: 10 additions & 7 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ const got = require('got');
meow(`
Usage
$ is-github-down
🦄 It's down. Go outside!
🦄 It's down. Play with your 😸/🐶! And stay home!
`);

got.head('github.com').then(() => {
console.error(`\n 🐈 It's up. Go back to work!`);
process.exitCode = 1;
}).catch(() => {
console.log(`\n🦄 It's down. Go outside!`);
});
(async () => {
try {
await got.head('https://github.com', {timeout: 10});
console.error('\n 🐈 It\'s up. Go back to work!');
process.exitCode = 1;
} catch {
console.log('\n🦄 It\'s down. Play with your 😸/🐶! And stay home!');
}
})();
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"bin": "cli.js",
"engines": {
"node": ">=4"
"node": ">=10"
},
"scripts": {
"test": "xo && ava"
Expand All @@ -30,12 +30,12 @@
"status"
],
"dependencies": {
"got": "^6.1.1",
"meow": "^3.7.0"
"got": "^11.0.1",
"meow": "^6.1.0"
},
"devDependencies": {
"ava": "^0.25.0",
"execa": "^0.2.2",
"xo": "^0.16.0"
"ava": "^2.4.0",
"execa": "^4.0.0",
"xo": "^0.29.1"
}
}
8 changes: 7 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

> Check if GitHub is down
## Quick usage

```
$ npx is-github-down
```

## Install

```
Expand All @@ -15,5 +21,5 @@ $ is-github-down
Usage
$ is-github-down
🦄 It's down. Go outside!
🦄 It's down. Play with your 😸/🐶! And stay home!
```
10 changes: 6 additions & 4 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ test('main', async t => {
let returnValue;

try {
returnValue = await execa('./cli.js');
} catch (err) {
returnValue = err.stderr;
const {stdout} = await execa('./cli.js');
returnValue = stdout;
} catch (error) {
const {stdout} = error;
returnValue = stdout;
}

t.true(/down|up/.test(returnValue));
t.regex(returnValue, /down|up/);
});

0 comments on commit 0df5bcb

Please sign in to comment.