diff --git a/ts/format.sh b/ts/format.sh index 2cd4f1a55..dd2441264 100755 --- a/ts/format.sh +++ b/ts/format.sh @@ -1,4 +1,7 @@ # this is a hack to invoke prettier directly from Bazel +node=$(pwd)/$1 +node_dir=$(dirname $node) +export PATH="$node_dir:$PATH" (cd "${BUILD_WORKSPACE_DIRECTORY}" && node_modules/.bin/prettier \ --config .prettierrc --write \ $BUILD_WORKING_DIRECTORY ) diff --git a/ts/prettier.bzl b/ts/prettier.bzl index 9807d0c7d..26d2e8bea 100644 --- a/ts/prettier.bzl +++ b/ts/prettier.bzl @@ -30,4 +30,6 @@ def prettier(name = "format", **kwargs): native.sh_binary( name = name, srcs = ["format.sh"], + args = ["$(location @nodejs//:node_bin)"], + data = ["@nodejs//:node_bin"], )