From c684d00bdf11038a8e7ea1a8d1ca87e2a947c5f5 Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs Date: Fri, 3 Nov 2023 17:11:09 +0530 Subject: [PATCH 1/2] integrate microapp code in monorepo --- apps/OpenSign/package.json | 4 ++-- apps/OpenSign/src/components/ReportMicroapp.js | 8 +++++--- apps/OpenSign/src/routes/RemoteApp.js | 4 +++- microfrontends/SignDocuments/package.json | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/apps/OpenSign/package.json b/apps/OpenSign/package.json index db8651125..b66a18ca9 100644 --- a/apps/OpenSign/package.json +++ b/apps/OpenSign/package.json @@ -41,7 +41,7 @@ }, "scripts": { "start": "mf-cra start", - "build": "npm run micro && CI=false && mf-cra build", + "build": "rm -rf public/mfbuild/* && npm run micro && CI=false && mf-cra build", "micro": "cd ../../microfrontends/SignDocuments && npm install && npm run build", "test": "react-scripts test", "eject": "react-scripts eject", @@ -84,4 +84,4 @@ "pretty-quick": "^3.1.3", "tailwindcss": "^3.3.3" } -} +} \ No newline at end of file diff --git a/apps/OpenSign/src/components/ReportMicroapp.js b/apps/OpenSign/src/components/ReportMicroapp.js index b0be8c1d8..37864ca99 100644 --- a/apps/OpenSign/src/components/ReportMicroapp.js +++ b/apps/OpenSign/src/components/ReportMicroapp.js @@ -15,7 +15,9 @@ const MicroappModal = () => { // console.log("value ", key + ":" + value); if (key === "remoteUrl") { - obj = { ...obj, [key]: atob(value) }; + const url = window.location.origin + "/mfbuild/remoteEntry.js"; + // console.log("atob(value) ", atob(value)) + obj = { ...obj, [key]: url }; } else { if (key === "moduleToLoad") { obj = { ...obj, [key]: "./" + value }; @@ -45,9 +47,9 @@ const MicroappModal = () => { > Back - {localStorage.getItem('domain') && ( + {localStorage.getItem("domain") && (

- {localStorage.getItem('domain') === "contracts" ? "Document":""} + {localStorage.getItem("domain") === "contracts" ? "Document" : ""}

)} diff --git a/apps/OpenSign/src/routes/RemoteApp.js b/apps/OpenSign/src/routes/RemoteApp.js index 16d1afc71..08c2943c0 100644 --- a/apps/OpenSign/src/routes/RemoteApp.js +++ b/apps/OpenSign/src/routes/RemoteApp.js @@ -65,7 +65,9 @@ export default function RemoteAppContainer() { // console.log("value ", key + ":" + value); if (key === "remoteUrl") { - obj = { ...obj, [key]: atob(value) }; + const url = window.location.origin + "/mfbuild/remoteEntry.js"; + // console.log("atob(value) ", atob(value)) + obj = { ...obj, [key]: url }; } else { if (key === "moduleToLoad") { obj = { ...obj, [key]: "./" + value }; diff --git a/microfrontends/SignDocuments/package.json b/microfrontends/SignDocuments/package.json index a420d32b2..348d629eb 100644 --- a/microfrontends/SignDocuments/package.json +++ b/microfrontends/SignDocuments/package.json @@ -35,7 +35,7 @@ }, "scripts": { "start": "mf-cra start", - "build": "CI=false && mf-cra build && mv build ../../apps/OpenSign/public/mfbuild", + "build": "CI=false && mf-cra build && mv build/* ../../apps/OpenSign/public/mfbuild", "test": "react-scripts test", "eject": "react-scripts eject" }, From b034cfd50180e8b6220e449512f7b163cefeac6a Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs Date: Fri, 3 Nov 2023 17:26:20 +0530 Subject: [PATCH 2/2] add mfbuild folder to store microapp build --- apps/OpenSign/public/mfbuild/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 apps/OpenSign/public/mfbuild/.gitkeep diff --git a/apps/OpenSign/public/mfbuild/.gitkeep b/apps/OpenSign/public/mfbuild/.gitkeep new file mode 100644 index 000000000..e69de29bb