Skip to content

Commit

Permalink
Merge pull request #802 from heroku/fix-bin/report-package-manager-re…
Browse files Browse the repository at this point in the history
…porting

use meta_get to get package manager name
  • Loading branch information
danielleadams authored Jul 10, 2020
2 parents 6d2bc3a + 2f97823 commit 3209e60
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## master
- update docs URL when node modules are checked into git ([#794](https://github.com/heroku/heroku-buildpack-nodejs/pull/794))
- move disabling yarn caching YARN_CACHE env var ([#796](https://github.com/heroku/heroku-buildpack-nodejs/pull/796))
- use meta_get "node-package-manager" for reporting ([#802](https://github.com/heroku/heroku-buildpack-nodejs/pull/802))

## v172 (2020-05-28)
- display yarn engine log to build output when engine is provided in monorepo ([#771](https://github.com/heroku/heroku-buildpack-nodejs/pull/771))
Expand Down
8 changes: 2 additions & 6 deletions bin/report
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ kv_pair_string() {
value="$2"
if [[ -n "$value" ]]; then
value=$(echo $value | sed 's/"/\\"/g')
echo "$1: \"$value\"" >> $output
echo "$key: \"$value\"" >> $output
fi
}

Expand Down Expand Up @@ -104,11 +104,7 @@ kv_pair "heroku_postbuild_script_time" "$(meta_get "heroku-postbuild-script-time
kv_pair "heroku_postbuild_script_memory" "$(meta_get "heroku-postbuild-script-memory")"

# which package manager was used
if [[ "$YARN" == "true" ]]; then
kv_pair_string "package_manager" "yarn"
else
kv_pair_string "package_manager" "npm"
fi
kv_pair_string "package_manager" "$(meta_get "node-package-manager")"

# We have to get this info from bin/compile since a lockfile will be generated if there wasn't one
kv_pair "lock_file" "$(meta_get "has-node-lock-file")"
Expand Down
5 changes: 5 additions & 0 deletions test/run
Original file line number Diff line number Diff line change
Expand Up @@ -1325,6 +1325,11 @@ testBinReportScriptsWithQuotes() {
assertCaptured "postinstall_script: \"if [ \\\"\${NODE_ENV}\\\" = \\\"staging\\\" ]; then env ASSETS_ENV=production gulp assets:build; else echo \\\"Skipped heroku-postbuild\\\"; fi\""
}

testBinReportYarn() {
compile_and_report "yarn"
assertCaptured "package_manager: \"yarn\""
}

# Utils

pushd "$(dirname 0)" >/dev/null
Expand Down

0 comments on commit 3209e60

Please sign in to comment.