Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Commit

Permalink
fix(ws-cache): ended up messing the jq command 🤦
Browse files Browse the repository at this point in the history
  • Loading branch information
JGAntunes committed Feb 26, 2021
1 parent 073a3db commit 8ab88ae
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions run-build-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,12 @@ run_yarn() {
then
echo "NETLIFY_YARN_WORKSPACES feature flag set"
local workspace_output
local workspace_exit_code
# YARN_IGNORE_PATH will ignore the presence of a local yarn executable (i.e. yarn 2) and default
# to using the global one (which, for now, is alwasy yarn 1.x). See https://yarnpkg.com/configuration/yarnrc#ignorePath
workspace_output=$(YARN_IGNORE_PATH=1 yarn workspaces info)
if $?
workspace_output="$(YARN_IGNORE_PATH=1 yarn workspaces --json info )"
workspace_exit_code=$?
if [ $workspace_exit_code -eq 0 ]
then
local package_locations
# Extract all the packages and respective locations. .data will be a JSON object like
Expand All @@ -125,7 +127,7 @@ run_yarn() {
# (...)
# }
# We need to cache all the node_module dirs, or we'll always be installing them on each run
mapfile -t package_locations <<< "$workspace_output"
mapfile -t package_locations <<< "$(echo "$workspace_output" | jq -r '.data | fromjson | to_entries | .[].value.location')"
restore_js_workspaces_cache "${package_locations[@]}"
else
echo "No workspace detected"
Expand Down

0 comments on commit 8ab88ae

Please sign in to comment.