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.env
and.test.env
- Creates all config files:
start
- Runs the application in the production environment
- Opens backend, frontend and a MariaDB database (initialized from
data
directory) - Utilizes
.env
start:anon
- Runs the application in dev environment
- Opens backend, frontend, phpMyAdmin and a MariaDB database (initialized from
test_data
directory) - Utilizes
.anon.env
dev
- Runs the application in development environment
- Enables hotswap (docker compose doesn't need to be restarted on changes inside
backend/src
orfrontend/src
)- Note: When editing for example
package.json
the docker needs to be manually restarted.
- Note: When editing for example
- Opens backend, frontend, phpMyAdmin, and a MariaDB database (initialized from
data
directory) - 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_data
multiple times!
test:api:local
- Same as
test:api
but 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_data
multiple times!
test:e2e:local
- Same as
test:e2e
but 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-tests
andfrontend/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-tests
to work with Windows: inside.test.env
, you need to change all instances oflocalhost
tohost.docker.internal
.- These include
MARIADB_HOST
,DATABASE_URL
andLOG_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-anon
VOLUME 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-dev
VOLUME 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
e2e
each time
- Creates coverage report based on
coverage:report
- Alias to
coverage
for 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
-- --build
after for examplenpm run start:anon
to 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 prune
ordocker system prune --volumes
to 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 && cmd2
andcmd1; cmd2
&&
:cmd2
is executed only whencmd1
returns 0 (=is succesful);
:cmd2
is always executed (aftercmd1
)