This is a mono-repo
It is set up using yarn workspaces
, meaning any command you would normally run inside a package can
be run from the root directory using yarn workspace @tupaia/package-name command
, e.g.
yarn workspace @tupaia/meditrak-server start-dev
The easiest way to open the packages in vscode is to double click 'tupaia-packages.code-workspace'. This opens all packages as roots in the workspace, and means linting etc. will work correctly.
- admin-panel
- admin-panel-server
- lesmis
- lesmis-server
- meditrak-app
- meditrak-server
- psss
- psss-server
- web-config-server
- web-frontend
Any of the main packages can be run using yarn workspace @tupaia/package-name start-dev
.
In the case of the two servers, this will also build and watch all of the internal dependencies, so
that hot reload detects changes to other packages within the mono-repo. As this delays startup time,
if you prefer to pre-build internal dependencies, add --skip-internal
to the above command.
- access-policy
- aggregator
- auth
- database
- data-broker
- devops
- dhis-api
- expression-parser
- indicators
- ui-components
- server-boilerplate
- utils
Most packages will require a .env file. .env.example
files indicate the required variables per package.
🔑 BES internal: Tupaia monorepo setup - steps 4 and 5
We use yarn workspaces to manage our packages, which allows us to run yarn
once at the project
root, and it will install dependencies everywhere.
We use codeship for the admin-panel, meditrak-server, web-config-server, and web-frontend packages.
For codeship to use our environment variables, we store them encrypted and committed to the repo as ci-env-vars.encrypted inside each package. In order to update an environment variable:
- modify your local .env file
- download the codeship encryption key (either from LastPass or codeship itself) and save as codeship.aes in the root directory
- run
yarn update-codeship-env-vars
Note that environment variables are also stored in AWS parameter store for new dev and feature deployments to pull from, so if you've updated the environment variables here, you probably also need to persist them across there
- ssh into the aws instance (cannot be run locally at this stage)
- update the .env file (if it hasn't been updated automatically by the CI/CD process)
- run
ENVIRONMENT=dev yarn update-paramater-store-env-vars
(setting environment to either dev or production)
Most of the packages support the following scripts for testing:
yarn test
yarn test:coverage # also displays code coverage
We use a combination of ESlint configs to detect quality and formatting issues in code:
- @beyondessential/eslint-config-js for JavaScript packages
- @beyondessential/eslint-config-ts for TypeScript packages
- @beyondessential/eslint-config-jest for packages using
Jest
The config for this repository is defined in .eslintrc
under the root folder. Additional rules/overrides per package are specified in this file.
In order to automatically format code in VSCode according to our style guide:
- Install Prettier for VSCode
- Enable the
Editor: Format on Save
setting - Your files will now be formatted automatically when you save them