From 9817172d65888369c35c504beaa95fd0aabd4f0b Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Sun, 9 May 2021 20:25:41 +0200 Subject: [PATCH] Add support for nested node projects --- Dockerfile | 4 +++- docker-compose.yml | 2 -- full-install.sh | 11 +++++++++++ package.json | 1 + 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100755 full-install.sh diff --git a/Dockerfile b/Dockerfile index 1bbdd4e..6510a3c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ FROM node:14-alpine3.10 WORKDIR /app COPY package.json . -RUN npm install --quiet +COPY ./modules ./modules +COPY full-install.sh . +RUN npm run full-install COPY . . diff --git a/docker-compose.yml b/docker-compose.yml index fb48d13..3bcb998 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,5 +7,3 @@ services: volumes: - .:/app - /app/node_modules - - /app/modules - - ./modules:/modules diff --git a/full-install.sh b/full-install.sh new file mode 100755 index 0000000..4a3366e --- /dev/null +++ b/full-install.sh @@ -0,0 +1,11 @@ +npm install + +echo "Installing dependencies of modules" +for d in modules/* ; do + if test -f "$d/package.json"; then + echo "$d is a node module, installing dependencies" + ( cd $d && npm install ) + else + echo "$d does not appear to be a node module, skipping" + fi +done diff --git a/package.json b/package.json index ff7c44a..54bb735 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "Modular discord bot mainly intended for moderation usage", "main": "index.js", "scripts": { + "full-install": "sh full-install.sh", "dev": "nodemon index.js" }, "keywords": [