Add node interpretter

This commit is contained in:
Arnie
2019-03-25 07:09:17 +01:00
parent 450cae64b9
commit a499fed7ba
11 changed files with 234 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/env bash
SCRIPT_PATH=$( cd "$(dirname "$0")" ; pwd -P )
SERVICE_NAME="node-interpretter"
source ${SCRIPT_PATH}/shared.env.shinc 2> /dev/null
source ${SCRIPT_PATH}/env.shinc 2> /dev/null
docker inspect --type container ${SERVICE_NAME} > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
echo "The node container does not exist"
exit 137
fi
NODE_SERVICE_STATE=$(docker inspect --type container ${SERVICE_NAME} --format "{{.State.Running}}")
if [[ $? -ne 0 ]]; then
echo "Could not get state of the node container"
exit 137
fi
if [[ "${NODE_SERVICE_STATE}" != "true" ]]; then
docker start ${SERVICE_NAME} > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
echo "Could not start the node container"
exit 137
fi
fi
case "${1}" in
npm|npx|yarn|yarnpkg|*npm-cli.js*|*npx-cli.js*)
docker exec -i ${SERVICE_NAME} "$@"
;;
*)
docker exec -i ${SERVICE_NAME} node "$@"
;;
esac
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
node npm "$@"
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
node npx "$@"
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
node yarn "$@"
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
node yarnpkg "$@"