From 2b515f42227b1705c9569e9c371f70fc9a9af465 Mon Sep 17 00:00:00 2001 From: Andrew Hosgood Date: Wed, 8 Jan 2025 17:42:43 +0000 Subject: [PATCH] Install nvm in more places, utilise tna-npm --- docker/tna-python-dev/bin/dev | 11 ++--------- docker/tna-python-dev/bin/format | 8 +------- docker/tna-python-dev/bin/upgrade | 9 +-------- docker/tna-python/Dockerfile | 2 +- docker/tna-python/bin/tna-npm | 4 +++- 5 files changed, 8 insertions(+), 26 deletions(-) diff --git a/docker/tna-python-dev/bin/dev b/docker/tna-python-dev/bin/dev index c06e61f..02dd9db 100755 --- a/docker/tna-python-dev/bin/dev +++ b/docker/tna-python-dev/bin/dev @@ -4,15 +4,8 @@ cd /app || return poetry install --no-root --with dev || true -. "$HOME/.nvm/nvm.sh" -if [ -f "/app/.nvmrc" ] -then - nvm install -else - nvm use default -fi -npm install -g prettier@3.4.2 eslint@8.56.0 stylelint@16.12.0 stylelint-config-standard-scss@14.0.0 stylelint-selector-bem-pattern@4.0.1 stylelint-order@6.0.4 -npm install +tna-npm install -g prettier@3.4.2 eslint@8.56.0 stylelint@16.12.0 stylelint-config-standard-scss@14.0.0 stylelint-selector-bem-pattern@4.0.1 stylelint-order@6.0.4 +tna-npm install if [ -d "/home/app/.local/bin/tasks" ] then diff --git a/docker/tna-python-dev/bin/format b/docker/tna-python-dev/bin/format index f9f1acd..3c0d16e 100755 --- a/docker/tna-python-dev/bin/format +++ b/docker/tna-python-dev/bin/format @@ -28,13 +28,7 @@ else fi echo -. "$HOME/.nvm/nvm.sh" -if [ -f "/app/.nvmrc" ] -then - nvm install -else - nvm use default -fi +tna-npm install echo "Running prettier..." prettier --write /app diff --git a/docker/tna-python-dev/bin/upgrade b/docker/tna-python-dev/bin/upgrade index 00812f8..f48b199 100755 --- a/docker/tna-python-dev/bin/upgrade +++ b/docker/tna-python-dev/bin/upgrade @@ -9,12 +9,5 @@ fi if [ -z "$1" ] || [ "$1" == "npm" ]; then echo "Upgrading npm dependencies..." - . "$HOME/.nvm/nvm.sh" - if [ -f "/app/.nvmrc" ] - then - nvm install - else - nvm use default - fi - npm update + tna-npm update fi diff --git a/docker/tna-python/Dockerfile b/docker/tna-python/Dockerfile index 02a0896..efe72fa 100644 --- a/docker/tna-python/Dockerfile +++ b/docker/tna-python/Dockerfile @@ -204,7 +204,7 @@ RUN mkdir /home/app/ssl # run our application in a consistent manner # ========================================== COPY --chown=app bin /home/app/.local/bin -RUN chmod +x -R /home/app/.local/bin +RUN chmod +x -fR /home/app/.local/bin # ========================================== # This does nothing but will act as a way to diff --git a/docker/tna-python/bin/tna-npm b/docker/tna-python/bin/tna-npm index 5c0691a..af7e81b 100755 --- a/docker/tna-python/bin/tna-npm +++ b/docker/tna-python/bin/tna-npm @@ -8,7 +8,9 @@ then . "$NVM_DIR/nvm.sh" && true if [ -f "/app/.nvmrc" ] then - nvm use "$(cat /app/.nvmrc)" --silent + NVM_NODE_VERSION=$(cat /app/.nvmrc) + nvm install $NVM_NODE_VERSION + nvm use $NVM_NODE_VERSION --silent else nvm use default --silent fi