From 244e87a2e696c2d22e0f2b311de29142353402ee Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Wed, 17 Nov 2021 17:52:23 +0700 Subject: [PATCH] Minor tweaks --- .github/workflows/main.yml | 6 +++--- index.js | 20 ++++++++++---------- index.test-d.ts | 8 ++++---- package.json | 16 ++++++++-------- readme.md | 4 ++-- test/kill.js | 2 +- test/node.js | 2 +- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e9ba5d9ef7..a285fcf2b6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,12 +19,12 @@ jobs: - windows-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - run: npm install - run: npm test - - uses: codecov/codecov-action@v1 - if: matrix.os == 'ubuntu-latest' && matrix.node-version == 14 + - uses: codecov/codecov-action@v2 + if: matrix.os == 'ubuntu-latest' && matrix.node-version == 16 with: fail_ci_if_error: true diff --git a/index.js b/index.js index ff33fce3aa..9df491ded1 100644 --- a/index.js +++ b/index.js @@ -72,7 +72,7 @@ const handleOutput = (options, value, error) => { return value; }; -export const execa = (file, args, options) => { +export function execa(file, args, options) { const parsed = handleArguments(file, args, options); const command = joinCommand(file, args); const escapedCommand = getEscapedCommand(file, args); @@ -159,9 +159,9 @@ export const execa = (file, args, options) => { spawned.all = makeAllStream(spawned, parsed.options); return mergePromise(spawned, handlePromiseOnce); -}; +} -export const execaSync = (file, args, options) => { +export function execaSync(file, args, options) { const parsed = handleArguments(file, args, options); const command = joinCommand(file, args); const escapedCommand = getEscapedCommand(file, args); @@ -222,19 +222,19 @@ export const execaSync = (file, args, options) => { isCanceled: false, killed: false, }; -}; +} -export const execaCommand = (command, options) => { +export function execaCommand(command, options) { const [file, ...args] = parseCommand(command); return execa(file, args, options); -}; +} -export const execaCommandSync = (command, options) => { +export function execaCommandSync(command, options) { const [file, ...args] = parseCommand(command); return execaSync(file, args, options); -}; +} -export const execaNode = (scriptPath, args, options = {}) => { +export function execaNode(scriptPath, args, options = {}) { if (args && !Array.isArray(args) && typeof args === 'object') { options = args; args = []; @@ -264,4 +264,4 @@ export const execaNode = (scriptPath, args, options = {}) => { shell: false, }, ); -}; +} diff --git a/index.test-d.ts b/index.test-d.ts index 9b1d0924bf..5e06366a57 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -36,8 +36,8 @@ try { expectType(unicornsResult.killed); expectType(unicornsResult.signal); expectType(unicornsResult.signalDescription); -} catch (error) { // eslint-disable-line @typescript-eslint/no-implicit-any-catch - const execaError: ExecaError = error; +} catch (error: unknown) { + const execaError = error as ExecaError; expectType(execaError.message); expectType(execaError.exitCode); @@ -68,8 +68,8 @@ try { expectType(unicornsResult.killed); expectType(unicornsResult.signal); expectType(unicornsResult.signalDescription); -} catch (error) { // eslint-disable-line @typescript-eslint/no-implicit-any-catch - const execaError: ExecaSyncError = error; +} catch (error: unknown) { + const execaError = error as ExecaSyncError; expectType(execaError.message); expectType(execaError.exitCode); diff --git a/package.json b/package.json index 3f3a87bb0c..9ac392e3f5 100644 --- a/package.json +++ b/package.json @@ -10,11 +10,11 @@ "email": "sindresorhus@gmail.com", "url": "https://sindresorhus.com" }, + "type": "module", + "exports": "./index.js", "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, - "type": "module", - "exports": "./index.js", "scripts": { "test": "xo && c8 ava && tsd" }, @@ -42,24 +42,24 @@ ], "dependencies": { "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", + "get-stream": "^6.0.1", "human-signals": "^3.0.1", "is-stream": "^3.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^5.0.1", "onetime": "^6.0.0", - "signal-exit": "^3.0.3", + "signal-exit": "^3.0.5", "strip-final-newline": "^3.0.0" }, "devDependencies": { "@types/node": "^16.11.7", "ava": "^3.15.0", "c8": "^7.10.0", - "get-node": "^11.0.1", + "get-node": "^12.0.0", "is-running": "^2.1.0", - "p-event": "^4.2.0", - "tempfile": "^3.0.0", - "tsd": "^0.13.1", + "p-event": "^5.0.1", + "tempfile": "^4.0.0", + "tsd": "^0.18.0", "xo": "^0.46.4" }, "c8": { diff --git a/readme.md b/readme.md index 33f031a365..a9db621b9f 100644 --- a/readme.md +++ b/readme.md @@ -22,8 +22,8 @@ This package improves [`child_process`](https://nodejs.org/api/child_process.htm ## Install -``` -$ npm install execa +```sh +npm install execa ``` ## Usage diff --git a/test/kill.js b/test/kill.js index 7cf7c09eff..08ae393bf2 100644 --- a/test/kill.js +++ b/test/kill.js @@ -2,7 +2,7 @@ import path from 'node:path'; import process from 'node:process'; import {fileURLToPath} from 'node:url'; import test from 'ava'; -import pEvent from 'p-event'; +import {pEvent} from 'p-event'; import isRunning from 'is-running'; import {execa, execaSync} from '../index.js'; diff --git a/test/node.js b/test/node.js index acebef121d..eeead60823 100644 --- a/test/node.js +++ b/test/node.js @@ -2,7 +2,7 @@ import path from 'node:path'; import process from 'node:process'; import {fileURLToPath} from 'node:url'; import test from 'ava'; -import pEvent from 'p-event'; +import {pEvent} from 'p-event'; import {execaNode} from '../index.js'; process.env.PATH = fileURLToPath(new URL('./fixtures', import.meta.url)) + path.delimiter + process.env.PATH;