-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.d.ts
67 lines (64 loc) · 1.75 KB
/
main.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* `get-bin-path` options
*/
export type BinaryOptions = Partial<{
/**
* Name of the binary.
*
* Only needs to be specified when the package exports several binaries in the
* `package.json`
* [`bin`](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#bin) or
* [`directories.bin`](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#directoriesbin)
* field.
*
* When the `package.json`'s `bin` or `directories.bin` field is a `string`,
* the package
* [`name` field](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#name)
* must match the `name` option.
*
* @default `package.json` `name` property
*
* @example
* ```json
* {
* "name": "foo",
* "bin": {
* "foo": "path/to/foo.js",
* "bar": "path/to/bar.js"
* }
* }
* ```
*/
name: string
/**
* Override the current directory, which is used when retrieving the
* `package.json`.
*
* @default "."
*/
cwd: string
}>
/**
* Get the current package's binary path (using the `package.json`
* [`bin`](https://docs.npmjs.com/files/package.json#bin) or
* [`directories.bin`](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#directoriesbin)
* field).
*
* @example
* ```js
* const binPath = await getBinPath()
* ```
*/
export function getBinPath(options?: BinaryOptions): Promise<string | undefined>
/**
* Get the current package's binary path (using the `package.json`
* [`bin`](https://docs.npmjs.com/files/package.json#bin) or
* [`directories.bin`](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#directoriesbin)
* field).
*
* @example
* ```js
* const binPath = getBinPathSync()
* ```
*/
export function getBinPathSync(options?: BinaryOptions): string | undefined