From abc06fb14c785407e0ea4f4b9bea12841e9df063 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Thu, 31 Aug 2023 22:47:58 +0700 Subject: [PATCH] Require Node.js 18 --- .github/security.md | 3 +++ .github/workflows/main.yml | 6 ++++-- index.d.ts | 2 +- index.js | 1 + package.json | 19 +++++++++++-------- readme.md | 6 +++--- test/docker.js | 3 ++- test/sudo.js | 3 ++- test/user.js | 3 ++- 9 files changed, 29 insertions(+), 17 deletions(-) create mode 100644 .github/security.md diff --git a/.github/security.md b/.github/security.md new file mode 100644 index 0000000..5358dc5 --- /dev/null +++ b/.github/security.md @@ -0,0 +1,3 @@ +# Security Policy + +To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3b8aa86..0016e8a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,12 +10,14 @@ jobs: fail-fast: false matrix: node-version: + - 20 + - 18 - 16 - 14 - 12 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - run: npm install diff --git a/index.d.ts b/index.d.ts index b0a8699..08bd740 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,7 +1,7 @@ /** Block users from running your app with root permissions. When a file containing this function is run with root permissions it will exit and show an error message telling the user how to fix the problem, so they don't have to run it with `sudo`. -@param message - Custom message. +@param message - A custom message. @example ``` diff --git a/index.js b/index.js index 40c8d22..9337878 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,4 @@ +import process from 'node:process'; import chalk from 'chalk'; import isRoot from 'is-root'; import isDocker from 'is-docker'; diff --git a/package.json b/package.json index ef49ddb..362ae9f 100644 --- a/package.json +++ b/package.json @@ -11,9 +11,12 @@ "url": "https://sindresorhus.com" }, "type": "module", - "exports": "./index.js", + "exports": { + "types": "./index.d.ts", + "default": "./index.js" + }, "engines": { - "node": ">=12" + "node": ">=18" }, "scripts": { "//test": "xo && ava && tsd", @@ -34,15 +37,15 @@ "stop" ], "dependencies": { - "chalk": "^4.1.1", - "is-docker": "^2.2.1", + "chalk": "^5.3.0", + "is-docker": "^3.0.0", "is-root": "^3.0.0" }, "devDependencies": { - "ava": "^3.15.0", + "ava": "^5.3.1", "import-fresh": "^3.3.0", - "sinon": "^10.0.0", - "tsd": "^0.14.0", - "xo": "^0.39.1" + "sinon": "^15.2.0", + "tsd": "^0.29.0", + "xo": "^0.56.0" } } diff --git a/readme.md b/readme.md index 423028f..c1e30bc 100644 --- a/readme.md +++ b/readme.md @@ -6,8 +6,8 @@ ## Install -``` -$ npm install sudo-block +```sh +npm install sudo-block ``` ## Usage @@ -28,4 +28,4 @@ When a file containing this function is run with root permissions it will exit a Type: `string` -Custom message. +A custom message. diff --git a/test/docker.js b/test/docker.js index 214a723..c4f569c 100644 --- a/test/docker.js +++ b/test/docker.js @@ -1,4 +1,5 @@ -import fs from 'fs'; +import process from 'node:process'; +import fs from 'node:fs'; import test from 'ava'; import sinon from 'sinon'; import importFresh from 'import-fresh'; diff --git a/test/sudo.js b/test/sudo.js index 05480b4..4b73db5 100644 --- a/test/sudo.js +++ b/test/sudo.js @@ -1,4 +1,5 @@ -import fs from 'fs'; +import process from 'node:process'; +import fs from 'node:fs'; import test from 'ava'; import sinon from 'sinon'; import importFresh from 'import-fresh'; diff --git a/test/user.js b/test/user.js index a54922d..a520fd2 100644 --- a/test/user.js +++ b/test/user.js @@ -1,4 +1,5 @@ -import fs from 'fs'; +import process from 'node:process'; +import fs from 'node:fs'; import test from 'ava'; import sinon from 'sinon'; import importFresh from 'import-fresh';