Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
gasnier committed May 16, 2021
1 parent 4a20938 commit ab37020
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# lpx Local Package eXecute

Execute a command found in local node_modules .bin folder.
Execute a command found in local node_modules/.bin folder or from a parent folder.

If the command is not found in node_module/.bin of the current folder, lpx searches on parent folder.
You can use lpx to
* run a binary found the local node_modules/.bin folder
* run a binary found in the node_modules/.bin of a workspace root from anywhere in the workspace

## install
lpx does not download any package if the binary is not found locally (ie not like npx)

## Install

This package must be installed globally
```
npm install -g lpx
```
## usage
## Usage

With this folder structure :
```
Expand All @@ -34,3 +38,23 @@ cd folder1/folder2/folder3
lpx command1 command1arguments
lpx command2 command2arguments
```

## Motivation
At [Cervval](https://www.cervval.com), our packages are organised in a workspace that has a package.json that determines the versions of the build tools we use (tsc, webpack...)

I wanted to be able to use the binaries of these packages from the command line from anywhere in the workspace.

Solutions I tried before :
* Add scripts in each local package.json

Let's say you have scripts : { "tsc" : "tsc" } in your package.json

When doing this, you can run ``npm run tsc`` to use local tsc bin

If you want to add a parameter you need to run ``npm run tsc -- -b`` with ``--`` which I find very unpleasant

Also, you have to put the binaries in all pacckages scripts which is not optimal

* npx

By using npx, if you are in a workspace sub folder it will download the package from npm registry and not use the locally defined one
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lpx",
"version": "1.0.1",
"version": "1.0.2",
"description": "Local Package eXecute",
"author": "Bruno Gasnier (https://www.cervval.com/)",
"homepage": "https://github.com/gasnier/lpx",
Expand Down

0 comments on commit ab37020

Please sign in to comment.