Skip to content

Commit

Permalink
fix: unset YARN_IGNORE_PATH in yarn_install before calling yarn
Browse files Browse the repository at this point in the history
Unset YARN_IGNORE_PATH before calling yarn incase it is set so that
.yarnrc yarn-path is followed if set. This is for the case when calling
bazel from yarn with `yarn bazel ...` and yarn follows yarn-path in
.yarnrc it will set YARN_IGNORE_PATH=1 which will prevent the bazel
call into yarn from also following the yarn-path as desired.
  • Loading branch information
gregmagolan committed Jan 31, 2020
1 parent 9fb080b commit 5a2af71
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/npm_install/npm_install.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,18 @@ def _yarn_install_impl(repository_ctx):

# The entry points for npm install for osx/linux and windows
if not is_windows_host:
# Prefix filenames with _ so they don't conflict with the npm packages
# Prefix filenames with _ so they don't conflict with the npm packages.
# Unset YARN_IGNORE_PATH before calling yarn incase it is set so that
# .yarnrc yarn-path is followed if set. This is for the case when calling
# bazel from yarn with `yarn bazel ...` and yarn follows yarn-path in
# .yarnrc it will set YARN_IGNORE_PATH=1 which will prevent the bazel
# call into yarn from also following the yarn-path as desired.
repository_ctx.file(
"_yarn.sh",
content = """#!/usr/bin/env bash
# Immediately exit if any command fails.
set -e
unset YARN_IGNORE_PATH
(cd "{root}"; "{yarn}" {yarn_args})
""".format(
root = root,
Expand All @@ -357,6 +363,7 @@ set -e
repository_ctx.file(
"_yarn.cmd",
content = """@echo off
set "YARN_IGNORE_PATH="
cd "{root}" && "{yarn}" {yarn_args}
""".format(
root = root,
Expand Down

0 comments on commit 5a2af71

Please sign in to comment.