pbp

project-bin-path

Find path to local bin of Node.js or NPM package ๐Ÿš€

Showing:

Popularity

Downloads/wk

5.4K

GitHub Stars

1

Maintenance

Last Commit

4yrs ago

Contributors

0

Package

Dependencies

1

Size (min+gzip)

0.9KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

project-bin-path

build description

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

Inspired by sindresorhus/pkg-dir

Install:

npm install project-bin-path

or

yarn add project-bin-path

Usage:

Project structure

๐Ÿ“ Users/
  ๐Ÿ“ ajaynarainmathur/
      ๐Ÿ“ test-project/
          ๐Ÿ“ node_modules/
              ๐Ÿ“ .bin/
          ๐Ÿ“ƒ package.json
              ๐Ÿ“ dist/
                  ๐Ÿ“ƒ foo.js
// 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
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

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100