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

Commit 236db04

Browse files
authored
fix(workspaces): remove yarn cache workspaces feature flag (#561)
1 parent e4d2dbe commit 236db04

File tree

1 file changed

+24
-34
lines changed

1 file changed

+24
-34
lines changed

run-build-functions.sh

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -108,35 +108,30 @@ run_yarn() {
108108
fi
109109

110110

111-
if [ "$NETLIFY_YARN_WORKSPACES" = "true" ]
112-
then
113-
echo "NETLIFY_YARN_WORKSPACES feature flag set"
114-
local workspace_output
115-
local workspace_exit_code
116-
# YARN_IGNORE_PATH will ignore the presence of a local yarn executable (i.e. yarn 2) and default
117-
# to using the global one (which, for now, is always yarn 1.x). See https://yarnpkg.com/configuration/yarnrc#ignorePath
118-
workspace_output="$(YARN_IGNORE_PATH=1 yarn workspaces --json info )"
119-
workspace_exit_code=$?
120-
if [ $workspace_exit_code -eq 0 ]
121-
then
122-
local package_locations
123-
# Extract all the packages and respective locations. .data will be a JSON object like
124-
# {
125-
# "my-package-1": {
126-
# "location": "packages/blog-1",
127-
# "workspaceDependencies": [],
128-
# "mismatchedWorkspaceDependencies": []
129-
# },
130-
# (...)
131-
# }
132-
# We need to cache all the node_module dirs, or we'll always be installing them on each run
133-
mapfile -t package_locations <<< "$(echo "$workspace_output" | jq -r '.data | fromjson | to_entries | .[].value.location')"
134-
restore_js_workspaces_cache "${package_locations[@]}"
135-
else
136-
echo "No workspace detected"
137-
restore_cwd_cache node_modules "node modules"
138-
fi
111+
local workspace_output
112+
local workspace_exit_code
113+
# YARN_IGNORE_PATH will ignore the presence of a local yarn executable (i.e. yarn 2) and default
114+
# to using the global one (which, for now, is always yarn 1.x). See https://yarnpkg.com/configuration/yarnrc#ignorePath
115+
workspace_output="$(YARN_IGNORE_PATH=1 yarn workspaces --json info )"
116+
workspace_exit_code=$?
117+
if [ $workspace_exit_code -eq 0 ]
118+
then
119+
echo "Yarn workspaces detected"
120+
local package_locations
121+
# Extract all the packages and respective locations. .data will be a JSON object like
122+
# {
123+
# "my-package-1": {
124+
# "location": "packages/blog-1",
125+
# "workspaceDependencies": [],
126+
# "mismatchedWorkspaceDependencies": []
127+
# },
128+
# (...)
129+
# }
130+
# We need to cache all the node_module dirs, or we'll always be installing them on each run
131+
mapfile -t package_locations <<< "$(echo "$workspace_output" | jq -r '.data | fromjson | to_entries | .[].value.location')"
132+
restore_js_workspaces_cache "${package_locations[@]}"
139133
else
134+
echo "No yarn workspaces detected"
140135
restore_cwd_cache node_modules "node modules"
141136
fi
142137

@@ -711,12 +706,7 @@ cache_artifacts() {
711706
cache_cwd_directory ".bundle" "ruby gems"
712707
cache_cwd_directory "bower_components" "bower components"
713708

714-
if [ "$NETLIFY_YARN_WORKSPACES" == "true" ]
715-
then
716-
cache_node_modules
717-
else
718-
cache_cwd_directory "node_modules" "node modules"
719-
fi
709+
cache_node_modules
720710

721711
cache_cwd_directory ".venv" "python virtualenv"
722712
cache_cwd_directory ".build" "swift build"

0 commit comments

Comments
 (0)