From 195361ed46408ff621036163fd9c2140ed049904 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 3 Dec 2021 20:25:03 +1000 Subject: [PATCH] add script to put node/yarn on path --- scripts/node-env | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 scripts/node-env diff --git a/scripts/node-env b/scripts/node-env new file mode 100755 index 000000000..9f72b4472 --- /dev/null +++ b/scripts/node-env @@ -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