@ubox-tools/deploy-xperience 1.1.1 → 1.1.2
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.
- package/deploy.js +18 -7
- package/package.json +1 -1
package/deploy.js
CHANGED
|
@@ -967,25 +967,37 @@ async function setMobileLink(page, appFullName, mobileVirtualLink) {
|
|
|
967
967
|
console.log(` [ubox] mobileLink = ${mobileVirtualLink}`);
|
|
968
968
|
}
|
|
969
969
|
|
|
970
|
+
async function isAppInstalled(page, appFullName) {
|
|
971
|
+
return page.evaluate(name => {
|
|
972
|
+
for (const card of document.querySelectorAll('.card-body.ubox-app-installed')) {
|
|
973
|
+
const title = card.querySelector('p.card-text');
|
|
974
|
+
if (title && title.textContent.trim() === name) return true;
|
|
975
|
+
}
|
|
976
|
+
return false;
|
|
977
|
+
}, appFullName);
|
|
978
|
+
}
|
|
979
|
+
|
|
970
980
|
async function deployUbox(page, appName, projectName, appParams, mobileVirtualLink, targetUboxId = null) {
|
|
971
981
|
const fullName = `${projectName} ${appName}`;
|
|
972
982
|
console.log(`\n[Phase 3] Ubox: ${fullName}`);
|
|
973
983
|
|
|
974
|
-
let uboxUrl
|
|
984
|
+
let uboxUrl;
|
|
975
985
|
if (targetUboxId) {
|
|
976
986
|
uboxUrl = `${BASE_URL}/#/ubox/${targetUboxId}`;
|
|
977
987
|
console.log(` [ubox] Using pre-existing Ubox ID ${targetUboxId} — navigating directly...`);
|
|
978
988
|
await page.goto(uboxUrl, { waitUntil: 'networkidle2' });
|
|
979
989
|
await sleep(2000);
|
|
980
|
-
created = false;
|
|
981
990
|
} else {
|
|
982
|
-
({ url: uboxUrl
|
|
991
|
+
({ url: uboxUrl } = await findOrCreateUbox(page, fullName));
|
|
983
992
|
}
|
|
984
993
|
|
|
985
994
|
let virtualLink = null;
|
|
986
995
|
|
|
987
|
-
|
|
988
|
-
|
|
996
|
+
const installed = await isAppInstalled(page, fullName);
|
|
997
|
+
|
|
998
|
+
if (!installed) {
|
|
999
|
+
// App not installed — make public, install, get virtual link, set params
|
|
1000
|
+
console.log(` [ubox] "${fullName}" not installed — proceeding with install...`);
|
|
989
1001
|
await checkMakePublic(page);
|
|
990
1002
|
await installApp(page, fullName);
|
|
991
1003
|
|
|
@@ -1003,8 +1015,7 @@ async function deployUbox(page, appName, projectName, appParams, mobileVirtualLi
|
|
|
1003
1015
|
await setMobileLink(page, fullName, mobileVirtualLink);
|
|
1004
1016
|
}
|
|
1005
1017
|
} else {
|
|
1006
|
-
|
|
1007
|
-
console.log(' [ubox] Already exists — skipping install, params, and virtual link');
|
|
1018
|
+
console.log(` [ubox] "${fullName}" already installed — skipping install`);
|
|
1008
1019
|
|
|
1009
1020
|
// Still retrieve the virtual link for mobile so main can use it
|
|
1010
1021
|
if (appName === 'mobile') {
|
package/package.json
CHANGED