Skip to content

Commit

Permalink
Minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Nov 17, 2021
1 parent 7707880 commit 244e87a
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Expand Up @@ -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
20 changes: 10 additions & 10 deletions index.js
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 = [];
Expand Down Expand Up @@ -264,4 +264,4 @@ export const execaNode = (scriptPath, args, options = {}) => {
shell: false,
},
);
};
}
8 changes: 4 additions & 4 deletions index.test-d.ts
Expand Up @@ -36,8 +36,8 @@ try {
expectType<boolean>(unicornsResult.killed);
expectType<string | undefined>(unicornsResult.signal);
expectType<string | undefined>(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<string>(execaError.message);
expectType<number>(execaError.exitCode);
Expand Down Expand Up @@ -68,8 +68,8 @@ try {
expectType<boolean>(unicornsResult.killed);
expectType<string | undefined>(unicornsResult.signal);
expectType<string | undefined>(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<string>(execaError.message);
expectType<number>(execaError.exitCode);
Expand Down
16 changes: 8 additions & 8 deletions package.json
Expand Up @@ -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"
},
Expand Down Expand Up @@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/kill.js
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion test/node.js
Expand Up @@ -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;
Expand Down

0 comments on commit 244e87a

Please sign in to comment.