Skip to content

Commit

Permalink
Merge branch 'main' into O3-3260
Browse files Browse the repository at this point in the history
  • Loading branch information
mccarthyaaron authored Aug 6, 2024
2 parents f433f55 + e0288a0 commit e2e4dbc
Show file tree
Hide file tree
Showing 489 changed files with 16,844 additions and 7,365 deletions.
53 changes: 49 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
"env": {
"node": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest-dom/recommended",
"plugin:testing-library/react"
],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "react-hooks"],
"plugins": ["@typescript-eslint", "jest-dom", "react-hooks", "testing-library"],
"rules": {
"react-hooks/rules-of-hooks": "error",
// Disabling these rules for now just to keep the diff small. I'll enable them one by one as we go.
Expand All @@ -14,6 +19,11 @@
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/triple-slash-reference": "off",
// The following rules need `noImplicitAny` to be set to `true` in our tsconfig. They are too restrictive for now, but should be reconsidered in future
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/unbound-method": "off",
// Use `import type` instead of `import` for type imports https://typescript-eslint.io/blog/consistent-type-imports-and-exports-why-and-how
"@typescript-eslint/consistent-type-imports": [
"error",
Expand All @@ -22,7 +32,12 @@
}
],
"prefer-const": "off",
"no-console": ["error", { "allow": ["warn", "error"] }],
"no-console": [
"error",
{
"allow": ["warn", "error"]
}
],
"no-unsafe-optional-chaining": "off",
"no-explicit-any": "off",
"no-extra-boolean-cast": "off",
Expand Down Expand Up @@ -54,5 +69,35 @@
]
}
]
}
},
"overrides": [
{
"files": ["**/e2e/**"],
"rules": {
"testing-library/await-async-events": "off",
"testing-library/await-async-query": "off",
"testing-library/await-async-utils": "off",
"testing-library/no-await-sync-events": "off",
"testing-library/no-await-sync-queries": "off",
"testing-library/no-container": "off",
"testing-library/no-debugging-utils": "off",
"testing-library/no-dom-import": "off",
"testing-library/no-global-regexp-flag-in-query": "off",
"testing-library/no-manual-cleanup": "off",
"testing-library/no-node-access": "off",
"testing-library/no-promise-in-fire-event": "off",
"testing-library/no-render-in-lifecycle": "off",
"testing-library/no-unnecessary-act": "off",
"testing-library/no-wait-for-multiple-assertions": "off",
"testing-library/no-wait-for-side-effects": "off",
"testing-library/no-wait-for-snapshot": "off",
"testing-library/prefer-find-by": "off",
"testing-library/prefer-implicit-assert": "off",
"testing-library/prefer-presence-queries": "off",
"testing-library/prefer-query-by-disappearance": "off",
"testing-library/prefer-screen-queries": "off",
"testing-library/render-result-naming-convention": "off"
}
}
]
}
2 changes: 1 addition & 1 deletion .github/workflows/bundle-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ jobs:
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
minimum-change-threshold: 10000 # 10 KB
build-script: "turbo build --concurrency=5"
build-script: "turbo run build --concurrency=5"

6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
run: yarn verify

- name: Run build
run: yarn turbo build --concurrency=5
run: yarn turbo run build --concurrency=5

- name: Upload build artifacts
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
run: yarn workspaces foreach --worktree --topological --exclude @openmrs/esm-patient-management version "$(node -e "console.log(require('semver').inc(require('./package.json').version, 'patch'))")-pre.${{ github.run_number }}"

- name: Build
run: yarn turbo build --concurrency=5
run: yarn turbo run build --concurrency=5

- run: git config user.email "[email protected]" && git config user.name "OpenMRS CI"
- run: git add . && git commit -m "Prerelease version" --no-verify
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --immutable

- run: yarn turbo build --color
- run: yarn turbo run build --color
- run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn run ci:publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ on:
branches:
- main

env:
TURBO_API: 'http://127.0.0.1:9080'
TURBO_TOKEN: ${{ secrets.TURBO_SERVER_TOKEN }}
TURBO_TEAM: ${{ github.repository_owner }}

jobs:
main:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -35,11 +40,18 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --immutable

- name: Setup local cache server for Turborepo
uses: felixmosh/turborepo-gh-artifacts@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
server-token: ${{ env.TURBO_TOKEN }}


- name: Install Playwright Browsers
run: npx playwright install chromium --with-deps

- name: Build apps
run: yarn turbo build --concurrency=5
run: yarn turbo run build --color --concurrency=5

- name: Run dev server
run: bash e2e/support/github/run-e2e-docker-env.sh
Expand All @@ -51,7 +63,7 @@ jobs:
run: yarn playwright test

- name: Stop dev server
if: "!cancelled()"
if: '!cancelled()'
run: docker stop $(docker ps -a -q)

- name: Upload Report
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ dist
.turbo/
~

# Environment variables
.env

# Playwright and e2e tests
/test-results/
/playwright-report/
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
set -e # die on error

npx lint-staged
yarn turbo extract-translations
yarn turbo run extract-translations
9 changes: 9 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ replace_edited_strings = false
keep_translations = false
resource_name = esm-appointments-app

[o:openmrs:p:openmrs-esm-patient-management:r:esm-bed-management-app]
file_filter = packages/esm-bed-management-app/translations/<lang>.json
source_file = packages/esm-bed-management-app/translations/en.json
source_lang = en
type = KEYVALUEJSON
replace_edited_strings = false
keep_translations = false
resource_name = esm-bed-management-app

[o:openmrs:p:openmrs-esm-patient-management:r:esm-patient-list-management-app]
file_filter = packages/esm-patient-list-management-app/translations/<lang>.json
source_file = packages/esm-patient-list-management-app/translations/en.json
Expand Down
39 changes: 20 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@

# OpenMRS Patient Management

This repository contains frontend modules for the OpenMRS SPA. These modules relate to registering and editing patients, searching for existing patients, creating and managing patient lists, managing patient queues in an outpatient setting and creating, editing and managing patient appointments. The modules within this repository include:
This repository contains frontend modules for O3. These modules relate to registering and editing patients, searching for existing patients, creating and managing patient lists, managing patient queues in an outpatient setting and creating, editing and managing patient appointments. The modules within this repository include:

- [Active visits app](packages/esm-active-visits-app/)
- [Appointments app](packages/esm-appointments-app/)
- [Service queues](packages/esm-service-queues-app/README.md)
- [Patient search](packages/esm-patient-search-app)
- [Patient registration](packages/esm-patient-registration-app)
- [Bed management](packages/esm-bed-management-app/)
- [Patient list management](packages/esm-patient-list-management-app)
- [Patient registration](packages/esm-patient-registration-app)
- [Patient search](packages/esm-patient-search-app)
- [Service queues](packages/esm-service-queues-app/README.md)
- [Ward](packages/esm-ward-app)

## Setup
Expand All @@ -20,7 +21,8 @@ Check out the developer documentation [here](http://o3-dev.docs.openmrs.org).

This monorepo uses [yarn](https://yarnpkg.com).

To install the dependancies, run:
To install the dependencies, run:

```bash
yarn install
```
Expand Down Expand Up @@ -68,7 +70,6 @@ git checkout package.json
yarn
```


## Contributing

Please read our [contributing](http://o3-dev.docs.openmrs.org/#/getting_started/contributing) guide.
Expand All @@ -78,48 +79,49 @@ Please read our [contributing](http://o3-dev.docs.openmrs.org/#/getting_started/
To run tests for all packages, run:

```bash
yarn turbo test
yarn turbo run test
```

To run tests in `watch` mode, run:

```bash
yarn turbo test:watch
yarn turbo run test:watch
```

To run tests for a specific package, pass the package name to the `--filter` flag. For example, to run tests for `esm-patient-conditions-app`, run:

```bash
yarn turbo test --filter="esm-patient-conditions-app"
yarn turbo test --filter=@openmrs/esm-patient-conditions-app
```

To run a specific test file, run:

```bash
yarn turbo test -- basic-search
yarn turbo run test -- basic-search
```

The above command will only run tests in the file or files that match the provided string.

You can also run the matching tests from above in watch mode by running:

```bash
yarn turbo test:watch --basic-search
yarn turbo run test:watch --basic-search
```

To generate a `coverage` report, run:

```bash
yarn turbo coverage
yarn turbo run coverage
```

By default, `turbo` will cache test runs. This means that re-running tests wihout changing any of the related files will return the cached logs from the last run. To bypass the cache, run tests with the `force` flag, as follows:

```bash
yarn turbo test --force
yarn turbo run test --force
```

### Unit tests

To run unit tests, use:

```sh
Expand All @@ -140,13 +142,13 @@ Then, in a separate terminal, run:
yarn test-e2e --headed
```

Please read [our e2e test guide](https://o3-docs.openmrs.org/docs/frontend-modules/testing#end-to-end-testing-with-playwright) for more information about E2E testing.
Please read [our E2E testing guide](https://o3-docs.openmrs.org/docs/frontend-modules/end-to-end-testing) for more information about E2E testing.

### Updating Playwright Version
### Updating Playwright

To upgrade your Playwright version, ensure that you update both the package.json file and the [e2e/support/bamboo/playwright.Dockerfile](e2e/support/bamboo/playwright.Dockerfile).
To upgrade your Playwright version, update both the package.json file and the [e2e/support/bamboo/playwright.Dockerfile](e2e/support/bamboo/playwright.Dockerfile).

## Design Patterns
## Design patterns

For documentation about our design patterns, please visit our [design system](https://zeroheight.com/23a080e38/p/880723--introduction) documentation website.

Expand Down Expand Up @@ -176,8 +178,7 @@ After running it, make a PR or merge to `main` with the resulting changeset.
Once the version bump is merged, go to GitHub and
[draft a new release](https://github.com/openmrs/openmrs-esm-patient-management/releases/new).
The tag should be prefixed with `v` (e.g., `v3.2.1`), while the release title
should just be the version number (e.g., `3.2.1`). The creation of the GitHub release
should be the version number (e.g., `3.2.1`). The creation of the GitHub release
will cause GitHub Actions to publish the packages, completing the release process.

> Don't run `npm publish` or `yarn publish`. Use the above process.
5 changes: 3 additions & 2 deletions __mocks__/address.mock.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { type PersonAddress } from '../packages/esm-service-queues-app/src/types';
import { type PersonAddress } from '@openmrs/esm-framework';

export const mockAddress: Partial<PersonAddress> = {
export const mockAddress: PersonAddress = {
postalCode: '12345',
address1: '123 Main St',
cityVillage: 'City',
stateProvince: 'State',
country: 'Country',
preferred: true,
uuid: 'add7e55',
};
6 changes: 6 additions & 0 deletions __mocks__/emr-configuration.mock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const emrConfigurationMock = {
clinicianEncounterRole: { uuid: '240b26f9-dd88-4172-823d-4a8bfeb7841f' },
consultFreeTextCommentsConcept: { uuid: '162169AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' },
visitNoteEncounterType: { uuid: 'd7151f82-c1f3-4152-a605-2f9ea7414a79' },
admissionEncounterType: { uuid: 'e8151f82-c1f3-4152-a605-2f9ea7414a79' },
};
Loading

0 comments on commit e2e4dbc

Please sign in to comment.