prettier: don't depend on system node being available

This commit is contained in:
Damien Elmes 2021-11-25 07:14:15 +10:00
parent 7143e8f3d0
commit 63404de5df
2 changed files with 5 additions and 0 deletions

View File

@ -1,4 +1,7 @@
# this is a hack to invoke prettier directly from Bazel # 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 \ (cd "${BUILD_WORKSPACE_DIRECTORY}" && node_modules/.bin/prettier \
--config .prettierrc --write \ --config .prettierrc --write \
$BUILD_WORKING_DIRECTORY ) $BUILD_WORKING_DIRECTORY )

View File

@ -30,4 +30,6 @@ def prettier(name = "format", **kwargs):
native.sh_binary( native.sh_binary(
name = name, name = name,
srcs = ["format.sh"], srcs = ["format.sh"],
args = ["$(location @nodejs//:node_bin)"],
data = ["@nodejs//:node_bin"],
) )