4.3 KiB
Nowdatabase
NOW - New and Old Worlds - Database of fossil mammals
Rebuild of a fossil database application, old version at https://nowdatabase.luomus.fi/
The new version is not deployed yet.
Developer documentation
Basic commands 💻
npm run setup- Installs all node modules, and generates prisma client
npm run dev- Uses
docker-compose.dev.yml - Run in development mode: with hot reload
- To create test users visit
http://localhost:4000/test/create-test-users
- Uses
Testing:
npm run check- Runs
tscandeslintfor frontend and backend: Use this to check for errors before committing.
- Runs
npm run test:api- Runs the api-tests in a docker container
- Requires database to be running. Can be achieved by
npm run start:anon -- db-anonor justnpm run start:anon:api. - Uses
test_data - Uses
.test.env npm run test:api:buildbuilds the container used to run the tests.npm run test:api:runruns the previously built container.
npm run test:e2e- Runs e2e-tests inside a docker container.
- Requires
frontend,backendanddatabaseto be running. Can be achieved by runningnpm run start:anon. - Uses
test_data
npm run test:e2e:local- Runs cypress-tests locally (not in docker) in headless mode.
- Requires
npm run start:anonto be running first.
npm run test:api:local- Runs backend api tests locally (not in docker).
- Requires
db-anonto be running first. (Note: backend doesn't need to be running.) - Requires
.test.env
npm run cypress- Opens cypress GUI. You can run tests and see what they do.
Windows testing:
- Both
e2eandapi-testshave a Windows specific command.e2eisnpm run test:e2e:windowsapi-testsisnpm run test:api:windows- For
api-tests: inside.test.env, you need to change all instances oflocalhosttohost.docker.internal.- These include
MARIADB_HOST,DATABASE_URLandLOG_DATABASE_URL.
- These include
- Note: these are not tested yet.
Test env-file:
.test.envapi-testsrequires.test.envto set the correct environment variables.- This is created by copying
.anon.envand changing all instances ofnowdb-db-anontolocalhost.- These include
MARIADB_HOST,DATABASE_URLandLOG_DATABASE_URL.
- These include
Coverage:
- Coverage opening
- Coverage can be opened by opening the
coverage/lcov-report/index.htmlwith your browser of choice.
- Coverage can be opened by opening the
coverage:sed- Fixes issues with
.nyc_outputpaths. Replaces the paths inside Docker to$PWD(current directory).
- Fixes issues with
coverage- First fixes paths with
coverage:sedand then recreatescoverage/lcov-reportto match the new path.
- First fixes paths with
coverage:report- Alias to
npm run coverage. Used by cypress e2e tests so thatcoverage:sedgets executed automatically.
- Alias to
Run with the same image that is used in production:
npm start- Uses
docker-compose.yml - This builds the code and runs it. Mostly you'll want to use this after major technical changes to check the code works also in production mode, before deploying. And then you'll likely want to do:
npm start -- --buildto force rebuild of containers.
- Uses
Docker:
npm run dev:down- Stops and removes the dev container and it's volumes.
-- --build- Useful flag to force docker to rebuild the containers. Example usage for dev:
npm run dev -- --build
- Useful flag to force docker to rebuild the containers. Example usage for dev:
Further documentation
🚀 Initialize app & restore db How to get the app up & running, and initialize database from sql-dumps
🔧 Technical explanations Explanations of how things work, and guides for some more rare tasks like updating database-schema
🙌 Contributing & integration flow Where to commit? Where are tests run? How is the code deployed?
📝 Frontend Explanation of the frontend logic and how to add views
🔎 Validators The readme explains how validators are written
🔎 Class diagram See the relations of relevant tables. Notice that it omits some unimportant tables and does not show most columns.
🌍 Map features Maps' functionality and development notes