Skip to content

Commit

Permalink
Export NODE_OPTIONS env default to downstream buildpacks (#1293)
Browse files Browse the repository at this point in the history
* Export NODE_OPTIONS env default to downstream buildpacks
  • Loading branch information
colincasey authored Jul 10, 2024
1 parent 6352449 commit 032734b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [Unreleased]

- Export default `NODE_OPTIONS` settings to downstream buildpacks if environment variable is not already set. ([#1293](https://github.com/heroku/heroku-buildpack-nodejs/pull/1293))

## [v257] - 2024-07-09

Expand Down
4 changes: 2 additions & 2 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ log_project_info "$BUILD_DIR"
### Compile

create_env() {
write_profile "$BP_DIR" "$BUILD_DIR"
write_export "$BP_DIR" "$BUILD_DIR"
export_env_dir "$ENV_DIR"
create_default_env "$YARN"
write_profile "$BP_DIR" "$BUILD_DIR"
write_export "$BP_DIR" "$BUILD_DIR"
}

header "Creating runtime environment" | output "$LOG_FILE"
Expand Down
2 changes: 2 additions & 0 deletions lib/environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,7 @@ write_export() {
if [ -w "$bp_dir" ]; then
echo "export PATH=\"$build_dir/.heroku/node/bin:$build_dir/.heroku/yarn/bin:\$PATH:$build_dir/node_modules/.bin\"" > "$bp_dir/export"
echo "export NODE_HOME=\"$build_dir/.heroku/node\"" >> "$bp_dir/export"
# shellcheck disable=SC2016
echo 'export NODE_OPTIONS=${NODE_OPTIONS:-"--max_old_space_size=2560"}' >> "$bp_dir/export"
fi
}
2 changes: 2 additions & 0 deletions test/run
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,8 @@ testMultiExport() {
assertFileContains "/node_modules/.bin" "${bp_dir}/export"
assertFileContains "export NODE_HOME=" "${bp_dir}/export"
assertFileContains "/.heroku/node\"" "${bp_dir}/export"
# shellcheck disable=SC2016
assertFileContains 'export NODE_OPTIONS=${NODE_OPTIONS:-"--max_old_space_size=2560"}' "${bp_dir}/export"
assertCapturedSuccess
}

Expand Down

0 comments on commit 032734b

Please sign in to comment.