Skip to content

Commit

Permalink
Require Node.js 16
Browse files Browse the repository at this point in the history
Signed-off-by: Antoine Leblanc <ant.leblanc@gmail.com>
  • Loading branch information
antleblanc committed Dec 19, 2022
1 parent ceae31a commit b1f0e70
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 24 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: CI
on:
- push
- pull_request
jobs:
test:
name: Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version:
- 16
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
4 changes: 0 additions & 4 deletions .travis.yml

This file was deleted.

29 changes: 20 additions & 9 deletions cli.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
#!/usr/bin/env node
'use strict';
const meow = require('meow');
const got = require('got');
import process from 'node:process';
import meow from 'meow';
import got from 'got';

meow(`
Usage
$ is-ovhcloud-down
🦄 It's down. Go outside!
`);
`, {
importMeta: import.meta,
});

(async () => {
const {statusCode} = await got('https://ovhcloud.com', {
timeout: 10_000,
retry: 2,
});

if (statusCode !== 200) {
console.log('\n🦄 It\'s down!');
process.exitCode = 1;
return;
}

got.head('ovhcloud.com').then(() => {
console.error('\n 🐈 It\'s up!');
process.exitCode = 1;
}).catch(() => {
console.log('\n🦄 It\'s down!');
});
process.exitCode = 0;
})();
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"repository": "antleblanc/is-ovhcloud-down",
"author": {
"name": "Antoine Leblanc",
"email": "ant.leblanc@gmail.com",
"url": "antleblanc.me"
"email": "ant.leblanc@gmail.com"
},
"bin": "cli.js",
"type": "module",
"bin": "./cli.js",
"engines": {
"node": ">=10"
"node": ">=16.0.0"
},
"scripts": {
"test": "xo && ava"
Expand All @@ -29,12 +29,12 @@
"status"
],
"dependencies": {
"got": "^11.0.1",
"meow": "^6.1.0"
"got": "^11.8.2",
"meow": "^10.1.1"
},
"devDependencies": {
"ava": "^2.4.0",
"execa": "^0.6.0",
"xo": "^0.30.0"
"ava": "^3.15.0",
"execa": "^5.1.1",
"xo": "^0.45.0"
}
}
4 changes: 2 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import test from 'ava';
import execa from 'execa';

test('cli', async t => {
test('main', async t => {
let returnValue;

try {
Expand All @@ -12,5 +12,5 @@ test('cli', async t => {
returnValue = stdout;
}

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

0 comments on commit b1f0e70

Please sign in to comment.