Skip to content

Commit

Permalink
Merge pull request #26 from METS-Programme/packaging
Browse files Browse the repository at this point in the history
Packaging
  • Loading branch information
pirupius authored Nov 15, 2022
2 parents 6b8f199 + df15b09 commit 8a1d600
Show file tree
Hide file tree
Showing 117 changed files with 7,720 additions and 2,215 deletions.
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
src/**/*.test.tsx
**/*.d.tsx
src/**/*.spec.tsx
**/*.d.tsx
**/node_modules/**/*
31 changes: 30 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,33 @@
{
"parser": "@typescript-eslint/parser",
"extends": ["ts-react-important-stuff", "plugin:prettier/recommended"]
"plugins": [
"@typescript-eslint"
],
"extends": ["ts-react-important-stuff", "plugin:prettier/recommended"],
"rules": {
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "lodash",
"message": "Import specific methods from `lodash`. e.g. `import map from 'lodash/map'`"
},
{
"name": "lodash-es",
"importNames": ["default"],
"message": "Import specific methods from `lodash-es`. e.g. `import { map } from 'lodash-es'`"
},
{
"name": "carbon-components-react",
"message": "Import from `@carbon/react` directly. e.g. `import { Toggle } from '@carbon/react'`"
},
{
"name": "@carbon/icons-react",
"message": "Import from `@carbon/react/icons`. e.g. `import { ChevronUp } from '@carbon/react/icons'`"
}
]
}
]
}
}
35 changes: 17 additions & 18 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ on:
types:
- created

env:
ESM_NAME: "@ugandaemr/esm-ugandaemr-app"
JS_NAME: "esm-ugandaemr-app.js"

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -25,13 +21,13 @@ jobs:
node-version: "18.x"
- run: yarn install --immutable
- run: yarn verify
- run: yarn build
- run: yarn turbo run build
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: dist
name: packages
path: |
dist
packages/**/dist
pre_release:
runs-on: ubuntu-latest
Expand All @@ -41,27 +37,30 @@ jobs:
if: ${{ github.event_name == 'push' }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Download Artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v2
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "18.x"
registry-url: "https://registry.npmjs.org"
- run: yarn
scope: "@ugandaemr"
- run: yarn install --immutable

- name: Version
run: yarn lerna version "$(node -e "console.log(require('semver').inc(require('./lerna.json').version, 'patch'))")-pre.${{ github.run_number }}" --no-git-tag-version --no-push --yes

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

- run: git config user.email "<>" && git config user.name "GitHub Actions Bot"
- run: git add . && git commit -m "Prerelease version" --no-verify
- run: sed -i -e "s/\(\"version\":\\s\+\"\([0-9]\+\.\?\)\+\)/\1-pre.${{ github.run_number }}/" 'package.json'
- run: yarn publish --access public --tag next

- name: Pre-release
run: yarn run ci:prepublish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: |
dist

release:
runs-on: ubuntu-latest
Expand Down
53 changes: 53 additions & 0 deletions __mocks__/patient.mock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
export const mockPatient = {
resourceType: 'Patient',
id: '8673ee4f-e2ab-4077-ba55-4980f408773e',
extension: [
{
url: 'http://fhir-es.transcendinsights.com/stu3/StructureDefinition/resource-date-created',
valueDateTime: '2017-01-18T09:42:40+00:00',
},
{
url: 'https://purl.org/elab/fhir/StructureDefinition/Creator-crew-version1',
valueString: 'daemon',
},
],
identifier: [
{
id: '1f0ad7a1-430f-4397-b571-59ea654a52db',
use: 'secondary',
system: 'Old Identification Number',
value: '100732HE',
},
{
id: '1f0ad7a1-430f-4397-b571-59ea654a52db',
use: 'usual',
system: 'OpenMRS ID',
value: '100GEJ',
},
],
active: true,
name: [
{
id: 'efdb246f-4142-4c12-a27a-9be60b9592e9',
use: 'usual',
family: 'Wilson',
given: ['John'],
},
],
gender: 'male',
birthDate: '1972-04-04',
deceasedBoolean: false,
address: [],
};

export const mockPatientWithLongName = {
...mockPatient,
name: [
{
id: 'efdb246f-4142-4c12-a27a-9be60b9592e9',
use: 'usual',
family: 'family name',
given: ['Some very long given name'],
},
],
};
13 changes: 13 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"packages": [
"packages/*"
],
"npmClient": "yarn",
"useWorkspaces": true,
"version": "1.0.0",
"command": {
"publish": {
"verifyAccess": false
}
}
}
107 changes: 40 additions & 67 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,68 +1,32 @@
{
"name": "@ugandaemr/esm-ugandaemr-app",
"version": "1.0.0",
"license": "MPL-2.0",
"description": "A microfrontend for UgandaEMR built on top of OpenMRS 3.x and OHRI",
"browser": "dist/esm-ugandaemr-app.js",
"main": "src/index.ts",
"source": true,
"scripts": {
"start": "openmrs develop",
"serve": "webpack serve --mode=development",
"build": "webpack --mode production",
"analyze": "webpack --mode=production --env.analyze=true",
"lint": "eslint src --ext js,jsx,ts,tsx",
"prettier": "prettier --write \"src/**/*.{ts,tsx}\"",
"typescript": "tsc",
"test": "jest --config jest.config.js --passWithNoTests",
"verify": "concurrently 'yarn:lint' 'yarn:test' 'yarn:typescript'",
"coverage": "yarn test -- --coverage",
"prepare": "husky install"
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged && yarn verify"
}
},
"browserslist": [
"extends browserslist-config-openmrs"
],
"keywords": [
"openmrs",
"microfrontends",
"ugandaEMR",
"ugandaemr"
"name": "@ugandaemr/esm-ugandaemr-core",
"private": true,
"description": "Microfrontends for UgandaEMR built on top of OpenMRS 3.x and OHRI",
"workspaces": [
"packages/*"
],
"repository": {
"type": "git",
"url": "git+https://github.com/METS-Programme/esm-ugandaemr-core.git"
},
"homepage": "https://github.com/METS-Programme/esm-ugandaemr-core#readme",
"publishConfig": {
"access": "public"
},
"bugs": {
"url": "https://github.com/METS-Programme/esm-ugandaemr-core/issues"
"scripts": {
"start": "openmrs develop --sources 'packages/esm-*-app'",
"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}\"",
"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",
"coverage": "yarn test --coverage",
"prepare": "husky install",
"extract-translations": "lerna run extract-translations -- --config ../../tools/i18next-parser.config.js"
},
"dependencies": {
"@carbon/react": "^1.14.0",
"@ohri/openmrs-esm-ohri-commons-lib": "next",
"@ohri/openmrs-ohri-form-engine-lib": "^1.0.1-pre.145",
"@openmrs/esm-patient-common-lib": "^4.0.0",
"dayjs": "^1.11.6",
"install-peers": "^1.0.4",
"lodash-es": "^4.17.15",
"swr": "^1.3.0"
},
"peerDependencies": {
"@openmrs/esm-framework": "4.x",
"react": "18.x",
"react-i18next": "11.x",
"react-router-dom": "6.x",
"rxjs": "6.x"
},
"devDependencies": {
"@openmrs/esm-framework": "4.0.2-pre.336",
"@carbon/react": "^1.14.0",
"@ohri/openmrs-esm-ohri-commons-lib": "next",
"@openmrs/esm-framework": "^4.0.3-pre.401",
"@openmrs/esm-patient-common-lib": "^4.0.0",
"@openmrs/esm-styleguide": "next",
"@swc/cli": "^0.1.57",
"@swc/core": "^1.3.6",
Expand All @@ -71,32 +35,41 @@
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.4.3",
"@types/jest": "^28.0.0",
"@types/jest": "^28.1.4",
"@types/lodash-es": "^4.17.3",
"@types/react": "^18.0.21",
"@types/react-dom": "^18.0.6",
"@types/react-router": "^5.1.19",
"@types/react-router-dom": "^5.3.3",
"@types/testing-library__jest-dom": "^5.14.1",
"@types/webpack-env": "^1.16.0",
"@typescript-eslint/eslint-plugin": "^5.40.0",
"@typescript-eslint/parser": "^5.40.0",
"concurrently": "^7.4.0",
"cross-env": "^7.0.3",
"eslint": "^8.25.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-ts-react-important-stuff": "^3.0.0",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^6.0.0",
"husky": "^8.0.1",
"i18next": "^19.7.0",
"i18next-parser": "^5.4.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^28.0.0",
"jest-cli": "^28.0.0",
"jest-environment-jsdom": "^28.0.0",
"openmrs": "4.0.2-pre.336",
"install-peers": "^1.0.4",
"jest": "^28.1.2",
"jest-cli": "^28.1.2",
"jest-environment-jsdom": "^28.1.2",
"lerna": "^5.6.1",
"lodash": "^4.17.21",
"openmrs": "^4.0.3-pre.401",
"prettier": "^2.7.1",
"pretty-quick": "^3.1.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-i18next": "^11.18.6",
"react-router-dom": "^6.4.2",
"rxjs": "^6.5.4",
"react-router-dom": "^6.3.0",
"rxjs": "^6.6.3",
"sass": "^1.54.3",
"swc-loader": "^0.2.3",
"systemjs-webpack-interop": "^2.3.7",
"turbo": "^1.6.2",
"typescript": "^4.8.4",
"webpack": "^5.74.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/esm-family-health-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# esm-family-health-app

This microfrontend provides the baseline for a family health clinic based on paper workflows collected from various health centres in Uganda.
51 changes: 51 additions & 0 deletions packages/esm-family-health-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "@ugandaemr/esm-family-health-app",
"version": "1.0.0",
"license": "MPL-2.0",
"description": "Family health microfrontend for UgandaEMR",
"browser": "dist/esm-family-health-app.js",
"main": "src/index.ts",
"source": true,
"scripts": {
"start": "openmrs develop",
"serve": "webpack serve --mode=development",
"debug": "npm run serve",
"build": "webpack --mode production",
"analyze": "webpack --mode=production --env.analyze=true",
"lint": "eslint src --ext tsx,ts --fix --max-warnings=0",
"typescript": "tsc",
"extract-translations": "i18next 'src/**/*.component.tsx' --config ../../tools/i18next-parser.config.js"
},
"browserslist": [
"extends browserslist-config-openmrs"
],
"keywords": [
"openmrs",
"microfrontends",
"ugandaEMR",
"family health"
],
"repository": {
"type": "git",
"url": "git+https://github.com/METS-Programme/esm-ugandaemr-core.git"
},
"homepage": "https://github.com/METS-Programme/esm-ugandaemr-core#readme",
"publishConfig": {
"access": "public"
},
"bugs": {
"url": "https://github.com/METS-Programme/esm-ugandaemr-core/issues"
},
"dependencies": {
"@carbon/react": "^1.14.0",
"lodash-es": "^4.17.15"
},
"peerDependencies": {
"@openmrs/esm-framework": "4.x",
"react": "18.x",
"react-i18next": "11.x"
},
"devDependencies": {
"webpack": "^5.74.0"
}
}
Loading

0 comments on commit 8a1d600

Please sign in to comment.