Skip to content

Commit

Permalink
feat: export which package as global
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Mar 15, 2022
1 parent c205dc2 commit 7be8255
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,16 @@ The [minimist](https://www.npmjs.com/package/minimist) package.

Available as global const `argv`.

#### `which`

The [which](https://github.com/npm/node-which) package.

```js
let node = await which('node')
let node = which.sync('node')
```

### Configuration

#### `$.shell`
Expand Down
1 change: 1 addition & 0 deletions src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export function registerGlobals() {
question,
sleep,
YAML,
which,
})
}

Expand Down
4 changes: 4 additions & 0 deletions test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ if (test('Retry works')) {
assert(Date.now() >= now + 50 * (5 - 1))
}

if (test('which available')) {
assert.equal(which.sync('npm'), await which('npm'))
}

let version
if (test('require() is working in ESM')) {
let data = require('./package.json')
Expand Down

0 comments on commit 7be8255

Please sign in to comment.