@ubox-tools/deploy-xperience 1.1.4 → 1.1.5
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/README.md +2 -0
- package/deploy.js +15 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,6 +31,7 @@ npx @ubox-tools/deploy-xperience [app1 app2 ...] [options]
|
|
|
31
31
|
| `--noplayer` | Skip Phase 3 — deploy apps only, do not create/update Uboxes |
|
|
32
32
|
| `--ubox-id <id>` | Use a pre-existing Ubox by ID — skips search/create (single-app deployments) |
|
|
33
33
|
| `--ubox-id <app>:<id>` | Scoped form for multi-app deployments (repeatable) |
|
|
34
|
+
| `--xpace <name>` | Xpace (place) to assign the Ubox to — case-insensitive match; defaults to the first available xpace if omitted or not found |
|
|
34
35
|
| `--show` | Show the browser window (default: headless) |
|
|
35
36
|
| `--help` | Print usage and exit |
|
|
36
37
|
|
|
@@ -55,6 +56,7 @@ npx @ubox-tools/deploy-xperience --noplayer # Deploy apps only, skip
|
|
|
55
56
|
npx @ubox-tools/deploy-xperience --project-name "MyProject"
|
|
56
57
|
npx @ubox-tools/deploy-xperience mobile --ubox-id 42 # Use existing Ubox #42 for mobile
|
|
57
58
|
npx @ubox-tools/deploy-xperience --ubox-id mobile:42 --ubox-id main:99
|
|
59
|
+
npx @ubox-tools/deploy-xperience --xpace workshop # Assign Ubox to "Workshop" xpace
|
|
58
60
|
```
|
|
59
61
|
|
|
60
62
|
## Deployment Phases
|
package/deploy.js
CHANGED
|
@@ -57,6 +57,7 @@ Options:
|
|
|
57
57
|
--noplayer Skip Ubox creation (Phase 3) — only deploy applications
|
|
58
58
|
--ubox-id <id> Use a pre-existing Ubox by ID (skips search/create)
|
|
59
59
|
--ubox-id <app>:<id> Scoped form when deploying multiple apps
|
|
60
|
+
--xpace <name> Xpace (place) to assign the Ubox to (case-insensitive match); defaults to the first available xpace
|
|
60
61
|
--show Show the browser window (default: headless)
|
|
61
62
|
--help Show this help
|
|
62
63
|
|
|
@@ -80,6 +81,7 @@ Examples:
|
|
|
80
81
|
let noSource = false;
|
|
81
82
|
let noPlayer = false;
|
|
82
83
|
let show = false;
|
|
84
|
+
let xpaceName = null;
|
|
83
85
|
const appArgs = [];
|
|
84
86
|
const uboxIds = {};
|
|
85
87
|
let bareUboxId = null;
|
|
@@ -95,6 +97,7 @@ Examples:
|
|
|
95
97
|
else { noSource = true; }
|
|
96
98
|
}
|
|
97
99
|
else if (args[i] === '--noplayer') { noPlayer = true; }
|
|
100
|
+
else if (args[i] === '--xpace') { xpaceName = args[++i]; }
|
|
98
101
|
else if (args[i] === '--show') { show = true; }
|
|
99
102
|
else if (args[i] === '--ubox-id') {
|
|
100
103
|
const val = args[++i];
|
|
@@ -133,7 +136,7 @@ Examples:
|
|
|
133
136
|
uboxIds[ordered[0]] = bareUboxId;
|
|
134
137
|
}
|
|
135
138
|
|
|
136
|
-
return { apps: ordered, email, password, projectName, noAssets, noSource, noPlayer, show, uboxIds };
|
|
139
|
+
return { apps: ordered, email, password, projectName, noAssets, noSource, noPlayer, show, xpaceName, uboxIds };
|
|
137
140
|
}
|
|
138
141
|
|
|
139
142
|
// ─── Credentials ──────────────────────────────────────────────────────────────
|
|
@@ -716,7 +719,7 @@ async function handleTCModal(page) {
|
|
|
716
719
|
await sleep(1500);
|
|
717
720
|
}
|
|
718
721
|
|
|
719
|
-
async function findOrCreateUbox(page, fullName) {
|
|
722
|
+
async function findOrCreateUbox(page, fullName, xpaceName = null) {
|
|
720
723
|
console.log(` [ubox] Searching for "${fullName}"...`);
|
|
721
724
|
await page.goto(`${BASE_URL}/#/uboxes`, { waitUntil: 'networkidle2' });
|
|
722
725
|
await sleep(1500);
|
|
@@ -761,15 +764,17 @@ async function findOrCreateUbox(page, fullName) {
|
|
|
761
764
|
await page.keyboard.type(fullName, { delay: 30 });
|
|
762
765
|
await sleep(300);
|
|
763
766
|
|
|
764
|
-
// Place select: find 1st visible select, choose
|
|
765
|
-
await page.evaluate(() => {
|
|
767
|
+
// Place select: find 1st visible select, choose by --xpace name (or first non-null option)
|
|
768
|
+
await page.evaluate((xpaceName) => {
|
|
766
769
|
const sels = Array.from(document.querySelectorAll('select'))
|
|
767
770
|
.filter(e => { const r = e.getBoundingClientRect(); return r.width > 0 && r.height > 0; });
|
|
768
771
|
if (sels[0]) {
|
|
769
|
-
const
|
|
772
|
+
const opts = Array.from(sels[0].options);
|
|
773
|
+
const opt = (xpaceName && opts.find(o => new RegExp(xpaceName, 'i').test(o.text)))
|
|
774
|
+
|| opts.find(o => o.value !== 'null');
|
|
770
775
|
if (opt) { sels[0].value = opt.value; sels[0].dispatchEvent(new Event('change', { bubbles: true })); }
|
|
771
776
|
}
|
|
772
|
-
});
|
|
777
|
+
}, xpaceName);
|
|
773
778
|
await sleep(300);
|
|
774
779
|
|
|
775
780
|
// Config select: find 2nd visible select, choose "MyUboxConf"
|
|
@@ -992,7 +997,7 @@ async function isAppInstalled(page, appFullName) {
|
|
|
992
997
|
}, appFullName);
|
|
993
998
|
}
|
|
994
999
|
|
|
995
|
-
async function deployUbox(page, appName, projectName, appParams, mobileVirtualLink, targetUboxId = null) {
|
|
1000
|
+
async function deployUbox(page, appName, projectName, appParams, mobileVirtualLink, targetUboxId = null, xpaceName = null) {
|
|
996
1001
|
const fullName = `${projectName} ${appName}`;
|
|
997
1002
|
console.log(`\n[Phase 3] Ubox: ${fullName}`);
|
|
998
1003
|
|
|
@@ -1003,7 +1008,7 @@ async function deployUbox(page, appName, projectName, appParams, mobileVirtualLi
|
|
|
1003
1008
|
await page.goto(uboxUrl, { waitUntil: 'networkidle2' });
|
|
1004
1009
|
await sleep(2000);
|
|
1005
1010
|
} else {
|
|
1006
|
-
({ url: uboxUrl } = await findOrCreateUbox(page, fullName));
|
|
1011
|
+
({ url: uboxUrl } = await findOrCreateUbox(page, fullName, xpaceName));
|
|
1007
1012
|
}
|
|
1008
1013
|
|
|
1009
1014
|
let virtualLink = null;
|
|
@@ -1054,7 +1059,7 @@ async function deployUbox(page, appName, projectName, appParams, mobileVirtualLi
|
|
|
1054
1059
|
// ─── Main ─────────────────────────────────────────────────────────────────────
|
|
1055
1060
|
|
|
1056
1061
|
async function main() {
|
|
1057
|
-
const { apps, email: emailArg, password: passwordArg, projectName: projectNameArg, noAssets, noSource, noPlayer, show, uboxIds } = parseArgs();
|
|
1062
|
+
const { apps, email: emailArg, password: passwordArg, projectName: projectNameArg, noAssets, noSource, noPlayer, show, xpaceName, uboxIds } = parseArgs();
|
|
1058
1063
|
|
|
1059
1064
|
if (apps.length === 0) {
|
|
1060
1065
|
console.error('No apps found in apps/ directory. Nothing to deploy.');
|
|
@@ -1106,7 +1111,7 @@ async function main() {
|
|
|
1106
1111
|
for (const appName of apps) {
|
|
1107
1112
|
const { uboxId, virtualLink } = await deployUbox(
|
|
1108
1113
|
page, appName, projectName, appParamsMap[appName], mobileVirtualLink,
|
|
1109
|
-
uboxIds[appName] ?? null
|
|
1114
|
+
uboxIds[appName] ?? null, xpaceName
|
|
1110
1115
|
);
|
|
1111
1116
|
state[appName].uboxId = uboxId;
|
|
1112
1117
|
if (appName === 'mobile' && virtualLink) {
|
package/package.json
CHANGED