diff --git a/npm/private/utils.bzl b/npm/private/utils.bzl index 974e754f7..d0e0477f5 100644 --- a/npm/private/utils.bzl +++ b/npm/private/utils.bzl @@ -428,13 +428,8 @@ if [ ! -f $1 ]; then exit 42; fi else: fail(INTERNAL_ERROR_MSG) -# TODO(2.0): move this to aspect_bazel_lib def _home_directory(rctx): - if "HOME" in rctx.os.environ and not repo_utils.is_windows(rctx): - return rctx.os.environ["HOME"] - if "USERPROFILE" in rctx.os.environ and repo_utils.is_windows(rctx): - return rctx.os.environ["USERPROFILE"] - return None + return repo_utils.get_env_var(rctx, "HOME", None) def _replace_npmrc_token_envvar(token, npmrc_path, environ): # A token can be a reference to an environment variable