Skip to content

Commit

Permalink
feat: Add context aware links (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldkibet authored Mar 13, 2023
1 parent 3c9bacb commit 12554cc
Show file tree
Hide file tree
Showing 27 changed files with 3,006 additions and 2,640 deletions.
8 changes: 8 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This is an example environment file for configuring dynamic values.
# This can be removed or changed with better solutions in the future.
# It should *only* be kept as long as there are no sensitive values in here.
E2E_BASE_URL=http://localhost:8080/openmrs
E2E_USER_ADMIN_USERNAME=Admin
E2E_USER_ADMIN_PASSWORD=Admin123
E2E_LOGIN_DEFAULT_LOCATION_NAME=Outpatient Clinic
E2E_LOGIN_DEFAULT_LOCATION_UUID=44c3efb0-2583-4c80-a79e-1f756a03c0a1
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
src/**/*.test.tsx
src/**/*.spec.tsx
**/*.d.tsx
**/node_modules/**/*
**/node_modules/**/*
49 changes: 35 additions & 14 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,37 @@
{
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"ts-react-important-stuff",
"plugin:prettier/recommended"
],
"rules": {
"curly": [
"error",
"all"
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": ["ts-react-important-stuff", "plugin:prettier/recommended"],
"rules": {
"curly": ["error", "all"],
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "lodash",
"message": "Import specific methods from `lodash-es`. e.g. `import map from 'lodash-es/map'`"
},
{
"name": "lodash-es",
"message": "Import specific methods from `lodash-es`. e.g. `import map from 'lodash-es/map'`"
}
],
"patterns": [
{
"group": ["carbon-components-react"],
"message": "Import from `@carbon/react` directly. e.g. `import { Toggle } from '@carbon/react'`"
},
{
"group": ["@carbon/icons-react"],
"message": "Import from `@carbon/react/icons`. e.g. `import { ChevronUp } from '@carbon/react/icons'`"
},
{
"group": ["@import '~carbon-components/src/globals/scss/vars'"],
"message": "Import from `@carbon/styles/scss`. e.g. `@use '@carbon/styles/scss/type'`"
}
]
}
}
}
]
}
}
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --immutable
run: yarn install

- name: Setup local cache server for Turborepo
uses: felixmosh/turborepo-gh-artifacts@v1
Expand Down
11 changes: 7 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ typings/
# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next
dist
Expand All @@ -77,4 +74,10 @@ dist
.DS_Store

.turbo/
~
~

# Playwright and e2e tests
/test-results/
/playwright-report/
/playwright/.cache/
e2e/storageState.json
18 changes: 12 additions & 6 deletions .husky/_/husky.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/bin/sh
#!/usr/bin/env sh
if [ -z "$husky_skip_init" ]; then
debug () {
[ "$HUSKY_DEBUG" = "1" ] && echo "husky (debug) - $1"
if [ "$HUSKY_DEBUG" = "1" ]; then
echo "husky (debug) - $1"
fi
}

readonly hook_name="$(basename "$0")"
readonly hook_name="$(basename -- "$0")"
debug "starting $hook_name..."

if [ "$HUSKY" = "0" ]; then
Expand All @@ -17,14 +19,18 @@ if [ -z "$husky_skip_init" ]; then
. ~/.huskyrc
fi

export readonly husky_skip_init=1
readonly husky_skip_init=1
export husky_skip_init
sh -e "$0" "$@"
exitCode="$?"

if [ $exitCode != 0 ]; then
echo "husky - $hook_name hook exited with code $exitCode (error)"
exit $exitCode
fi

exit 0
if [ $exitCode = 127 ]; then
echo "husky - command not found in PATH=$PATH"
fi

exit $exitCode
fi
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ dist/
node_modules/
**/*.md
**/*.json
**/*.yml
**/*.yml
Empty file modified .yarn/releases/yarn-3.2.3.cjs
100644 → 100755
Empty file.
95 changes: 87 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
:wave: *New to our project? Be sure to review the [OpenMRS 3 Frontend Developer Documentation](https://openmrs.github.io/openmrs-esm-core/#/). You may find the [Map of the Project](https://openmrs.github.io/openmrs-esm-core/#/main/map) especially helpful.* :teacher:
:wave: *New to our project? Be sure to review the [OpenMRS 3 Frontend Developer Documentation](https://openmrs.github.io/openmrs-esm-core/#/). You may find the [Map of the Project](https://openmrs.github.io/openmrs-esm-core/#/main/map) especially helpful.* :teacher:

# KenyaEMR esm core
![Node.js CI](https://github.com/openmrs/openmrs-esm-patient-management/actions/workflows/ci.yml/badge.svg)

This repository contains frontend modules for the KenyaEMR. These modules relate to display patient-flags. The modules within this repository include:
# OpenMRS Patient Management

- [Patient flags](packages/esm-patient-flags-app/)
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:

- [Active visits app](packages/esm-active-visits-app/)
- [Appointments app](packages/esm-appointments-app/)
- [Outpatient app](packages/esm-outpatient-app/README.md)
- [Patient search](packages/esm-patient-search-app)
- [Patient registration](packages/esm-patient-registration-app)
- [Patient list](packages/esm-patient-list-app)

## Setup

Expand All @@ -14,9 +21,20 @@ This monorepo uses [yarn](https://yarnpkg.com) and [lerna](https://github.com/le

To install the dependancies, run:
```bash
npx lerna bootstrap
yarn install
```

To set up environment variables for the project, follow these steps:

1. Create a copy of the .env.example file by running the following command:
```bash
cp example.env .env
```
2. Open the newly created .env file in the root of the project.
3. Add the environment variables you need.

Note: These variables are currently only used for end-to-end tests.

To start a dev server running all the modules simultaneously, run:

```bash
Expand All @@ -36,25 +54,86 @@ yarn start --sources 'packages/esm-<insert-package-name>-app'
You could provide `yarn start` with as many `sources` arguments as you require. For example, to run the patient registration and patient search modules only, use:

```bash
yarn start --sources 'packages/esm-patient-flags-app'
yarn start --sources 'packages/esm-patient-search-app' --sources 'packages/esm-patient-registration-app'
```

## Troubleshooting

If you notice that your local version of the application is not working or that there's a mismatch between what you see locally versus what's in the reference application, you likely have outdated versions of core libraries. To update core libraries, run the following commands:

```bash
# Upgrade core libraries
yarn up openmrs @openmrs/esm-framework

# Reset version specifiers to `next`. Don't commit actual version numbers.
git checkout package.json

# Run `yarn` to recreate the lockfile
yarn
```


## Contributing

Please read our [contributing](http://o3-dev.docs.openmrs.org/#/getting_started/contributing) guide.

## Running tests

To run tests, use:
### Unit tests
To run unit tests, use:

```sh
yarn test
```

### E2E tests

To run E2E tests, make sure the dev server is running by using:

```sh
yarn start --sources 'packages/esm-*-app/'
```

Then, in a separate terminal, run:

```sh
yarn test-e2e --headed
```

Please read [our e2e docs](e2e/README.md) for more information about E2E testing.

## Design Patterns

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

## Deployment

The `main` branch of this repo is deployed in a [demo](https://data.kenyahmis.org:8500/openmrs/spa).
The `main` branch of this repo is deployed in a [demo environment](https://openmrs-spa.org/openmrs/spa).

## Configuration

This module is designed to be driven by configuration files.

## Version and release

To increment the version, run the following command:

```sh
yarn release
```

You will need to pick the next version number. We use minor changes (e.g. `3.2.0``3.3.0`)
to indicate big new features and breaking changes, and patch changes (e.g. `3.2.0``3.2.1`)
otherwise.

Note that this command will not create a new tag, nor publish the packages.
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
will cause GitHub Actions to publish the packages, completing the release process.

> Don't run `npm publish`, `yarn publish`, or `lerna publish`. Use the above process.
6 changes: 6 additions & 0 deletions example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This is an example environment file for configuring dynamic values.
E2E_BASE_URL=http://localhost:8080/openmrs
E2E_USER_ADMIN_USERNAME=admin
E2E_USER_ADMIN_PASSWORD=Admin123
E2E_LOGIN_DEFAULT_LOCATION_UUID=44c3efb0-2583-4c80-a79e-1f756a03c0a1
# The above location UUID is for the "Outpatient Clinic" location in the reference application
10 changes: 7 additions & 3 deletions jest.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"!**/node_modules/**",
"!**/vendor/**",
"!**/src/**/*.test.*",
"!**/src/declarations.d.tsx"
"!**/src/declarations.d.tsx",
"!**/e2e/**"
],
"coverageThreshold": {
"global": {
Expand All @@ -32,5 +33,8 @@
"testEnvironmentOptions": {
"url": "http://localhost/"
},
"resolver": "<rootDir>/jest-resolver.js"
}
"resolver": "<rootDir>/jest-resolver.js",
"testPathIgnorePatterns" : [
"<rootDir>/e2e"
]
}
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
],
"npmClient": "yarn",
"useWorkspaces": true,
"version": "3.1.0",
"version": "4.1.0",
"command": {
"publish": {
"verifyAccess": false
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@
"packages/*"
],
"scripts": {
"start": "openmrs develop --sources 'packages/esm-*-app/'",
"start": "openmrs develop",
"ci:publish": "lerna publish from-package --yes",
"ci:prepublish": "lerna publish from-package --no-git-reset --yes --dist-tag next",
"release": "lerna version --no-git-tag-version",
"verify": "turbo run lint && turbo run typescript",
"prettier": "prettier --config prettier.config.js --write \"packages/**/*.{ts,tsx,css,scss}\"",
"prettier": "prettier --config prettier.config.js --write \"packages/**/*.{ts,tsx,css,scss}\" \"e2e/**/*.ts\"",
"test": "cross-env TZ=UTC jest --config jest.config.json --verbose false --passWithNoTests",
"test-watch": "cross-env TZ=UTC jest --watch --config jest.config.json",
"test-e2e": "playwright test --project=chromium",
"coverage": "yarn test --coverage",
"prepare": "husky install",
"postinstall": "husky install",
"extract-translations": "lerna run extract-translations -- --config ../../tools/i18next-parser.config.js"
},
"dependencies": {
"swr": "2.0.1"
"swr": "^2.0.1"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@carbon/colors": "^11.2.0",
"@carbon/react": "^1.8.0",
"@jsenv/file-size-impact": "12.1.1",
"@carbon/react": "^1.12.0",
"@openmrs/esm-framework": "next",
"@playwright/test": "^1.30.0",
"@swc/core": "^1.2.165",
"@swc/jest": "^0.2.20",
"@testing-library/dom": "^8.13.0",
Expand All @@ -46,21 +46,21 @@
"babel-preset-minify": "^0.5.1",
"concurrently": "^5.3.0",
"cross-env": "^7.0.3",
"css-loader": "^6.7.1",
"dayjs": "^1.8.36",
"dotenv": "^16.0.3",
"eslint": "^7.20.0",
"eslint-config-prettier": "^8.2.0",
"eslint-config-ts-react-important-stuff": "^3.0.0",
"eslint-plugin-prettier": "^3.3.1",
"husky": "^6.0.0",
"husky": "^8.0.1",
"i18next": "^19.7.0",
"i18next-parser": "^3.11.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^28.1.0",
"jest-cli": "^28.1.0",
"jest-environment-jsdom": "^28.1.0",
"lerna": "^3.20.2",
"openmrs": "^4.0.0-pre.1",
"openmrs": "next",
"prettier": "^2.4.1",
"pretty-quick": "^2.0.2",
"react": "^18.1.0",
Expand All @@ -69,7 +69,7 @@
"react-router-dom": "^6.3.0",
"sass": "^1.29.0",
"sass-loader": "^10.1.0",
"turbo": "^1.2.2",
"turbo": "^1.6.3",
"typedoc": "^0.22.15",
"typescript": "^4.0.3",
"webpack": "^5.74.0",
Expand Down
Loading

0 comments on commit 12554cc

Please sign in to comment.