@@ -108,35 +108,30 @@ run_yarn() {
108
108
fi
109
109
110
110
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[@]} "
139
133
else
134
+ echo " No yarn workspaces detected"
140
135
restore_cwd_cache node_modules " node modules"
141
136
fi
142
137
@@ -711,12 +706,7 @@ cache_artifacts() {
711
706
cache_cwd_directory " .bundle" " ruby gems"
712
707
cache_cwd_directory " bower_components" " bower components"
713
708
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
720
710
721
711
cache_cwd_directory " .venv" " python virtualenv"
722
712
cache_cwd_directory " .build" " swift build"
0 commit comments