Skip to main content

Building The Project

Installing dependencies

After cloning the project to your machine, to install the dependencies, run:

yarn

Running Unit Tests

To make sure your changes do not break any unit tests, run the following:

nx affected --target=test --all

If you need to only run the tests for specific app, run:

nx test <project>

Local Development Setup

To start the local dev environment, run the following: docker-compose up -d

To stop the local dev environment, run the following: docker-compose down

To run or generate new Prisma migrations for all applications locally, run the following: yarn prisma:migrate:local

Running end-to-end tests

Run nx e2e my-app to execute the end-to-end tests via Cypress.

Run nx affected:e2e to execute the end-to-end tests affected by a change.

Creating a Release

To create a release, run the following:

yarn release

This will version all affected packages, updates CHANGELOG.md and creates a commit. See more Semver

Creating an App

To create an app, run the following:

nx g app <name>

This will create a new nest application within the apps directory using the default cli collection @nrwl/nest. The next step is to enable version control within the application. This can be done by editing the generated project.json within the new application directory and the following to the targets object:

"release": {
"executor": "@jscutlery/semver:version",
"options": {
"commitMessageFormat": "chore(${projectName}): release version ${version}",
"versionTagPrefix": "release/${projectName}/",
"trackDeps": true
}
}

More application generators can be found here Nx CLI Generate

Creating a library

Run nx g lib to generate a library.

Libraries are shareable across libraries and applications. They can be imported from @consumer-health-platform/mylib.

Commit Message Guidelines

The commit message should follow the following format:

type(scope): CHP-<ticket-number> subject
Type

The type must be one of the following:

  • build: Changes that affect the build system or external dependencies
  • ci: Changes to our CI configuration files and scripts (example scopes: CircleCI)
  • docs: Documentation only changes
  • feat: A new feature
  • fix: A bug fix
  • perf: A code change that improves performance
  • refactor: A code change that neither fixes a bug nor adds a feature
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • test: Adding missing tests or correcting existing tests
Subject and Body

The subject must contain a description of the change, and the body of the message contains any additional details to provide more context about the change.

Including the issue number that the PR relates to also helps with tracking.

Example

feat(scope): CHP-1 My first feature!