Skip to content

Commit 031f004

Browse files
committed
feat: expose ExecOptions
1 parent 57cc87d commit 031f004

5 files changed

Lines changed: 14 additions & 4 deletions

File tree

.changeset/thick-roses-unite.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hyperse/exec-program": patch
3+
---
4+
5+
export `ExecOptions`

src/exec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { execa, Options } from 'execa';
1+
import { execa } from 'execa';
2+
import { ExecOptions } from './types.js';
23

34
/**
45
* Execute a file with arguments and options
@@ -26,7 +27,7 @@ import { execa, Options } from 'execa';
2627
* @param options - Options to pass to `execa`
2728
* @returns A `ResultPromise` that is both:
2829
*/
29-
export function exec<T extends Options>(
30+
export function exec<T extends ExecOptions>(
3031
file: string,
3132
args?: readonly string[],
3233
options?: T

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export * from './exec.js';
22
export * from './runTsScript.js';
3+
export * from './types.js';

src/runTsScript.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import type { Options } from 'execa';
21
import { execa } from 'execa';
2+
import { ExecOptions } from './types.js';
33

44
/**
55
* Process execute typescript script file using `@hyperse/ts-node-paths`
66
* @param program - The absolute typescript file path
77
* @param options - The configuration of `execa` { env: { TS_NODE_PATHS_PROJECT: tsconfig } }
88
* @param args - The runtime argv for program
99
*/
10-
export const runTsScript = <T extends Options>(
10+
export const runTsScript = <T extends ExecOptions>(
1111
program: string,
1212
args?: readonly string[],
1313
options?: T

src/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import type { Options } from 'execa';
2+
3+
export type ExecOptions = Options;

0 commit comments

Comments
 (0)