@cc-openmrs/cc-esm-active-prescriptions 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/.editorconfig +12 -0
  2. package/.eslintignore +2 -0
  3. package/.eslintrc +57 -0
  4. package/.github/pull_request_template.md +17 -0
  5. package/.github/workflows/ci.yml +103 -0
  6. package/.github/workflows/e2e.yml +63 -0
  7. package/.github/workflows/update-openmrs-deps.yml +92 -0
  8. package/.husky/pre-commit +7 -0
  9. package/.husky/pre-push +6 -0
  10. package/.prettierignore +14 -0
  11. package/.turbo.json +18 -0
  12. package/LICENSE +401 -0
  13. package/README.md +37 -0
  14. package/__mocks__/react-i18next.js +50 -0
  15. package/dist/181.js +2 -0
  16. package/dist/181.js.LICENSE.txt +39 -0
  17. package/dist/184.js +2 -0
  18. package/dist/184.js.LICENSE.txt +14 -0
  19. package/dist/197.js +1 -0
  20. package/dist/255.js +1 -0
  21. package/dist/282.js +2 -0
  22. package/dist/282.js.LICENSE.txt +32 -0
  23. package/dist/300.js +1 -0
  24. package/dist/327.js +2 -0
  25. package/dist/327.js.LICENSE.txt +14 -0
  26. package/dist/335.js +1 -0
  27. package/dist/353.js +1 -0
  28. package/dist/389.js +1 -0
  29. package/dist/488.js +1 -0
  30. package/dist/540.js +2 -0
  31. package/dist/540.js.LICENSE.txt +9 -0
  32. package/dist/55.js +1 -0
  33. package/dist/652.js +1 -0
  34. package/dist/70.js +1 -0
  35. package/dist/91.js +1 -0
  36. package/dist/961.js +2 -0
  37. package/dist/961.js.LICENSE.txt +19 -0
  38. package/dist/970.js +1 -0
  39. package/dist/99.js +1 -0
  40. package/dist/main.js +1 -0
  41. package/dist/openmrs-esm-template-app.js +1 -0
  42. package/dist/openmrs-esm-template-app.js.buildmanifest.json +604 -0
  43. package/dist/routes.json +1 -0
  44. package/package.json +111 -0
  45. package/src/boxes/extensions/blue-box.component.tsx +15 -0
  46. package/src/boxes/extensions/box.scss +23 -0
  47. package/src/boxes/extensions/brand-box.component.tsx +15 -0
  48. package/src/boxes/extensions/red-box.component.tsx +15 -0
  49. package/src/boxes/slot/boxes.component.tsx +25 -0
  50. package/src/boxes/slot/boxes.scss +29 -0
  51. package/src/config-schema.ts +43 -0
  52. package/src/declarations.d.ts +5 -0
  53. package/src/greeter/greeter.component.tsx +42 -0
  54. package/src/greeter/greeter.scss +20 -0
  55. package/src/index.ts +49 -0
  56. package/src/patient-getter/patient-getter.component.tsx +40 -0
  57. package/src/patient-getter/patient-getter.resource.ts +39 -0
  58. package/src/patient-getter/patient-getter.scss +16 -0
  59. package/src/resources/resources.component.tsx +56 -0
  60. package/src/resources/resources.scss +68 -0
  61. package/src/root.component.tsx +39 -0
  62. package/src/root.scss +15 -0
  63. package/src/routes.json +46 -0
  64. package/webpack.config.js +1 -0
package/.editorconfig ADDED
@@ -0,0 +1,12 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 2
6
+ charset = utf-8
7
+ trim_trailing_whitespace = true
8
+ insert_final_newline = true
9
+ end_of_line = lf
10
+
11
+ [*.md]
12
+ trim_trailing_whitespace = false
package/.eslintignore ADDED
@@ -0,0 +1,2 @@
1
+ src/**/*.test.tsx
2
+ **/*.d.tsx
package/.eslintrc ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "env": {
3
+ "node": true
4
+ },
5
+ "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
6
+ "parser": "@typescript-eslint/parser",
7
+ "plugins": ["@typescript-eslint", "react-hooks"],
8
+ "root": true,
9
+ "rules": {
10
+ "react-hooks/exhaustive-deps": "warn",
11
+ "react-hooks/rules-of-hooks": "error",
12
+ // Disabling these rules for now just to keep the diff small. I'll enable them in a future PR that fixes lint issues.
13
+ "@typescript-eslint/no-explicit-any": "off",
14
+ "@typescript-eslint/no-unused-vars": "off",
15
+ "@typescript-eslint/no-var-requires": "off",
16
+ "@typescript-eslint/ban-ts-comment": "off",
17
+ "@typescript-eslint/ban-types": "off",
18
+ // Use `import type` instead of `import` for type imports https://typescript-eslint.io/blog/consistent-type-imports-and-exports-why-and-how
19
+ "@typescript-eslint/consistent-type-imports": [
20
+ "error",
21
+ {
22
+ "fixStyle": "inline-type-imports"
23
+ }
24
+ ],
25
+ "prefer-const": "off",
26
+ "no-console": ["error", { "allow": ["warn", "error"] }],
27
+ "no-unsafe-optional-chaining": "off",
28
+ "no-explicit-any": "off",
29
+ "no-extra-boolean-cast": "off",
30
+ "no-prototype-builtins": "off",
31
+ "no-useless-escape": "off",
32
+ "no-restricted-imports": [
33
+ "error",
34
+ {
35
+ "paths": [
36
+ {
37
+ "name": "lodash",
38
+ "message": "Import specific methods from `lodash`. e.g. `import map from 'lodash/map'`"
39
+ },
40
+ {
41
+ "name": "lodash-es",
42
+ "importNames": ["default"],
43
+ "message": "Import specific methods from `lodash-es`. e.g. `import { map } from 'lodash-es'`"
44
+ },
45
+ {
46
+ "name": "carbon-components-react",
47
+ "message": "Import from `@carbon/react` directly. e.g. `import { Toggle } from '@carbon/react'`"
48
+ },
49
+ {
50
+ "name": "@carbon/icons-react",
51
+ "message": "Import from `@carbon/react/icons`. e.g. `import { ChevronUp } from '@carbon/react/icons'`"
52
+ }
53
+ ]
54
+ }
55
+ ]
56
+ }
57
+ }
@@ -0,0 +1,17 @@
1
+ ## Requirements
2
+ - [ ] This PR has a title that briefly describes the work done including a [conventional commit](https://o3-dev.docs.openmrs.org/#/getting_started/contributing?id=your-pr-title-should-indicate-the-type-of-change-it-is) type prefix and a Jira ticket number if applicable. See existing PR titles for inspiration.
3
+ - [ ] My work is based on designs, which are linked or shown either in the Jira ticket or the description below.
4
+ - [ ] My work includes tests or is validated by existing tests.
5
+
6
+ ## Summary
7
+ <!-- Please describe what problems your PR addresses. -->
8
+
9
+ ## Screenshots
10
+ <!-- Required if you are making UI changes. -->
11
+
12
+ ## Related Issue
13
+ <!-- Paste the link to the Jira ticket here if one exists. -->
14
+ <!-- https://issues.openmrs.org/browse/O3- -->
15
+
16
+ ## Other
17
+ <!-- Anything not covered above -->
@@ -0,0 +1,103 @@
1
+ name: OpenMRS CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+ release:
9
+ types:
10
+ - created
11
+
12
+ env:
13
+ ESM_NAME: "@openmrs/esm-template-app"
14
+ JS_NAME: "openmrs-esm-template-app.js"
15
+
16
+ jobs:
17
+ build:
18
+ runs-on: ubuntu-latest
19
+
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ - name: Use Node.js
23
+ uses: actions/setup-node@v4
24
+ with:
25
+ node-version: 20
26
+ - run: yarn install --immutable
27
+ - run: yarn verify
28
+ - run: yarn build
29
+ - name: Upload Artifacts
30
+ uses: actions/upload-artifact@v4
31
+ with:
32
+ name: dist
33
+ path: |
34
+ dist
35
+
36
+ pre_release:
37
+ runs-on: ubuntu-latest
38
+
39
+ needs: build
40
+
41
+ if: ${{ github.event_name == 'push' }}
42
+
43
+ steps:
44
+ - run: echo "Uncomment the lines below and delete this one."
45
+ # - uses: actions/checkout@v4
46
+ # - name: Download Artifacts
47
+ # uses: actions/download-artifact@v4
48
+ # - name: Use Node.js
49
+ # uses: actions/setup-node@v4
50
+ # with:
51
+ # node-version: 20
52
+ # registry-url: "https://registry.npmjs.org"
53
+ # - run: yarn install --immutable
54
+ # - run: yarn version "$(node -e "console.log(require('semver').inc(require('./package.json').version, 'patch'))")-pre.${{ github.run_number }}"
55
+ # - run: yarn build
56
+ # - run: git config user.email "info@openmrs.org" && git config user.name "OpenMRS CI"
57
+ # - run: git add . && git commit -m "Prerelease version" --no-verify
58
+ # - run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn npm publish --access public --tag next
59
+ # env:
60
+ # NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
61
+ # - name: Upload Artifacts
62
+ # uses: actions/upload-artifact@v4
63
+ # with:
64
+ # name: dist
65
+ # path: |
66
+ # dist
67
+
68
+ release:
69
+ runs-on: ubuntu-latest
70
+
71
+ needs: build
72
+
73
+ if: ${{ github.event_name == 'release' }}
74
+
75
+ steps:
76
+ - uses: actions/checkout@v4
77
+ - name: Download Artifacts
78
+ uses: actions/download-artifact@v4
79
+ - name: Use Node.js
80
+ uses: actions/setup-node@v4
81
+ with:
82
+ node-version: 20
83
+ registry-url: 'https://registry.npmjs.org'
84
+ - run: yarn install --immutable
85
+ - run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn npm publish
86
+ env:
87
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
88
+
89
+ deploy:
90
+ runs-on: ubuntu-latest
91
+
92
+ needs: pre_release
93
+
94
+ if: ${{ github.event_name == 'push' }}
95
+
96
+ steps:
97
+ - run: echo "Uncomment the lines below and delete this one."
98
+ # - name: Trigger RefApp Build
99
+ # uses: fjogeleit/http-request-action@v1
100
+ # with:
101
+ # url: https://ci.openmrs.org/rest/api/latest/queue/O3-BP
102
+ # method: "POST"
103
+ # customHeaders: '{ "Authorization": "Bearer ${{ secrets.BAMBOO_TOKEN }}" }'
@@ -0,0 +1,63 @@
1
+ name: E2E Tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+
11
+ jobs:
12
+ main:
13
+ runs-on: ubuntu-latest
14
+ timeout-minutes: 15
15
+ steps:
16
+ - name: Checkout repo
17
+ uses: actions/checkout@v4
18
+
19
+ - name: Copy test environment variables
20
+ run: cp example.env .env
21
+
22
+ - name: Setup node
23
+ uses: actions/setup-node@v4
24
+ with:
25
+ node-version: 20
26
+
27
+ - name: Cache dependencies
28
+ id: cache
29
+ uses: actions/cache@v4
30
+ with:
31
+ path: '**/node_modules'
32
+ key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
33
+
34
+ - name: Install dependencies
35
+ if: steps.cache.outputs.cache-hit != 'true'
36
+ run: yarn install --immutable
37
+
38
+ - name: Install Playwright Browsers
39
+ run: npx playwright install chromium --with-deps
40
+
41
+ - name: Build apps
42
+ run: yarn turbo build --concurrency=5
43
+
44
+ - name: Run dev server
45
+ run: bash e2e/support/github/run-e2e-docker-env.sh
46
+
47
+ - name: Wait for OpenMRS instance to start
48
+ run: while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:8080/openmrs/login.htm)" != "200" ]]; do sleep 10; done
49
+
50
+ - name: Run E2E tests
51
+ run: yarn test-e2e
52
+
53
+ - name: 🛑 Stop dev server
54
+ if: '!cancelled()'
55
+ run: docker stop $(docker ps -a -q)
56
+
57
+ - name: Upload report
58
+ uses: actions/upload-artifact@v4
59
+ if: always()
60
+ with:
61
+ name: playwright-report
62
+ path: playwright-report/
63
+ retention-days: 30
@@ -0,0 +1,92 @@
1
+ # Workflow to automatically check and update OpenMRS dependencies
2
+ # Runs hourly and can be triggered manually
3
+
4
+ name: 'Check for OpenMRS Dependency Updates'
5
+
6
+ on:
7
+ workflow_dispatch:
8
+ schedule:
9
+ # Runs every hour at minute 30
10
+ - cron: '30 * * * *'
11
+
12
+ jobs:
13
+ check-for-updates:
14
+ name: Check for updates to OpenMRS libraries
15
+ runs-on: ubuntu-latest
16
+
17
+ if: github.repository_owner == 'openmrs'
18
+
19
+ permissions:
20
+ contents: write
21
+ pull-requests: write
22
+
23
+ steps:
24
+ # Step 1: Check out repository
25
+ - name: Checkout repository
26
+ uses: actions/checkout@v4
27
+
28
+ # Step 2: Setup Node.js environment
29
+ - name: 🟢 Setup Node.js
30
+ uses: actions/setup-node@v4
31
+ with:
32
+ node-version: 20
33
+
34
+ # Step 3: Cache dependencies
35
+ - name: 💾 Cache dependencies
36
+ id: cache
37
+ uses: actions/cache@v4
38
+ with:
39
+ path: '**/node_modules'
40
+ key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
41
+
42
+ # Step 4: Install dependencies if cache miss
43
+ - name: 📦 Install dependencies
44
+ if: steps.cache.outputs.cache-hit != 'true'
45
+ run: yarn install --immutable
46
+
47
+ # Step 5: Run dependency update check
48
+ - name: ✅ Check for updates
49
+ run: node ./tools/update-openmrs-deps.mjs
50
+
51
+ # Step 6: Create PR with updates if necessary
52
+ - name: ⬆️ Create PR if necessary
53
+ id: cpr
54
+ uses: peter-evans/create-pull-request@v7
55
+ with:
56
+ commit-message: '(chore) Update OpenMRS dependencies'
57
+ title: '(chore) Update OpenMRS dependencies'
58
+ body: |
59
+ # OpenMRS Dependencies Update
60
+
61
+ This PR contains updates to OpenMRS dependencies.
62
+
63
+ ## Changes
64
+ * Automated dependency updates for OpenMRS packages
65
+ * Generated by the OpenMRS Dependency Update workflow
66
+
67
+ ## Verification
68
+ - [ ] All dependencies are valid versions
69
+ - [ ] No breaking changes introduced
70
+
71
+ > This PR was automatically generated and will be automatically merged if checks pass.
72
+ branch: 'chore/update-openmrs-deps'
73
+ author: 'OpenMRS Bot <infrastructure@openmrs.org>'
74
+ token: ${{ secrets.OMRS_BOT_GH_TOKEN }}
75
+ labels: |
76
+ dependencies
77
+ automated-pr
78
+ delete-branch: true # Clean up branch after merge
79
+
80
+ # Step 7: Auto-approve the PR if created or updated
81
+ - name: ✅ Auto approve PR
82
+ if: steps.cpr.outputs.pull-request-operation == 'created' || steps.cpr.outputs.pull-request-operation == 'updated'
83
+ run: gh pr review --approve "${{ steps.cpr.outputs.pull-request-number }}"
84
+ env:
85
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86
+
87
+ # Step 8: Auto-merge the PR if created or updated
88
+ - name: 🔀 Auto merge PR
89
+ if: steps.cpr.outputs.pull-request-operation == 'created' || steps.cpr.outputs.pull-request-operation == 'updated'
90
+ run: gh pr merge --auto --squash "${{ steps.cpr.outputs.pull-request-number }}"
91
+ env:
92
+ GH_TOKEN: ${{ secrets.OMRS_BOT_GH_TOKEN }}
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ set -e # die on error
5
+
6
+ yarn lint-staged --no-stash
7
+ yarn turbo extract-translations
@@ -0,0 +1,6 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ set -e # die on error
5
+
6
+ yarn verify
@@ -0,0 +1,14 @@
1
+ # directories
2
+ .husky/
3
+ dist/
4
+ node_modules/
5
+
6
+ # dotfiles and generated
7
+ .*
8
+ yarn.lock
9
+
10
+ # by file type
11
+ **/*.css
12
+ **/*.scss
13
+ **/*.md
14
+ **/*.json
package/.turbo.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://turbo.build/schema.json",
3
+ "tasks": {
4
+ "build": {
5
+ "outputs": ["dist/**"]
6
+ },
7
+ "lint": {},
8
+ "extract-translations": {
9
+ "outputs": ["./translations/*"]
10
+ },
11
+ "test": {},
12
+ "coverage": {
13
+ "outputs": ["coverage/**"]
14
+ },
15
+ "typescript": {},
16
+ "verify": {}
17
+ }
18
+ }