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

Enable devDependency pruning for Yarn 2 #1001

Merged
merged 4 commits into from
May 26, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

## main

## v195 (2022-04-12)
## v196 (2022-05-19)
- Enable Yarn 2 `devDependency` pruning using a custom plugin for all customers ([#1001](https://github.com/heroku/heroku-buildpack-nodejs/pull/1001))

## v195 (2022-04-13)
- Enable Yarn 2 `devDependency` pruning using a custom plugin for 20% of customers ([#999](https://github.com/heroku/heroku-buildpack-nodejs/pull/999))
- Set xtrace mode in buildpack when BUILDPACK_XTRACE environment variable is set ([#925](https://github.com/heroku/heroku-buildpack-nodejs/pull/925))

Expand Down
23 changes: 21 additions & 2 deletions buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,29 @@ name = "Node.js"

[publish.Ignore]
files = [
".circle/",
".circleci/",
".github/",
".git2gus/",
"etc/",
"spec/",
"test/",
"makefile"
"makefile",
"Gemfile.lock",
"Gemfile",
"hatchet.json",
"go.mod",
"go.sum",
"hatchet.lock",
"cmd/",
# TODO: get rid of these ignores once the yarn plugins are moved into a separate repo
# for now we just need the compiled plugin in yarn2-plugin/prune-dev-dependencies/bundles
"yarn2-plugins/prune-dev-dependencies/.editorconfig",
"yarn2-plugins/prune-dev-dependencies/package-lock.json",
"yarn2-plugins/prune-dev-dependencies/.gitignore",
"yarn2-plugins/prune-dev-dependencies/package.json",
"yarn2-plugins/prune-dev-dependencies/tsconfig.json",
"yarn2-plugins/prune-dev-dependencies/README.md",
"yarn2-plugins/prune-dev-dependencies/tests",
"yarn2-plugins/prune-dev-dependencies/jest.config.js",
"yarn2-plugins/prune-dev-dependencies/src",
]
1 change: 0 additions & 1 deletion features
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
cache-native-yarn-cache=100
use-heroku-yarn-prune-plugin=20
24 changes: 4 additions & 20 deletions lib/dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,26 +168,10 @@ yarn_prune_devdependencies() {
return 0
elif $YARN_2; then
cd "$build_dir" || return
meta_set "use-heroku-yarn-prune-plugin" "$(features_get_with_blank "use-heroku-yarn-prune-plugin")"
if [[ $(features_get_with_blank "use-heroku-yarn-prune-plugin") == "true" ]]; then
echo "Running 'yarn heroku prune'"
export YARN_PLUGINS="${buildpack_dir}/yarn2-plugins/prune-dev-dependencies/bundles/@yarnpkg/plugin-prune-dev-dependencies.js"
monitor "yarn-prune" yarn heroku prune
meta_set "workspace-plugin-present" "false"
meta_set "skipped-prune" "false"
elif 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
# it will not remove the existing dependencies beforehand.
rm -rf "$cache_dir"
monitor "yarn-prune" yarn workspaces focus --all --production
meta_set "skipped-prune" "false"
else
meta_set "workspace-plugin-present" "false"
echo "Skipping because the Yarn workspace plugin is not present. Add the plugin to your source code with 'yarn plugin import workspace-tools'."
fi
echo "Running 'yarn heroku prune'"
export YARN_PLUGINS="${buildpack_dir}/yarn2-plugins/prune-dev-dependencies/bundles/@yarnpkg/plugin-prune-dev-dependencies.js"
monitor "yarn-prune" yarn heroku prune
meta_set "skipped-prune" "false"
else
cd "$build_dir" || return
monitor "yarn-prune" yarn install --frozen-lockfile --ignore-engines --ignore-scripts --prefer-offline 2>&1
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/range-with-space/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"url" : "http://github.com/example/example.git"
},
"engines": {
"node": ">= 0.8.x"
"node": "= 0.8.x"
}
}
Loading