From eee944434128e1ac5451807072426926ce0bd2d7 Mon Sep 17 00:00:00 2001 From: lucyjemutai <130601439+lucyjemutai@users.noreply.github.com> Date: Wed, 17 Jul 2024 21:21:41 +0300 Subject: [PATCH] move the component to pmtc so that we dont have to create a new esm --- package.json | 1 - .../src/constants.ts | 0 packages/esm-ohri-pmtct-app/src/index.ts | 14 +++-- ...tracker-report-app-menu-link.component.tsx | 4 +- packages/esm-ohri-pmtct-app/src/routes.json | 7 +++ .../esm-ohri-pmtct-app/translations/en.json | 3 +- packages/esm-ptracker-report-app/package.json | 55 ------------------- packages/esm-ptracker-report-app/src/index.ts | 14 ----- packages/esm-ptracker-report-app/src/root.tsx | 12 ---- .../esm-ptracker-report-app/src/routes.json | 23 -------- .../translations/en.json | 5 -- .../esm-ptracker-report-app/tsconfig.json | 5 -- .../esm-ptracker-report-app/webpack.config.js | 15 ----- 13 files changed, 21 insertions(+), 137 deletions(-) rename packages/{esm-ptracker-report-app => esm-ohri-pmtct-app}/src/constants.ts (100%) rename packages/{esm-ptracker-report-app/src => esm-ohri-pmtct-app/src/ptracker-reports}/ptracker-report-app-menu-link.component.tsx (75%) delete mode 100644 packages/esm-ptracker-report-app/package.json delete mode 100644 packages/esm-ptracker-report-app/src/index.ts delete mode 100644 packages/esm-ptracker-report-app/src/root.tsx delete mode 100644 packages/esm-ptracker-report-app/src/routes.json delete mode 100644 packages/esm-ptracker-report-app/translations/en.json delete mode 100644 packages/esm-ptracker-report-app/tsconfig.json delete mode 100644 packages/esm-ptracker-report-app/webpack.config.js diff --git a/package.json b/package.json index 49bd2f546..0b79913ed 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,6 @@ "start:form-render": "openmrs develop --backend https://openmrs-dev.globalhealthapp.net --sources packages/esm-form-render-app", "start:tb": "openmrs develop --backend https://openmrs-dev.globalhealthapp.net --sources packages/esm-tb-app", "start:opd": "openmrs develop --backend https://openmrs-dev.globalhealthapp.net --sources packages/esm-opd-app", - "start:ptracker": "openmrs develop --backend https://ohri-namibia-demo.globalhealthapp.net --sources packages/esm-ptracker-report-app", "prettier": "prettier --fix --config prettier.config.js --write \"packages/**/*.{ts,tsx}\"", "prepare": "husky install", "test": "jest --config jest.config.js --verbose false --passWithNoTests", diff --git a/packages/esm-ptracker-report-app/src/constants.ts b/packages/esm-ohri-pmtct-app/src/constants.ts similarity index 100% rename from packages/esm-ptracker-report-app/src/constants.ts rename to packages/esm-ohri-pmtct-app/src/constants.ts diff --git a/packages/esm-ohri-pmtct-app/src/index.ts b/packages/esm-ohri-pmtct-app/src/index.ts index 16710798b..c00bd64e0 100644 --- a/packages/esm-ohri-pmtct-app/src/index.ts +++ b/packages/esm-ohri-pmtct-app/src/index.ts @@ -18,6 +18,7 @@ import { import { configSchema } from './config-schema'; import rootComponent from './root.component'; import { createDashboardLink } from '@openmrs/esm-patient-common-lib'; +import ptrackerdashboardPath from './ptracker-reports/ptracker-report-app-menu-link.component'; export const importTranslation = require.context('../translations', false, /.json$/, 'lazy'); @@ -64,10 +65,13 @@ export const mchSummaryDashboardLink = getSyncLifecycle( options, ); -export const mchSummaryDashboard = getAsyncLifecycle(() => import('./pmtct/patient-chart/mch-summary/mch-summary.component'), { - featureName: 'mch-summary', - moduleName, -}); +export const mchSummaryDashboard = getAsyncLifecycle( + () => import('./pmtct/patient-chart/mch-summary/mch-summary.component'), + { + featureName: 'mch-summary', + moduleName, + }, +); export const maternalVisitsDashboardLink = getSyncLifecycle( createConditionalDashboardLink({ ...maternalVisitsDashboardMeta, moduleName }), @@ -92,3 +96,5 @@ export const maternalChildDashboard = getSyncLifecycle(OHRIHome, { featureName: 'mother child health results dashboard', moduleName, }); + +export const ptrackerReportNavLink = getSyncLifecycle(ptrackerdashboardPath, options); diff --git a/packages/esm-ptracker-report-app/src/ptracker-report-app-menu-link.component.tsx b/packages/esm-ohri-pmtct-app/src/ptracker-reports/ptracker-report-app-menu-link.component.tsx similarity index 75% rename from packages/esm-ptracker-report-app/src/ptracker-report-app-menu-link.component.tsx rename to packages/esm-ohri-pmtct-app/src/ptracker-reports/ptracker-report-app-menu-link.component.tsx index 56af5ef7c..ef8aa6b94 100644 --- a/packages/esm-ptracker-report-app/src/ptracker-report-app-menu-link.component.tsx +++ b/packages/esm-ohri-pmtct-app/src/ptracker-reports/ptracker-report-app-menu-link.component.tsx @@ -1,12 +1,12 @@ import { ConfigurableLink } from '@openmrs/esm-framework'; import React from 'react'; import { useTranslation } from 'react-i18next'; -import { ptrackerdashboardPath } from './constants'; +import { ptrackerdashboardPath } from '../constants'; const PtrackerDashboardNavigation = () => { const { t } = useTranslation(); - return {t('ptrackerReports', 'Ptracker Reports')}; + return {t('ptrackerReports', 'PTracker Reports')}; }; export default PtrackerDashboardNavigation; diff --git a/packages/esm-ohri-pmtct-app/src/routes.json b/packages/esm-ohri-pmtct-app/src/routes.json index a5021cac3..9d14b18e1 100644 --- a/packages/esm-ohri-pmtct-app/src/routes.json +++ b/packages/esm-ohri-pmtct-app/src/routes.json @@ -77,6 +77,13 @@ "name": "child-visits-summary-ext", "slot": "child-visits-summary-slot", "component": "childVisitsDashboard" + }, + { + "name": "version-two-link", + "slot": "app-menu-slot", + "component": "ptrackerReportNavLink", + "online": true, + "offline": true } ] } diff --git a/packages/esm-ohri-pmtct-app/translations/en.json b/packages/esm-ohri-pmtct-app/translations/en.json index 2307d6cf0..57c88fba3 100644 --- a/packages/esm-ohri-pmtct-app/translations/en.json +++ b/packages/esm-ohri-pmtct-app/translations/en.json @@ -20,5 +20,6 @@ "pTrackerId": "PTracker ID", "recentPregnancy": "Recent Pregnancy", "relationship": "Relationship", - "totalDeliveries": "# Total deliveries" + "totalDeliveries": "# Total deliveries", + "ptrackerReports": "PTracker Reports" } diff --git a/packages/esm-ptracker-report-app/package.json b/packages/esm-ptracker-report-app/package.json deleted file mode 100644 index 80ac79f2c..000000000 --- a/packages/esm-ptracker-report-app/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "@ohri/openmrs-esm-ohri-ptracker-report-app", - "version": "2.3.6", - "description": "Reporting for Namibia MNCH OpenMRS HIV Reference Implementation (OHRI)", - "browser": "dist/openmrs-esm-ohri-form-render-app.js", - "main": "src/index.ts", - "license": "MIT", - "homepage": "https://github.com/UCSF-IGHS/openmrs-esm-ohri#readme", - "keywords": [ - "mnch", - "ptracker", - "ohri" - ], - "bugs": { - "url": "https://github.com/UCSF-IGHS/openmrs-esm-ohri/issues" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/UCSF-IGHS/openmrs-esm-ohri.git" - }, - "scripts": { - "start": "openmrs develop --backend https://openmrs-staging.globalhealthapp.net", - "serve": "webpack serve --mode development", - "debug": "npm run serve", - "build": "webpack --mode production", - "analyze": "webpack --mode=production --env.analyze=true", - "docker": "docker run -p 8080:8080 -p 8081:8081 histacohri/docker-openmrs-esm-ohri:1.0 npx openmrs develop --backend https://openmrs-staging.globalhealthapp.net", - "docker:dev": "docker compose up", - "lint": "eslint src --ext tsx", - "typescript": "tsc", - "prepublishOnly": "npm run build", - "extract-translations": "i18next 'src/**/*.component.tsx'" - }, - "browserslist": [ - "extends browserslist-config-openmrs" - ], - "publishConfig": { - "access": "public" - }, - "dependencies": { - "@carbon/react": "^1.13.0", - "@openmrs/openmrs-form-engine-lib": "2.0.0-pre.1260", - "ace-builds": "1.34.1", - "react-ace": "^9.4.4" - }, - "peerDependencies": { - "@openmrs/esm-framework": "5.x", - "dayjs": "1.x", - "react": "18.x", - "react-i18next": "11.x" - }, - "devDependencies": { - "webpack": "^5.88.2" - } -} diff --git a/packages/esm-ptracker-report-app/src/index.ts b/packages/esm-ptracker-report-app/src/index.ts deleted file mode 100644 index ab4fee34e..000000000 --- a/packages/esm-ptracker-report-app/src/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { getSyncLifecycle } from '@openmrs/esm-framework'; -import ptrackerdashboardPath from './ptracker-report-app-menu-link.component'; -export const importTranslation = require.context('../translations', false, /.json$/, 'lazy'); - -const moduleName = '@ohri/openmrs-esm-ohri-ptracker-report-app'; - -const options = { - featureName: 'ohri-ptracker-report', - moduleName, -}; - -export function startupApp() {} - -export const versionTwoNavLink = getSyncLifecycle(ptrackerdashboardPath, options); diff --git a/packages/esm-ptracker-report-app/src/root.tsx b/packages/esm-ptracker-report-app/src/root.tsx deleted file mode 100644 index bd6ec3d00..000000000 --- a/packages/esm-ptracker-report-app/src/root.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react'; -import { BrowserRouter, Route, Routes } from 'react-router-dom'; - -export default function Root() { - return ( - - - - - - ); -} diff --git a/packages/esm-ptracker-report-app/src/routes.json b/packages/esm-ptracker-report-app/src/routes.json deleted file mode 100644 index 74e25dfa4..000000000 --- a/packages/esm-ptracker-report-app/src/routes.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "$schema": "https://json.openmrs.org/routes.schema.json", - "backendDependencies": { - "fhir2": "^1.2.0", - "webservices.rest": "^2.24.0" - }, - "pages": [ - { - "component": "PtrackerReport", - "route": "ptracker-report" - } - ], - "extensions": [ - { - "name": "version-two-link", - "slot": "app-menu-slot", - "component": "versionTwoNavLink", - "online": true, - "offline": true - } - ] - } - \ No newline at end of file diff --git a/packages/esm-ptracker-report-app/translations/en.json b/packages/esm-ptracker-report-app/translations/en.json deleted file mode 100644 index 85056f8c3..000000000 --- a/packages/esm-ptracker-report-app/translations/en.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - - "ptrackerReports": "Ptracker Reports" - } - \ No newline at end of file diff --git a/packages/esm-ptracker-report-app/tsconfig.json b/packages/esm-ptracker-report-app/tsconfig.json deleted file mode 100644 index fb900231b..000000000 --- a/packages/esm-ptracker-report-app/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "include": ["src/**/*"], - "exclude": ["src/**/*.test.tsx", "src/**/*.outdated.tsx"] - } \ No newline at end of file diff --git a/packages/esm-ptracker-report-app/webpack.config.js b/packages/esm-ptracker-report-app/webpack.config.js deleted file mode 100644 index 38b064d1a..000000000 --- a/packages/esm-ptracker-report-app/webpack.config.js +++ /dev/null @@ -1,15 +0,0 @@ -const path = require('path'); -const config = (module.exports = require('openmrs/default-webpack-config')); -config.scriptRuleConfig.exclude = - path.sep == '/' - ? /(node_modules[^\/@openmrs\/esm\-patient\-common\-lib])/ - : /(node_modules[^\\@openmrs\/esm\-patient\-common\-lib])/; -config.overrides.resolve = { - extensions: ['.tsx', '.ts', '.jsx', '.js', '.scss'], - alias: { - '@openmrs/esm-framework': '@openmrs/esm-framework/src/internal', - '@ohri/openmrs-esm-ohri-commons-lib': path.resolve(__dirname, '../esm-commons-lib/src/index'), - '@openmrs/openmrs-form-engine-lib': '@openmrs/openmrs-form-engine-lib/src/index', - }, -}; -module.exports = config;