20 lines
695 B
Bash
Executable file
20 lines
695 B
Bash
Executable file
#!/bin/bash
|
|
# Main build/run tool
|
|
# REQUIRES yarn
|
|
# If yarn is not found, python3 may be used to create a local node.js environment with yarn in it, and use it
|
|
|
|
yarn=$(which yarn 2>/dev/null)
|
|
set -e
|
|
|
|
if [ "x${yarn}" != "x" ]
|
|
then
|
|
"${yarn}" "$@"
|
|
else
|
|
dir=$(dirname $0)
|
|
|
|
test -x "${dir}/.env/bin/nodeenv" || ( virtualenv -p python3 "${dir}/.env" && "${dir}/.env/bin/pip" install --upgrade nodeenv )
|
|
test -e "${dir}/.env/node/bin/activate" || "${dir}/.env/bin/nodeenv" --node=9.3.0 --force "${dir}/.env/node"
|
|
test -e "${dir}/.env/node/bin/yarn" || "${dir}/.env/node/bin/shim" "${dir}/.env/node/bin/npm" install -g yarn@1.3.2
|
|
PATH="${dir}/.env/node/bin:${PATH}" yarn "$@"
|
|
fi
|