fix npm audit (except nodeunit)

add .nvmrc
docker nodejs build in a folder on the ephemeral disk so we don't interfere with lib and node_modules folders
This commit is contained in:
Nicolas Dextraze 2023-01-30 14:49:45 -05:00
parent bf1ebfaab0
commit 9842cc6164
6 changed files with 2997 additions and 6881 deletions

1
.nvmrc Normal file
View File

@ -0,0 +1 @@
v14.21.2

11
build-and-test.sh Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -e
if [[ -d /var/code/src ]]; then
cp -R /var/code/{src,test,*.js,*.json} .
fi
npm i
npm run build
npm run test-debug

View File

@ -108,17 +108,18 @@ services:
- ./certs:/etc/eventstore/certs:ro
nodejs:
image: node:12
working_dir: /var/code
image: node:14
working_dir: /var/build
volumes:
- .:/var/code
- /var/code/node_modules
- ./:/var/code:ro
- ./build-and-test.sh:/var/build/build-and-test.sh:ro
- ./certs:/var/certs:ro
environment:
- NODE_EXTRA_CA_CERTS=/var/certs/ca/ca.crt
command: bash -c "tail -f /dev/null"
networks:
- app_net
app_net:
ipv4_address: 192.168.33.5
volumes:
eventstore1-data:

View File

@ -1,7 +1,7 @@
version: '3.4'
services:
eventstore.db:
eventstore:
image: eventstore/eventstore:20.10.5-buster-slim
environment:
- EVENTSTORE_CLUSTER_SIZE=1
@ -31,16 +31,17 @@ services:
nodejs:
image: node:14
working_dir: /var/code
working_dir: /var/build
volumes:
- .:/var/code
- /var/code/node_modules
- ./:/var/code:ro
- ./build-and-test.sh:/var/build/build-and-test.sh:ro
- ./certs:/var/certs:ro
environment:
- NODE_EXTRA_CA_CERTS=/var/certs/ca/ca.crt
command: bash -c "tail -f /dev/null"
networks:
- app_net
app_net:
ipv4_address: 192.168.33.5
volumes:
eventstore-data:

9830
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,7 @@
"scripts": {
"clean": "rm -f lib/dist.js",
"prebuild": "npm run clean",
"build": "webpack -o ./lib/dist.js",
"build": "webpack",
"pretest": "npm run build",
"test": "nodeunit",
"test-debug": "TESTS_VERBOSE_LOGGING=1 nodeunit",
@ -25,9 +25,9 @@
"compose:single:stop": "docker-compose -f docker-compose-single.yaml down -v --remove-orphans",
"compose:cluster:stop": "docker-compose -f docker-compose-cluster.yaml down -v --remove-orphans",
"compose:wait": "while [ \"$(curl -s -o /dev/null -w ''%{http_code}'' -k https://localhost:2113/ping)\" != \"200\" ]; do sleep 5; done",
"compose:single:test": "docker-compose -f docker-compose-single.yaml exec nodejs bash -c \"npm i && npm run build && EVENTSTORE_CONNECTION_TYPE=tcp EVENTSTORE_HOST=192.168.33.10 npm run test-debug\"",
"compose:gossip:test": "docker-compose -f docker-compose-cluster.yaml exec nodejs bash -c \"npm i && npm run build && EVENTSTORE_CONNECTION_TYPE=gossip EVENTSTORE_HOST=192.168.33.10 EVENTSTORE_HOST_1=192.168.33.10 EVENTSTORE_HOST_2=192.168.33.11 EVENTSTORE_HOST_3=192.168.33.12 npm run test-debug\"",
"compose:cluster:test": "docker-compose -f docker-compose-cluster.yaml exec nodejs bash -c \"npm i && npm run build && EVENTSTORE_CONNECTION_TYPE=dns EVENTSTORE_HOST=cluster.tests.node-eventstore-client.local npm run test-debug\"",
"compose:single:test": "docker-compose -f docker-compose-single.yaml exec nodejs bash -c \"EVENTSTORE_CONNECTION_TYPE=tcp EVENTSTORE_HOST=192.168.33.10 ./build-and-test.sh\"",
"compose:gossip:test": "docker-compose -f docker-compose-cluster.yaml exec nodejs bash -c \"EVENTSTORE_CONNECTION_TYPE=gossip EVENTSTORE_HOST=192.168.33.10 EVENTSTORE_HOST_1=192.168.33.10 EVENTSTORE_HOST_2=192.168.33.11 EVENTSTORE_HOST_3=192.168.33.12 ./build-and-test.sh\"",
"compose:cluster:test": "docker-compose -f docker-compose-cluster.yaml exec nodejs bash -c \"EVENTSTORE_CONNECTION_TYPE=dns EVENTSTORE_HOST=cluster.tests.node-eventstore-client.local ./build-and-test.sh\"",
"prepublishOnly": "npm run build && npm run gendocs",
"gendocs": "rm -rf docs && jsdoc src -r -d docs"
},
@ -67,10 +67,10 @@
"uuid": "^3.0.1"
},
"devDependencies": {
"jest": "^26.4.2",
"jsdoc": "^3.6.3",
"jest": "^29.4.1",
"jsdoc": "^4.0.0",
"nodeunit": "^0.11.3",
"webpack": "^4.41.2",
"webpack": "^5.75.0",
"webpack-cli": "^3.3.10"
}
}