@ubox-tools/deploy-xperience 1.1.16 → 1.1.19

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.
Files changed (2) hide show
  1. package/deploy.js +14 -3
  2. package/package.json +1 -1
package/deploy.js CHANGED
@@ -429,7 +429,7 @@ async function injectToEditor(page, content) {
429
429
  }
430
430
  return false;
431
431
  }, content);
432
- if (monacoOk) return;
432
+ if (monacoOk) { console.log(' [editor] Monaco'); return; }
433
433
 
434
434
  // Try CodeMirror API
435
435
  const cmOk = await page.evaluate(text => {
@@ -437,9 +437,10 @@ async function injectToEditor(page, content) {
437
437
  if (cm?.CodeMirror) { cm.CodeMirror.setValue(text); return true; }
438
438
  return false;
439
439
  }, content);
440
- if (cmOk) return;
440
+ if (cmOk) { console.log(' [editor] CodeMirror'); return; }
441
441
 
442
442
  // Fallback: clipboard paste into Ace / generic textarea
443
+ console.log(' [editor] clipboard');
443
444
  writeClipboard(content);
444
445
  const ed = await page.$('.ace_editor, .cm-editor, .monaco-editor, textarea');
445
446
  if (!ed) throw new Error('No code editor found on page');
@@ -661,11 +662,20 @@ async function configureParameters(page, params) {
661
662
 
662
663
  async function injectSource(page, proxy) {
663
664
  console.log(' [source] Injecting source files...');
665
+ console.log(` [source] URL: ${page.url()}`);
664
666
  await clickByText(page, 'Source');
665
667
  await sleep(1500);
666
668
 
667
669
  await clickByText(page, 'Edit source');
668
670
  await sleep(3000);
671
+ // Wait for the editor (Monaco or CodeMirror) to fully initialize.
672
+ // On first-ever source editor visit in a session, Monaco may still be loading
673
+ // after 3 s — this ensures injection happens only once it's ready.
674
+ await page.waitForFunction(() => {
675
+ return !!(window.monaco?.editor?.getModels) ||
676
+ !!(document.querySelector('.CodeMirror')?.CodeMirror);
677
+ }, { timeout: 15000 }).catch(() => null);
678
+ console.log(` [source] URL after Edit source: ${page.url()}`);
669
679
 
670
680
  // Tab label → filename
671
681
  const tabs = [
@@ -688,8 +698,9 @@ async function injectSource(page, proxy) {
688
698
 
689
699
  const navPromise = page.waitForNavigation({ waitUntil: 'networkidle2', timeout: 15000 }).catch(() => null);
690
700
  await clickByText(page, 'Save and back to app');
691
- await navPromise;
701
+ const navResult = await navPromise;
692
702
  await sleep(1000);
703
+ console.log(` [source] URL after save: ${page.url()} (navigated: ${navResult ? 'yes' : 'no'})`);
693
704
  }
694
705
 
695
706
  async function deployApp(page, appName, projectName, { noAssets = false, noSource = false } = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ubox-tools/deploy-xperience",
3
- "version": "1.1.16",
3
+ "version": "1.1.19",
4
4
  "description": "Deploy a Ubox experience to studio.ubox.world",
5
5
  "bin": { "deploy-xperience": "./deploy.js" },
6
6
  "dependencies": { "puppeteer": "*" },