Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
path: root/npm
diff options
context:
space:
mode:
authorCatalin Mititiuc <webdevcat@proton.me>2024-05-02 09:40:05 -0700
committerCatalin Mititiuc <webdevcat@proton.me>2024-05-02 10:05:50 -0700
commitd2c218f72d1ad5bd65407433a51688b0a9bd0d89 (patch)
treed3de1fe656a7e193dc21a2c46c62e10f2043944a /npm
parente639bedadc81706a522ffe7658fea75300d082f7 (diff)
Use NODE_ENV to test for test environment; improve scripts
Diffstat (limited to 'npm')
-rwxr-xr-xnpm12
1 files changed, 11 insertions, 1 deletions
diff --git a/npm b/npm
index 1d3b623..4ae615a 100755
--- a/npm
+++ b/npm
@@ -1,3 +1,13 @@
#!/usr/bin/env bash
-docker run --rm --init -it -v $PWD:/usr/src/app -u $(id -u):$(id -u) -p 8080:8080 btroops npm $@
+user_id=$(id -u)
+image=btroops
+
+if [[ $1 == run && $2 == test* ]]
+then
+ port=3005
+else
+ port=8080
+fi
+
+docker run --rm --init -it -v $PWD:/usr/src/app -u $user_id:$user_id -p $port:$port $image npm $@