Skip to content

Commit 2935101

Browse files
author
Danielle Adams
committed
fix return value for detecting yarn workspace plugin
1 parent 1660cf2 commit 2935101

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## main
44
- Prune devDependencies with Yarn 2 ([#891](https://github.com/heroku/heroku-buildpack-nodejs/pull/891))
55
- Add 10.x, 12.x, and 14.x to inventory ([902](https://github.com/heroku/heroku-buildpack-nodejs/pull/902))
6+
- Fix yarn workspace plugin detection ([#905](https://github.com/heroku/heroku-buildpack-nodejs/pull/905))
67

78
## v183 (2020-02-03)
89
- Update node version to 14 ([#885](https://github.com/heroku/heroku-buildpack-nodejs/pull/885))

lib/dependencies.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ yarn_prune_devdependencies() {
175175
cd "$build_dir" || return
176176

177177
if has_yarn_workspace_plugin_installed "$build_dir"; then
178+
echo "Running 'yarn workspaces focus --all --production'"
178179
meta_set "workspace-plugin-present" "true"
179180

180181
# The cache is removed beforehand because the command is running an install on devDeps, and

lib/yarn-2.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ has_yarn_cache() {
2828
has_yarn_workspace_plugin_installed() {
2929
local build_dir="$1"
3030
local plugin_paths=$(get_yarn_plugin_paths "$build_dir")
31-
[[ ! -n $plugin_paths ]] && echo "$plugin_paths" | grep plugin-workspace-tools
31+
local path
32+
33+
if [[ -n $plugin_paths ]]; then
34+
path=$(echo "$plugin_paths" | grep plugin-workspace-tools)
35+
else
36+
path=""
37+
fi
38+
39+
[[ ! "$path" == "" ]]
3240
}
3341

3442
get_yarn_plugin_paths() {

test/run

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,7 @@ testYarn2() {
679679
assertCaptured "The buildpack won't cache the dependencies in .yarn/cache."
680680
assertCaptured "Running 'yarn install' with yarn.lock"
681681
assertCaptured "Version 3.9.7" # tsc output
682+
assertCaptured "Running 'yarn workspaces focus --all --production'"
682683
assertCapturedSuccess
683684
}
684685

0 commit comments

Comments
 (0)