diff --git a/.travis.yml b/.travis.yml index 55318c5..94ab01f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,5 +2,3 @@ language: node_js node_js: - '12' - '10' - - '6' - - '4' diff --git a/cli.js b/cli.js index 8528a65..6f340f0 100755 --- a/cli.js +++ b/cli.js @@ -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!'); + } +})(); diff --git a/package.json b/package.json index 90bd529..755ebac 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ }, "bin": "cli.js", "engines": { - "node": ">=4" + "node": ">=10" }, "scripts": { "test": "xo && ava" @@ -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" } } diff --git a/readme.md b/readme.md index 0d8372a..230d661 100644 --- a/readme.md +++ b/readme.md @@ -2,6 +2,12 @@ > Check if GitHub is down +## Quick usage + +``` +$ npx is-github-down +``` + ## Install ``` @@ -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! ``` diff --git a/test.js b/test.js index a9b2b6a..bf51a85 100644 --- a/test.js +++ b/test.js @@ -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/); });