From 9e1c018d380a89f8fea472c2ac15c5ce036f9a9c Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Thu, 14 Oct 2021 17:22:52 +0700 Subject: [PATCH] Require Node.js 12.20 --- .gitattributes | 3 +-- .github/funding.yml | 3 --- .github/workflows/main.yml | 7 ++----- cli.js | 9 +++++---- dnd.js | 9 +++++---- license | 2 +- package.json | 20 +++++++++++--------- readme.md | 12 ++---------- test.js | 3 ++- 9 files changed, 29 insertions(+), 39 deletions(-) delete mode 100644 .github/funding.yml diff --git a/.gitattributes b/.gitattributes index 391f0a4..6313b56 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1 @@ -* text=auto -*.js text eol=lf +* text=auto eol=lf 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 82d1519..18c7395 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,13 +10,10 @@ jobs: fail-fast: false matrix: node-version: - - 14 - - 12 - - 10 - - 8 + - 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 de865a5..cad51da 100755 --- a/cli.js +++ b/cli.js @@ -1,7 +1,6 @@ #!/usr/bin/env node -'use strict'; -const meow = require('meow'); -const doNotDisturb = require('@sindresorhus/do-not-disturb'); +import meow from 'meow'; +import doNotDisturb from '@sindresorhus/do-not-disturb'; const cli = meow(` Usage @@ -19,7 +18,9 @@ const cli = meow(` on Use \`$ dnd\` to quickly toggle -`); +`, { + importMeta: import.meta, +}); const [command] = cli.input; diff --git a/dnd.js b/dnd.js index 93f6b9f..5375190 100755 --- a/dnd.js +++ b/dnd.js @@ -1,13 +1,14 @@ #!/usr/bin/env node -'use strict'; -const meow = require('meow'); -const doNotDisturb = require('@sindresorhus/do-not-disturb'); +import meow from 'meow'; +import doNotDisturb from '@sindresorhus/do-not-disturb'; meow(` Usage $ dnd Toggle "Do Not Disturb" -`); +`, { + importMeta: import.meta, +}); doNotDisturb.toggle(); 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 6d7ee84..807f4a2 100644 --- a/package.json +++ b/package.json @@ -4,17 +4,19 @@ "description": "Control the macOS `Do Not Disturb` feature from the command-line", "license": "MIT", "repository": "sindresorhus/do-not-disturb-cli", + "funding": "https://github.com/sponsors/sindresorhus", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" + "url": "https://sindresorhus.com" }, + "type": "module", "bin": { - "do-not-disturb": "cli.js", - "dnd": "dnd.js" + "do-not-disturb": "./cli.js", + "dnd": "./dnd.js" }, "engines": { - "node": ">=8" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "scripts": { "test": "xo && ava" @@ -31,12 +33,12 @@ "notifications" ], "dependencies": { - "@sindresorhus/do-not-disturb": "^0.2.0", - "meow": "^4.0.0" + "@sindresorhus/do-not-disturb": "^2.0.0", + "meow": "^10.1.1" }, "devDependencies": { - "ava": "*", - "execa": "^0.9.0", - "xo": "*" + "ava": "^3.15.0", + "execa": "^5.1.1", + "xo": "^0.45.0" } } diff --git a/readme.md b/readme.md index 4418e78..1e0171a 100644 --- a/readme.md +++ b/readme.md @@ -2,14 +2,12 @@ > Control the macOS `Do Not Disturb` feature from the command-line - ## Install -``` -$ npm install --global do-not-disturb-cli +```sh +npm install --global do-not-disturb-cli ``` - ## Usage ``` @@ -32,12 +30,6 @@ $ do-not-disturb --help Use `$ dnd` to quickly toggle ``` - ## Related - [do-not-disturb](https://github.com/sindresorhus/do-not-disturb) - API for this module - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/test.js b/test.js index 3110ea9..b4a9931 100644 --- a/test.js +++ b/test.js @@ -2,5 +2,6 @@ import test from 'ava'; import execa from 'execa'; test('main', async t => { - t.regex(await execa.stdout('./cli.js', ['status']), /on|off/); + const {stdout} = await execa('./cli.js', ['status']); + t.regex(stdout, /on|off/); });