Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: handle empty bin strings (#6515)
* Fix: handle empty bin strings When the package.json of a dependency sets `bin` to an empty string, do not normalize it. This prevents creating a symlink to the dependency's root directory within the `.bin` directory if bin-links are enabled * Add an entry to the changelog * Add a test to make sure empty binlinks aren't created Test was suggested/provided by @rally25rs * Fix empty bin string test on Windows
- Loading branch information
Showing
10 changed files
with
51 additions
and
1 deletion.
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
5 changes: 5 additions & 0 deletions
5
__tests__/fixtures/install/install-empty-bin/depA/package.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "depA", | ||
"version": "0.0.0", | ||
"bin": "" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env node | ||
console.log('depB'); |
5 changes: 5 additions & 0 deletions
5
__tests__/fixtures/install/install-empty-bin/depB/package.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "depB", | ||
"version": "0.0.0", | ||
"bin": "./depb.js" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "test", | ||
"version": "0.0.0", | ||
"bin": "", | ||
"dependencies": { | ||
"depA": "file:depA", | ||
"depB": "file:depB" | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
__tests__/fixtures/normalize-manifest/empty bin string/actual.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "foo", | ||
"bin": "" | ||
} |
5 changes: 5 additions & 0 deletions
5
__tests__/fixtures/normalize-manifest/empty bin string/expected.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "foo", | ||
"version": "", | ||
"bin": "" | ||
} |
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