Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert changes introduced in #990 #994

Merged
merged 1 commit into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## main

## v194 (2022-03-30)
- Revert fix for pruning yarn 2 cache due to an edge case that would cause all devDependencies to be installed ([#990](https://github.com/heroku/heroku-buildpack-nodejs/pull/990))

## v193 (2022-03-28)
- Added Yarn 1.22.18 to `inventory/yarn.toml` ([#992](https://github.com/heroku/heroku-buildpack-nodejs/pull/992))
- Fix issue with pruning yarn 2 cache when using the workspaces plugin ([#990](https://github.com/heroku/heroku-buildpack-nodejs/pull/990))
Expand Down
21 changes: 3 additions & 18 deletions lib/dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,10 @@ yarn_prune_devdependencies() {
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
# it will not remove the existing dependencies beforehand.
rm -rf "$cache_dir"
monitor "yarn-prune" yarn workspaces focus --all --production
yarn_prune_devdependencies_for_each_workspace "$build_dir"
meta_set "skipped-prune" "false"
else
meta_set "workspace-plugin-present" "false"
Expand All @@ -187,23 +189,6 @@ yarn_prune_devdependencies() {
fi
}

# removing all devDependencies this way *should* work but it would be nice if yarn supported
# devDependency pruning like npm does when running `npm install --production`
yarn_prune_devdependencies_for_each_workspace() {
local build_dir=${1:-}
local workspace_list=$(yarn workspaces list --json)
while IFS= read -r workspace; do
local name=$(echo "${workspace}" | jq -r '.name')
local location=$(echo "${workspace}" | jq -r '.location')
local devDependencies=$(cat "${build_dir}/${location}/package.json" | jq -r '.devDependencies | try keys | join(" ")')
if [ "${location}" == "." ]; then
monitor "yarn-prune" yarn remove ${devDependencies}
else
monitor "yarn-prune" yarn workspace "${name}" remove ${devDependencies}
fi
done <<< "${workspace_list}"
}

has_npm_lock() {
local build_dir=${1:-}

Expand Down
Loading