setup- Installs node_modules to project root, backend and frontend
- Sets up Prisma in backend
- Creates all config files
config:all- Creates all config files:
.dev.env,.anon.envand.test.env
- Creates all config files:
start- Runs the application in the production environment
- Opens backend, frontend and a MariaDB database (initialized from
datadirectory) - Utilizes
.env
start:anon- Runs the application in dev environment
- Opens backend, frontend, phpMyAdmin and a MariaDB database (initialized from
test_datadirectory) - Utilizes
.anon.env
dev- Runs the application in development environment
- Enables hotswap (docker compose doesn't need to be restarted on changes inside
backend/srcorfrontend/src)- Note: When editing for example
package.jsonthe docker needs to be manually restarted.
- Note: When editing for example
- Opens backend, frontend, phpMyAdmin, and a MariaDB database (initialized from
datadirectory) - Utilizes
.dev.env - To create test users visit
http://localhost:4000/test/create-test-users
test:api- Runs tests for backend API
- Tests are located in
backend/src/api-tests - Tests are executed inside Docker
- Requires a database running with (preferrably, see last point)
test_data - Utilizes
.test.env - Anon version of the database is recommended be used by these tests
- Resets the database with
test_datamultiple times!
test:api:local- Same as
test:apibut tests are executed locally
- Same as
test:e2e- Runs e2e tests with cypress
- Tests are located in
cypress/e2e - Tests are executed inside Docker
- Requires backend, frontend and database (with preferably
test_data, see last point) to be running- Expects to find frontend at
<baseUrl>defined incypress/config.js - Expects to find database reset API-point at
<databaseResetUrl>defined incypress.config.js - Both can be also defined as a environment variable
- Expects to find frontend at
- Resets the database with
test_datamultiple times!
test:e2e:local- Same as
test:e2ebut tests are executed locally - Change the browser by running
npm run test:e2e:local -- --browser <YOUR_BROWSER_NAME>
- Same as
test:unit- Runs all unit tests defined in
backend/src/unit-testsandfrontend/src/tests - Doesn't require containers running
- Executed locally
- Runs all unit tests defined in
test:{api,e2e}:windows- Executes api or e2e command with (supposed) Windows support
- Not actually tested on Windows: "should work"
- For
api-teststo work with Windows: inside.test.env, you need to change all instances oflocalhosttohost.docker.internal.- These include
MARIADB_HOST,DATABASE_URLandLOG_DATABASE_URL.
- These include
- A short script that should do the same:
sed -i -e s|localhost|host.docker.internal|g .test.env
check- Runs linting and typescript checking for backend, frontend and cypress
anon:down- Closes all docker containers running anon versions
- REMOVES
nowdb-db-anonVOLUME PERMANENTLY- This is usually not a problem as the normal development environment uses a different volume
dev:down- Closes all docker containers running dev versions
- REMOVES
nowdb-db-devVOLUME PERMANENTLY
clean- Removes all node_modules, build directories, prisma's autogenerated files, .nyc_output and coverage directories
coverage- Creates coverage report based on
.nyc_output - Replaces the incorrect paths of the files from the path inside Docker container to the current working directory (
$PWD) - Automatically run by
e2eeach time
- Creates coverage report based on
coverage:report- Alias to
coveragefor cypress to create coverage while running tests - https://github.com/cypress-io/code-coverage?tab=readme-ov-file#custom-nyc-command
- Alias to
-
Weird problems with docker?
- Add
-- --buildafter for examplenpm run start:anonto force rebuilding all containers - Sometimes docker doesn't rebuild containers when needed and it leads to hard-to-find bugs
- Getting a "no space left on device" error? Try running
docker system pruneordocker system prune --volumesto remove unused containers and volumes. Note: these will remove all of your unused containers, images and volumes and can lead to the loss of important data!
- Add
-
Difference between
cmd1 && cmd2andcmd1; cmd2&&:cmd2is executed only whencmd1returns 0 (=is succesful);:cmd2is always executed (aftercmd1)