add script to put node/yarn on path

This commit is contained in:
Damien Elmes 2021-12-03 20:25:03 +10:00
parent 47b701688f
commit 195361ed46

24
scripts/node-env Executable file
View file

@ -0,0 +1,24 @@
#!/bin/bash
# Put our vendored version of node/yarn on the path. Can be helpful if you need
# quick access on a machine that does not have Node installed separately.
# Eg:
# $ . scripts/node-env
# $ (cd ts && yarn)
BAZEL_EXTERNAL=$(bazel info output_base --ui_event_filters=-INFO)/external
if [[ "$OSTYPE" == "darwin"* ]]; then
if [ "$(arch)" == "i386" ]; then
export PATH="$BAZEL_EXTERNAL/nodejs_darwin_amd64/bin:$PATH"
else
export PATH="$BAZEL_EXTERNAL/nodejs_darwin_arm64/bin:$PATH"
fi
else
if [ "$(arch)" == "aarch64" ]; then
export PATH="$BAZEL_EXTERNAL/nodejs_linux_arm64/bin:$PATH"
else
export PATH="$BAZEL_EXTERNAL/nodejs_linux_amd64/bin:$PATH"
fi
fi