Skip to content

Commit b86612c

Browse files
committed
Init commit
0 parents  commit b86612c

File tree

1,271 files changed

+172901
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,271 files changed

+172901
-0
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
src/**/*.test.tsx
2+
src/**/*.spec.tsx
3+
**/node_modules/**/*
4+
__mocks__/*

.eslintrc

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{
2+
"env": {
3+
"node": true,
4+
},
5+
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:jest-dom/recommended"],
6+
"parser": "@typescript-eslint/parser",
7+
"plugins": ["@typescript-eslint", "import", "jest-dom", "react-hooks", "testing-library"],
8+
"overrides": [
9+
{
10+
"files": ["**/*.test.tsx"],
11+
"extends": ["plugin:testing-library/react"],
12+
},
13+
{
14+
"files": ["e2e/**/*.spec.ts"],
15+
"extends": ["plugin:playwright/recommended"],
16+
"rules": {
17+
"testing-library/prefer-screen-queries": "off",
18+
},
19+
},
20+
{
21+
"files": [
22+
"**/*.config.js",
23+
"**/jest.config.js",
24+
"**/webpack.config.js",
25+
"**/karma.conf.js",
26+
"**/protractor.conf.js",
27+
"tools/**/*.js",
28+
"**/*.cjs"
29+
],
30+
"rules": {
31+
"@typescript-eslint/no-require-imports": "off"
32+
}
33+
},
34+
],
35+
"rules": {
36+
"react-hooks/exhaustive-deps": "warn",
37+
"react-hooks/rules-of-hooks": "error",
38+
// Disabling these rules for now just to keep the diff small. I'll enable them in a future PR that fixes lint issues.
39+
"@typescript-eslint/no-explicit-any": "off",
40+
"@typescript-eslint/no-unused-vars": "off",
41+
"@typescript-eslint/no-var-requires": "off",
42+
"@typescript-eslint/ban-ts-comment": "off",
43+
"@typescript-eslint/ban-types": "off",
44+
"@typescript-eslint/no-empty-object-type": ["error", { "allowInterfaces": "always", "allowObjectTypes": "always" }],
45+
// Use `import type` instead of `import` for type imports https://typescript-eslint.io/blog/consistent-type-imports-and-exports-why-and-how
46+
"@typescript-eslint/consistent-type-imports": [
47+
"error",
48+
{
49+
"fixStyle": "inline-type-imports",
50+
},
51+
],
52+
"import/no-duplicates": "error",
53+
"prefer-const": "off",
54+
"no-console": ["error", { "allow": ["warn", "error"] }],
55+
"no-unsafe-optional-chaining": "off",
56+
"no-explicit-any": "off",
57+
"no-extra-boolean-cast": "off",
58+
"no-prototype-builtins": "off",
59+
"no-useless-escape": "off",
60+
"no-restricted-imports": [
61+
"error",
62+
{
63+
"paths": [
64+
// These two rules ensure that we're importing lodash and lodash-es correctly. Not doing so can bloat our bundle size significantly.
65+
{
66+
"name": "lodash",
67+
"message": "Import specific methods from `lodash`. e.g. `import map from 'lodash/map'`",
68+
},
69+
{
70+
"name": "lodash-es",
71+
"importNames": ["default"],
72+
"message": "Import specific methods from `lodash-es`. e.g. `import { map } from 'lodash-es'`",
73+
},
74+
// These two rules ensure that we're importing Carbon components and icons from the correct packages (after v10). May be removed in the future.
75+
{
76+
"name": "carbon-components-react",
77+
"message": "Import from `@carbon/react` directly. e.g. `import { Toggle } from '@carbon/react'`",
78+
},
79+
{
80+
"name": "@carbon/icons-react",
81+
"message": "Import from `@carbon/react/icons`. e.g. `import { ChevronUp } from '@carbon/react/icons'`",
82+
},
83+
],
84+
},
85+
],
86+
},
87+
}

.github/pull_request_template.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## Requirements
2+
3+
- [ ] This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a [conventional commit](https://o3-docs.openmrs.org/docs/frontend-modules/contributing.en-US#contributing-guidelines) label. See existing PR titles for inspiration.
4+
- [ ] My work is based on designs, which are linked or shown either in the Jira ticket or the description below. (See also: [Styleguide](http://om.rs/o3ui))
5+
- [ ] My work includes tests or is validated by existing tests.
6+
7+
## Summary
8+
<!-- Please describe what problems your PR addresses. -->
9+
10+
## Screenshots
11+
<!-- Required if you are making UI changes. -->
12+
13+
## Related Issue
14+
<!-- Paste the link to the Jira ticket here if one exists. -->
15+
<!-- https://issues.openmrs.org/browse/O3- -->
16+
17+
## Other
18+
<!-- Anything not covered above -->

.github/release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
changelog:
2+
exclude:
3+
authors:
4+
- openmrs-bot

.github/workflows/bundle-size.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Report bundle size
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
env:
12+
TURBO_API: 'http://127.0.0.1:9080'
13+
TURBO_TOKEN: 'turbo-token'
14+
TURBO_TEAM: ${{ github.repository_owner }}
15+
16+
steps:
17+
- name: 📥 Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: 🛠️ Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '20.x'
24+
cache: 'yarn'
25+
26+
- name: 🚀 Setup Turborepo cache server
27+
uses: felixmosh/turborepo-gh-artifacts@v3
28+
with:
29+
repo-token: ${{ secrets.GITHUB_TOKEN }}
30+
server-token: ${{ env.TURBO_TOKEN }}
31+
32+
- name: 📊 Compute bundle size report
33+
uses: preactjs/compressed-size-action@v2
34+
with:
35+
repo-token: '${{ secrets.GITHUB_TOKEN }}'
36+
minimum-change-threshold: 10000 # 10 KB
37+
build-script: 'turbo run build --color --concurrency=5'

.github/workflows/ci.yml

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
name: OpenMRS CI
2+
3+
on:
4+
push:
5+
branches: [main, 'patch/*']
6+
pull_request:
7+
branches: [main]
8+
release:
9+
types:
10+
- created
11+
12+
env:
13+
TURBO_API: 'http://127.0.0.1:9080'
14+
TURBO_TOKEN: 'turbo-token'
15+
TURBO_TEAM: ${{ github.repository_owner }}
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
actions: read
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: 🟢 Use Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: '20.x'
29+
cache: 'yarn'
30+
31+
- name: 📦 Install dependencies
32+
run: yarn install --immutable
33+
34+
- name: 🚀 Setup a local cache server for Turborepo
35+
uses: felixmosh/turborepo-gh-artifacts@v3
36+
with:
37+
repo-token: ${{ secrets.GITHUB_TOKEN }}
38+
server-token: ${{ env.TURBO_TOKEN }}
39+
40+
- name: 🔍 Run lint, type checks and tests
41+
run: yarn verify
42+
43+
- name: 🏗️ Run build
44+
run: yarn turbo run build --color --concurrency=5
45+
46+
pre_release:
47+
runs-on: ubuntu-latest
48+
49+
needs: build
50+
51+
if: ${{ github.event_name == 'push' }}
52+
53+
steps:
54+
- uses: actions/checkout@v4
55+
with:
56+
fetch-depth: 0
57+
- name: 🟢 Use Node.js
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: '20.x'
61+
cache: 'yarn'
62+
registry-url: 'https://registry.npmjs.org'
63+
64+
- name: 📦 Install dependencies
65+
run: yarn install --immutable
66+
67+
- name: 🚀 Setup local cache server for Turborepo
68+
uses: felixmosh/turborepo-gh-artifacts@v3
69+
with:
70+
repo-token: ${{ secrets.GITHUB_TOKEN }}
71+
server-token: ${{ env.TURBO_TOKEN }}
72+
73+
- name: 🏷️ Version (main)
74+
if: github.ref_name == 'main'
75+
run: yarn workspaces foreach --all --topological --exclude @openmrs/esm-patient-chart version "$(node -e "console.log(require('semver').inc(require('./package.json').version, 'patch'))")-pre.${{ github.run_number }}"
76+
77+
- name: 🏷️ Version (patch)
78+
if: startsWith(github.ref_name, 'patch/')
79+
run: yarn workspaces foreach --all --topological --exclude @openmrs/esm-patient-chart version "$(node -e "console.log(require('semver').inc(require('./package.json').version, 'patch'))")-patch.${{ github.run_number }}"
80+
81+
- name: 🏗️ Build
82+
run: yarn turbo run build --color --concurrency=5
83+
84+
- name: 🔧 Configure Git
85+
run: git config user.email "info@openmrs.org" && git config user.name "OpenMRS CI"
86+
- name: 💾 Commit changes
87+
run: git add . && git commit -m "Prerelease version" --no-verify
88+
89+
- name: 📤 Pre-release (main)
90+
if: github.ref_name == 'main'
91+
run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn run ci:prepublish
92+
env:
93+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
94+
95+
- name: 📤 Pre-release (patch)
96+
if: startsWith(github.ref_name, 'patch/')
97+
run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn run ci:prepublish-patch
98+
env:
99+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
100+
101+
- name: 📤 Upload build artifacts
102+
uses: actions/upload-artifact@v4
103+
with:
104+
name: packages
105+
path: |
106+
packages/**/dist
107+
overwrite: true
108+
109+
deploy_patient_chart:
110+
runs-on: ubuntu-latest
111+
112+
needs: pre_release
113+
114+
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
115+
116+
steps:
117+
- name: 🚀 Trigger RefApp Build
118+
uses: fjogeleit/http-request-action@v1
119+
continue-on-error: true
120+
with:
121+
url: https://ci.openmrs.org/rest/api/latest/queue/O3-BF
122+
method: 'POST'
123+
customHeaders: '{ "Authorization": "Bearer ${{ secrets.BAMBOO_TOKEN }}" }'
124+
125+
release:
126+
runs-on: ubuntu-latest
127+
128+
needs: build
129+
130+
if: ${{ github.event_name == 'release' }}
131+
132+
steps:
133+
- uses: actions/checkout@v4
134+
- name: 🟢 Use Node.js
135+
uses: actions/setup-node@v4
136+
with:
137+
node-version: '20.x'
138+
cache: 'yarn'
139+
registry-url: 'https://registry.npmjs.org'
140+
141+
- name: 📦 Install dependencies
142+
run: yarn install --immutable
143+
144+
- name: 🚀 Setup local cache server for Turborepo
145+
uses: felixmosh/turborepo-gh-artifacts@v3
146+
with:
147+
repo-token: ${{ secrets.GITHUB_TOKEN }}
148+
server-token: ${{ env.TURBO_TOKEN }}
149+
150+
- name: 🏗️ Build
151+
run: yarn turbo run build --color --concurrency=5
152+
153+
- name: 📢 Publish
154+
run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn run ci:publish
155+
env:
156+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

0 commit comments

Comments
 (0)