From 0d4861052fbdc4a7bbda286b1f46ba0414b11253 Mon Sep 17 00:00:00 2001 From: Rowan Lonsdale Date: Wed, 21 Nov 2018 14:12:00 +0000 Subject: [PATCH] Check for existence of `.bin` dir in pnp dependencies before adding to `PATH`. (#6711) * Check PnP dep has `.bin` dir before adding to `PATH` * Update CHANGELOG * Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ src/util/execute-lifecycle-script.js | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15e7d9252a..c0875f0442 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ Please add one entry in this file for each change in Yarn's behavior. Use the sa [#6682](https://github.com/yarnpkg/yarn/pull/6682) - [**Maƫl Nison**](https://twitter.com/arcanis) +- Decreases the size of the generated `$PATH` environment variable for a better Windows support + + [#6683](https://github.com/yarnpkg/yarn/issues/6683) - [**Rowan Lonsdale**](https://github.com/hWorblehat) + ## 1.12.3 **Important:** This release contains a cache bump. It will cause the very first install following the upgrade to take slightly more time, especially if you don't use the [Offline Mirror](https://yarnpkg.com/blog/2016/11/24/offline-mirror/) feature. After that everything will be back to normal. diff --git a/src/util/execute-lifecycle-script.js b/src/util/execute-lifecycle-script.js index 7401cc10e8..8205c59c5e 100644 --- a/src/util/execute-lifecycle-script.js +++ b/src/util/execute-lifecycle-script.js @@ -217,7 +217,10 @@ export async function makeEnv( continue; } - pathParts.unshift(`${dependencyInformation.packageLocation}/.bin`); + const binFolder = `${dependencyInformation.packageLocation}/.bin`; + if (await fs.exists(binFolder)) { + pathParts.unshift(binFolder); + } } // Note that NODE_OPTIONS doesn't support any style of quoting its arguments at the moment