Skip to content

Commit

Permalink
Update yarn version check
Browse files Browse the repository at this point in the history
Ensure version check is run inside the project workspace, i.e. the directory with package.json
  • Loading branch information
yads authored and alexeagle committed Oct 26, 2022
1 parent 91e12c3 commit 3bf5fdd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/npm_install/npm_install.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,10 @@ check if yarn is being run by the `npm_install` repository rule.""",
)

def _detect_yarn_version(rctx, yarn):
result = rctx.execute(yarn + ["--version"])
result = rctx.execute(
yarn + ["--version"],
working_directory = str(rctx.path(rctx.attr.package_json).dirname),
)
if result.return_code:
fail("yarn --version failed: %s (%s)" % (result.stdout, result.stderr))
if result.stdout.startswith("1."):
Expand Down

0 comments on commit 3bf5fdd

Please sign in to comment.