Minor tweaks
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Sindre Sorhus · committed by Sindre Sorhus · parent 7707880 · Browse files · 7 files·+29 added−29 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
7 files+29 added−29 removed
- tests:+2 added−2 removed
- other:+27 added−27 removed
Provenance
- Commit
244e87a- Tree
7baad80- Author
Sindre Sorhus <sindresorhus@gmail.com>- Committer
Sindre Sorhus <sindresorhus@gmail.com>- Parent
7707880
7 files changed+29 added−29 removed
modified:.github/workflows/main.yml+3 added-3 removed
17 unmodified lines1819202122222324252627282728293017 unmodified lines - macos-latest - 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: truemodified:test/kill.js+1 added-1 removed
1 import path from 'node:path';2 import process from 'node:process';3 import {fileURLToPath} from 'node:url';4 import test from 'ava';5-import pEvent from 'p-event';5+import {pEvent} from 'p-event';6 import isRunning from 'is-running';7 import {execa, execaSync} from '../index.js';8 9 process.env.PATH = fileURLToPath(new URL('./fixtures', import.meta.url)) + path.delimiter + process.env.PATH;255 unmodified linesmodified:test/node.js+1 added-1 removed
123455678995 unmodified linesimport 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;
95 unmodified linesmodified:index.js+10 added-10 removed
70 unmodified lines71 72 return value;73 };74 75-export const execa = (file, args, options) => {75+export function execa(file, args, options) {76 const parsed = handleArguments(file, args, options);77 const command = joinCommand(file, args);78 const escapedCommand = getEscapedCommand(file, args);79 78 unmodified lines158 159 spawned.all = makeAllStream(spawned, parsed.options);160 161 return mergePromise(spawned, handlePromiseOnce);162-};162+}163 164-export const execaSync = (file, args, options) => {164+export function execaSync(file, args, options) {165 const parsed = handleArguments(file, args, options);166 const command = joinCommand(file, args);167 const escapedCommand = getEscapedCommand(file, args);168 52 unmodified lines221 timedOut: false,222 isCanceled: false,223 killed: false,224 };225-};225+}226 227-export const execaCommand = (command, options) => {227+export function execaCommand(command, options) {228 const [file, ...args] = parseCommand(command);229 return execa(file, args, options);230-};230+}231 232-export const execaCommandSync = (command, options) => {232+export function execaCommandSync(command, options) {233 const [file, ...args] = parseCommand(command);234 return execaSync(file, args, options);235-};235+}236 237-export const execaNode = (scriptPath, args, options = {}) => {237+export function execaNode(scriptPath, args, options = {}) {238 if (args && !Array.isArray(args) && typeof args === 'object') {239 options = args;240 args = [];241 }21 unmodified lines263 stdio,264 shell: false,265 },266 );267-};267+}modified:index.test-d.ts+4 added-4 removed
34 unmodified lines35 expectType<boolean>(unicornsResult.isCanceled);36 expectType<boolean>(unicornsResult.killed);37 expectType<string | undefined>(unicornsResult.signal);38 expectType<string | undefined>(unicornsResult.signalDescription);39-} catch (error) { // eslint-disable-line @typescript-eslint/no-implicit-any-catch40- const execaError: ExecaError = error;39+} catch (error: unknown) {40+ const execaError = error as ExecaError;41 42 expectType<string>(execaError.message);43 expectType<number>(execaError.exitCode);44 expectType<string>(execaError.stdout);22 unmodified lines67 expectError(unicornsResult.isCanceled);68 expectType<boolean>(unicornsResult.killed);69 expectType<string | undefined>(unicornsResult.signal);70 expectType<string | undefined>(unicornsResult.signalDescription);71-} catch (error) { // eslint-disable-line @typescript-eslint/no-implicit-any-catch72- const execaError: ExecaSyncError = error;71+} catch (error: unknown) {72+ const execaError = error as ExecaSyncError;73 74 expectType<string>(execaError.message);75 expectType<number>(execaError.exitCode);76 expectType<string>(execaError.stdout);129 unmodified linesmodified:package.json+8 added-8 removed
8 unmodified lines9 "name": "Sindre Sorhus",10 "email": "sindresorhus@gmail.com",11 "url": "https://sindresorhus.com"12 },13+ "type": "module",14+ "exports": "./index.js",15 "engines": {16 "node": "^12.20.0 || ^14.13.1 || >=16.0.0"17 },16- "type": "module",17- "exports": "./index.js",18 "scripts": {19 "test": "xo && c8 ava && tsd"20 },21 "files": [19 unmodified lines41 "local"42 ],43 "dependencies": {44 "cross-spawn": "^7.0.3",45- "get-stream": "^6.0.0",45+ "get-stream": "^6.0.1",46 "human-signals": "^3.0.1",47 "is-stream": "^3.0.0",48 "merge-stream": "^2.0.0",49 "npm-run-path": "^5.0.1",50 "onetime": "^6.0.0",51- "signal-exit": "^3.0.3",51+ "signal-exit": "^3.0.5",52 "strip-final-newline": "^3.0.0"53 },54 "devDependencies": {55 "@types/node": "^16.11.7",56 "ava": "^3.15.0",57 "c8": "^7.10.0",58- "get-node": "^11.0.1",58+ "get-node": "^12.0.0",59 "is-running": "^2.1.0",60- "p-event": "^4.2.0",61- "tempfile": "^3.0.0",62- "tsd": "^0.13.1",60+ "p-event": "^5.0.1",61+ "tempfile": "^4.0.0",62+ "tsd": "^0.18.0",63 "xo": "^0.46.4"64 },65 "c8": {66 "reporter": [10 unmodified linesmodified:readme.md+2 added-2 removed
20 unmodified lines21 - More descriptive errors.22 23 ## Install24 25+```sh26+npm install execa27 ```26-$ npm install execa27-```28 29 ## Usage30 31 ```js623 unmodified lines