project-bin-path
This will give path to the project's local bin
Last updated 8 years ago by ajaynarainmathur .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install project-bin-path 
SYNC missed versions from official npm registry.

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

Current Tags

  • 2.0.0                                ...           latest (8 years ago)

9 Versions

  • 2.0.0                                ...           8 years ago
  • 1.1.1                                ...           8 years ago
  • 1.1.0                                ...           8 years ago
  • 1.0.0                                ...           8 years ago
  • 0.0.4                                ...           8 years ago
  • 0.0.3                                ...           8 years ago
  • 0.0.2                                ...           8 years ago
  • 0.0.1                                ...           8 years ago
  • 0.0.0                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (1)
Dev Dependencies (2)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |