Skip to content

Conversation

@AvrahamO
Copy link
Contributor

@AvrahamO AvrahamO commented Aug 16, 2018

Summary

Fix #3724

When running yarn install with a customized --modules-folder, binaries are still linked under the default node_modules/.bin.

This PR fixes that behavior.

From now on:

  1. install and add commands will link binaries under custom/.bin.
  2. run command will prepend the custom folder path to PATH env.
  3. remove command will remove the specified package from the custom folder. The same way install --force will prune extraneous from custom folder.

Test plan

All the following were tested with local .yarnrc too.

Add

$ yarn --modules-folder custom add acorn $ tree -a --noreport custom/.bin/ custom/.bin/ └── acorn -> ../acorn/bin/acorn

Install

$ cat package.json { "dependencies": { "acorn": "^5.7.1" } } $ yarn --modules-folder custom install $ tree -a --noreport custom/.bin/ custom/.bin/ └── acorn -> ../acorn/bin/acorn

Run

$ cat package.json { "scripts": { "start": "acorn --help" }, "dependencies": { "acorn": "^5.7.1" } } $ yarn --modules-folder custom start $ acorn --help usage: acorn [--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|...|--ecma2015|--ecma2016|--ecma2017|--ecma2018|...] [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile] Done in 0.26s.

Remove

$ yarn remove acorn $ tree -a --noreport custom custom └── .yarn-integrity
@AvrahamO AvrahamO force-pushed the bugfix-3724 branch 3 times, most recently from fe1d3f1 to 2b10a23 Compare August 19, 2018 08:02
Avraham Ostreicher added 3 commits August 21, 2018 14:58
 * config.js - Add modulesFolder to registryFolders to be scanned fo extraneous * package-linker.js - use path.resolve for case consistency when modulesFolder is taken from .yarnrc and has been resolved earlier
@arcanis
Copy link
Member

arcanis commented Aug 22, 2018

Looks good, thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants