# project-bin-path

> This will give path to the project's local bin

Latest version **2.0.0** (published 2018-01-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install project-bin-path
pnpm add project-bin-path
yarn add project-bin-path
bun add project-bin-path
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2018-01-15 |
| First published | 2017-11-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Ajay Narain Mathur |
| Maintainers | ajaynarainmathur |
| Keywords | path, bin, node_modules, package, script |

## Links

- npm: https://www.npmjs.com/package/project-bin-path
- Repository: https://github.com/ajaymathur/project-bin-path
- Homepage: https://github.com/ajaymathur/project-bin-path#readme
- Issues: https://github.com/ajaymathur/project-bin-path/issues
- npm.io page: https://npm.io/package/project-bin-path

## Dependencies (1)

- [find-up](https://npm.io/package/find-up.md) ^2.1.0

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2018-01-15
- 1.1.1 — 2017-12-11
- 1.1.0 — 2017-11-27
- 1.0.0 — 2017-11-27
- 0.0.4 — 2017-11-26
- 0.0.3 — 2017-11-26
- 0.0.2 — 2017-11-26
- 0.0.1 — 2017-11-25
- 0.0.0 — 2017-11-25

## README

## project-bin-path

![build description](https://travis-ci.org/ajaymathur/project-bin-path.svg?branch=master)

> Find path to local bin of Node.js or NPM package

***Inspired by [sindresorhus/pkg-dir](https://github.com/sindresorhus/pkg-dir)***

### Install:

`npm install project-bin-path`

or

`yarn add project-bin-path`

### Usage:

Project structure

```text
📁 Users/
  📁 ajaynarainmathur/
      📁 test-project/
          📁 node_modules/
              📁 .bin/
          📃 package.json
              📁 dist/
                  📃 foo.js
```

```javascript
// foo.js
const projectBinPath = require('project-bin-path')

projectBinPath(__dirname).then(binPath => {
    console.log(binPath);
    // `/Users/ajaynarainmathur/test-project/node_modules/.bin`
});
```

### Api

`projectBinPath([cwd])`

⮑ Returns a promise of path to `.bin` folder of the project or `null` if project is not found

`projectBinPath.sync([cwd])`

⮑ Returns the path to `.bin` of the project or `null`.

#### cwd

⮑ Directory to start from.

Type: `string`<br />
Default: `process.cwd()`

### Use Cases

1. When you need to get path to excutables in package ( ***not the project but of your local package*** ) just do `projectBinPath(__dirname)` => `[...]/project/node_modules/your_package/node_modules/.bin`

2. When you need to get path to excutables in project ( **project using you package*** ) just do `projectBinPath()` => `[...]/project/node_modules/.bin`

### License

MIT 🍻 [Ajay Narain Mathur](https://github.com/ajaymathur)

---
_Source: https://npm.io/package/project-bin-path · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
