Add support for nested node projects

This commit is contained in:
Tanguy Herbron 2021-05-09 20:25:41 +02:00
parent 4a0ebe2845
commit 9817172d65
4 changed files with 15 additions and 3 deletions

View File

@ -1,5 +1,7 @@
FROM node:14-alpine3.10 FROM node:14-alpine3.10
WORKDIR /app WORKDIR /app
COPY package.json . COPY package.json .
RUN npm install --quiet COPY ./modules ./modules
COPY full-install.sh .
RUN npm run full-install
COPY . . COPY . .

View File

@ -7,5 +7,3 @@ services:
volumes: volumes:
- .:/app - .:/app
- /app/node_modules - /app/node_modules
- /app/modules
- ./modules:/modules

11
full-install.sh Executable file
View File

@ -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

View File

@ -4,6 +4,7 @@
"description": "Modular discord bot mainly intended for moderation usage", "description": "Modular discord bot mainly intended for moderation usage",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"full-install": "sh full-install.sh",
"dev": "nodemon index.js" "dev": "nodemon index.js"
}, },
"keywords": [ "keywords": [