diff --git a/.github/funding.yml b/.github/funding.yml deleted file mode 100644 index 1a630e9..0000000 --- a/.github/funding.yml +++ /dev/null @@ -1,3 +0,0 @@ -github: sindresorhus -open_collective: sindresorhus -custom: https://sindresorhus.com/donate diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c1870cf..441975c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,12 +10,10 @@ jobs: fail-fast: false matrix: node-version: - - 14 - - 12 - - 10 + - 16 steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - run: npm install diff --git a/cli.js b/cli.js index e23be12..64c30ff 100755 --- a/cli.js +++ b/cli.js @@ -1,9 +1,9 @@ #!/usr/bin/env node -'use strict'; -const meow = require('meow'); -const logSymbols = require('log-symbols'); -const isUp = require('is-up'); -const prependHttp = require('prepend-http'); +import process from 'node:process'; +import meow from 'meow'; +import logSymbols from 'log-symbols'; +import isUp from 'is-up'; +import prependHttp from 'prepend-http'; const cli = meow(` Example @@ -11,15 +11,17 @@ const cli = meow(` ${logSymbols.success} Up Exits with code 0 if up and 2 if down -`); +`, { + importMeta: import.meta, +}); if (cli.input.length === 0) { console.error('Specify a URL'); - process.exit(1); + process.exitCode = 1; +} else { + (async () => { + const up = await isUp(prependHttp(cli.input[0])); + console.log(up ? `${logSymbols.success} Up` : `${logSymbols.error} Down`); + process.exitCode = up ? 0 : 2; + })(); } - -(async () => { - const up = await isUp(prependHttp(cli.input[0])); - console.log(up ? `${logSymbols.success} Up` : `${logSymbols.error} Down`); - process.exitCode = up ? 0 : 2; -})(); diff --git a/license b/license index e7af2f7..fa7ceba 100644 --- a/license +++ b/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Sindre Sorhus (sindresorhus.com) +Copyright (c) Sindre Sorhus (https://sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/package.json b/package.json index 204534f..3632d70 100644 --- a/package.json +++ b/package.json @@ -8,13 +8,14 @@ "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" + "url": "https://sindresorhus.com" }, + "type": "module", "bin": { - "is-up": "cli.js" + "is-up": "./cli.js" }, "engines": { - "node": ">=10" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "scripts": { "test": "xo && ava" @@ -36,15 +37,15 @@ "offline" ], "dependencies": { - "is-up": "^4.0.0", - "log-symbols": "^3.0.0", - "meow": "^6.0.0", - "prepend-http": "^3.0.1" + "is-up": "^5.0.0", + "log-symbols": "^5.0.0", + "meow": "^10.1.1", + "prepend-http": "^4.0.0" }, "devDependencies": { - "ava": "^1.0.0", - "execa": "^4.0.0", - "strip-ansi": "^6.0.0", - "xo": "^0.25.4" + "ava": "^3.15.0", + "execa": "^5.1.1", + "strip-ansi": "^7.0.1", + "xo": "^0.44.0" } } diff --git a/readme.md b/readme.md index a0f0f42..0e8353e 100644 --- a/readme.md +++ b/readme.md @@ -6,8 +6,8 @@ ## Install -``` -$ npm install --global is-up-cli +```sh +npm install --global is-up-cli ``` ## Usage