This repository has been archived by the owner on Apr 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(prefix): Handle node_modules without package.json (#128)
This fixes running `npx` inside temporary projects (ones that have a `node_modules` but don't have a `package.json`). `getPrefix()` has useful cases: 1. Finds a path with a `package.json`, returns it. 2. Finds a path with a `node_modules`, returns it. 3. Finds nothing, returns the original path. Cases 1 and 2 return a path that's useful to `npx`, but case 3 doesn't. But, `localBinPath()` confused case 2 and 3 (by stating for a `package.json`), making `npx` only work with case 1. That's no good. This makes cases 1 and 2 distinct from case 3 (it just returns `false` now). And `localBinPath()` no longer has to do any stating to differentiate between paths and `false`, so it's happy. And now `npx` can run without a local `package.json`. Yay! Fixes: zkat/npx#104 Fixes: babel/babel#4066 (comment)
- Loading branch information
1 parent
d2f035e
commit f64ae43
Showing
3 changed files
with
17 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters