All Projects → ehmicky → get-bin-path

ehmicky / get-bin-path

Licence: Apache-2.0 license
Get the current package's binary path

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to get-bin-path

lookpath
The minimum and most straightforward way to check if command exists and where the executable is, without spawning child_process.
Stars: ✭ 49 (+96%)
Mutual labels:  binary, path, executable
Gitdependencyresolverforunity
This plugin resolves git url dependencies in the package for Unity Package Manager. You can use a git url as a package dependency!
Stars: ✭ 126 (+404%)
Mutual labels:  package-manager, package
Unityasync
Task and Async Utility Package for Unity. Start co-routines from anywhere.
Stars: ✭ 58 (+132%)
Mutual labels:  package-manager, package
Boss
Dependency Manager for Delphi
Stars: ✭ 188 (+652%)
Mutual labels:  package-manager, package
Npm Git Install
Clones and (re)installs packages from remote git repos. See npm/npm#3055
Stars: ✭ 49 (+96%)
Mutual labels:  package-manager, package
Github
a module for building, searching, installing, managing, and mining Stata packages from GitHub
Stars: ✭ 56 (+124%)
Mutual labels:  package-manager, package
Laravel Paket
Composer GUI. Manage Laravel dependencies from web interface without switching to command line!
Stars: ✭ 143 (+472%)
Mutual labels:  package-manager, package
Trex
Package Manager for deno 🦕
Stars: ✭ 433 (+1632%)
Mutual labels:  package-manager, package
xbedump
Tool to dump header information or sign original Xbox executables
Stars: ✭ 18 (-28%)
Mutual labels:  binary, executable
gpkg
🌎 A global Node binary manager written in Rust
Stars: ✭ 53 (+112%)
Mutual labels:  package, binary
Unity Package Tools
A set of developer tools to make it easier to create and distribute packages for the native Unity Package Manager.
Stars: ✭ 44 (+76%)
Mutual labels:  package-manager, package
MGM-Ability
No description or website provided.
Stars: ✭ 64 (+156%)
Mutual labels:  package-manager, package
Projeny
A project and package manager for Unity
Stars: ✭ 656 (+2524%)
Mutual labels:  package-manager, package
cati
Cati Unix Package Manager
Stars: ✭ 19 (-24%)
Mutual labels:  package-manager, package
Upmgitextension
This package extends the UI of Unity Package Manager (UPM) for the packages installed from git repository.
Stars: ✭ 438 (+1652%)
Mutual labels:  package-manager, package
Pip Check
pip-check gives you a quick overview of all installed packages and their update status.
Stars: ✭ 134 (+436%)
Mutual labels:  package-manager, package
Universe
The Mesosphere Universe package repository.
Stars: ✭ 308 (+1132%)
Mutual labels:  package-manager, package
Portage
[MIRROR] Package management system
Stars: ✭ 336 (+1244%)
Mutual labels:  package-manager, package
Setup Miniconda
Set up your GitHub Actions workflow with conda via miniconda
Stars: ✭ 222 (+788%)
Mutual labels:  package-manager, package
jean
Bored from installing tiny shell scripts and .dotfiles manually? Huh! Missing Shell Package Manager For Linux
Stars: ✭ 21 (-16%)
Mutual labels:  package-manager, package

Codecov Node TypeScript Twitter Medium

Get the current package's binary path (using the package.json bin field).

This is useful when testing a package's binary. Using get-bin-path (as opposed to hard-coding the path to the binary):

  • validates that the package.json bin field is correctly setup.
  • decouples the binary path from the tests, which allows moving the file without rewriting the tests.

Examples

import { getBinPath } from 'get-bin-path'

// `binPath` is the absolute path to the current package's binary
const binPath = await getBinPath()
// Test runner
import test from 'ava'
// Library to execute child processes / commands
import { execa } from 'execa'
import { getBinPath } from 'get-bin-path'

const binPath = await getBinPath()

test('Binary file should return "true"', async (t) => {
  const { stdout } = await execa(binPath)
  t.is(stdout, 'true')
})

Install

npm install get-bin-path

This package is an ES module and must be loaded using an import or import() statement, not require().

API

getBinPath(options?)

options: object
Returns: Promise<string | undefined>

Returns the current package's binary absolute path. When no package.json or binary can be found, undefined is returned instead.

import { getBinPath } from 'get-bin-path'

const binPath = await getBinPath()

getBinPathSync(options?)

options: object
Returns: string | undefined

Same but synchronous.

import { getBinPathSync } from 'get-bin-path'

const binPath = getBinPathSync()

options

Type: object

options.name

Type: string
Default: package.json name property

Name of the binary. Only needs to be specified when the package exports several binaries.

options.cwd

Type: string
Default: Current directory

Override the current directory, which is used when retrieving the package.json.

See also

  • execa: process execution for humans

Support

For any question, don't hesitate to submit an issue on GitHub.

Everyone is welcome regardless of personal background. We enforce a Code of conduct in order to promote a positive and inclusive environment.

Contributing

This project was made with ❤️. The simplest way to give back is by starring and sharing it online.

If the documentation is unclear or has a typo, please click on the page's Edit button (pencil icon) and suggest a correction.

If you would like to help us fix a bug or add a new feature, please check our guidelines. Pull requests are welcome!

Thanks go to our wonderful contributors:


ehmicky

💻 🎨 🤔 📖

Daniel Stockman

💻

Kabir Baidhya

💻
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].