-
Notifications
You must be signed in to change notification settings - Fork 1
Developer setup
Nathanaël edited this page Jan 18, 2021
·
40 revisions
- NodeJS (at least v14)
- MySQL or MariaDB
.git/hooks/pre-commit
#!/bin/sh
if [ "$(git diff --name-only HEAD@{1} HEAD | grep "^server/")" != "" ]; then
cd "$(git rev-parse --show-toplevel)/server" || exit 1
npm run format || exit 1
npm run lint || exit 1
npm run test || exit 1
fi
if [ "$(git diff --name-only HEAD@{1} HEAD | grep "^client/")" != "" ]; then
cd "$(git rev-parse --show-toplevel)/client" || exit 1
npm run format || exit 1
npm run lint || exit 1
npm run test -- --watchAll=false || exit 1
fi
exit 0
-
.git/hooks/post-merge
if you forget tonpm i
after a pull
#!/bin/sh
function changed() {
git diff --name-only HEAD@{1} HEAD | grep "^$1" >/dev/null 2>&1
}
cd "$(git rev-parse --show-toplevel)/server" || exit 1
if changed 'server/package-lock.json'; then
echo "📦 server/package-lock.json changed. Running npm install"
npm install || exit 1
fi
cd "$(git rev-parse --show-toplevel)/client" || exit 1
if changed 'client/package-lock.json'; then
echo "📦 client/package-lock.json changed. Running npm install"
npm install || exit 1
fi
exit 0
[mysql]: CREATE USER 'glowing-octo-guacamole'@'localhost' IDENTIFIED BY 'p@ssword';
[mysql]: CREATE DATABASE glowingOctoGuacamoleDev;
[mysql]: GRANT ALL PRIVILEGES ON glowingOctoGuacamoleDev.* TO 'glowing-octo-guacamole'@'localhost';
You can use nodemon
to auto-reload the servers on changes. You can launch two instances, one for client/
and the other for server/
Apothiquiz, by Éros Albérola, Nathanaël Houn, Valentin Perignon & François Poguet