Skip to content

Commit

Permalink
fix(package-linker): Fix issue with .bin folder missing when using th…
Browse files Browse the repository at this point in the history
…e `--modules-folder` flag (yarnpkg#3724, yarnpkg#4297)

**Summary**

This PR fixes yarnpkg#3724 and yarnpkg#4297 where `install` was not installing binary symlinks to the correct location
when the `--modules-folder` flag was provided.

**Test plan**

Manual CLI tests:

Before:
```
> yarn --modules-folder /var/foo
> (ls /var/foo/.bin 2>1 > /dev/null && echo "found") || echo "not found"
not found
```

After:
```
> yarn --modules-folder /var/foo
> (ls /var/foo/.bin 2>1 > /dev/null && echo "found") || echo "not found"
found
```
  • Loading branch information
voondo committed Apr 26, 2018
1 parent 99bd44b commit 54bb679
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/package-linker.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,12 @@ export default class PackageLinker {
topLevelDependencies,
async ([dest, {pkg}]) => {
if (pkg._reference && pkg._reference.location && pkg.bin && Object.keys(pkg.bin).length) {
const binLoc = path.join(this.config.lockfileFolder, this.config.getFolder(pkg));
let binLoc;
if (this.config.modulesFolder) {
binLoc = this.config.modulesFolder;
} else {
binLoc = path.join(this.config.lockfileFolder, this.config.getFolder(pkg));
}
await this.linkSelfDependencies(pkg, dest, binLoc);
tickBin();
}
Expand Down

0 comments on commit 54bb679

Please sign in to comment.