Skip to content

Commit

Permalink
fix return value for detecting yarn workspace plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielle Adams committed Feb 26, 2021
1 parent 1660cf2 commit 2935101
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## main
- Prune devDependencies with Yarn 2 ([#891](https://github.com/heroku/heroku-buildpack-nodejs/pull/891))
- Add 10.x, 12.x, and 14.x to inventory ([902](https://github.com/heroku/heroku-buildpack-nodejs/pull/902))
- Fix yarn workspace plugin detection ([#905](https://github.com/heroku/heroku-buildpack-nodejs/pull/905))

## v183 (2020-02-03)
- Update node version to 14 ([#885](https://github.com/heroku/heroku-buildpack-nodejs/pull/885))
Expand Down
1 change: 1 addition & 0 deletions lib/dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ yarn_prune_devdependencies() {
cd "$build_dir" || return

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

# The cache is removed beforehand because the command is running an install on devDeps, and
Expand Down
10 changes: 9 additions & 1 deletion lib/yarn-2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ has_yarn_cache() {
has_yarn_workspace_plugin_installed() {
local build_dir="$1"
local plugin_paths=$(get_yarn_plugin_paths "$build_dir")
[[ ! -n $plugin_paths ]] && echo "$plugin_paths" | grep plugin-workspace-tools
local path

if [[ -n $plugin_paths ]]; then
path=$(echo "$plugin_paths" | grep plugin-workspace-tools)
else
path=""
fi

[[ ! "$path" == "" ]]
}

get_yarn_plugin_paths() {
Expand Down
1 change: 1 addition & 0 deletions test/run
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@ testYarn2() {
assertCaptured "The buildpack won't cache the dependencies in .yarn/cache."
assertCaptured "Running 'yarn install' with yarn.lock"
assertCaptured "Version 3.9.7" # tsc output
assertCaptured "Running 'yarn workspaces focus --all --production'"
assertCapturedSuccess
}

Expand Down

0 comments on commit 2935101

Please sign in to comment.