test
CI / Build & Test (push) Successful in 3m54s

This commit is contained in:
Raven Scott
2026-03-01 03:36:03 -05:00
parent 6181cde033
commit 04317507eb
3 changed files with 49 additions and 9 deletions
+27 -9
View File
@@ -20,9 +20,25 @@ const EventEmitter = require('bare-events');
const { allocateTunnelPort, releaseTunnelPort } = require('./holesail-manager/port-allocator.js'); const { allocateTunnelPort, releaseTunnelPort } = require('./holesail-manager/port-allocator.js');
// Resolve the extension/dashboard directory for dev-mode file serving. // Resolve the extension/dashboard directory for dev-mode file serving.
// In dev mode, __dirname is native-host/ so the dashboard is one level up. // Uses the same logic as host/paths.js: in dev mode __dirname is the real
// In distribution mode this path is never used (files come from the bundle). // native-host/ directory; in distribution mode the bundle read takes priority
const DEV_DASHBOARD_DIR = path.join(__dirname, '..', 'extension', 'dashboard'); // and this path is only used as a last-resort fallback.
function _resolveDevDashboardDir() {
// In dev mode __dirname is the real native-host/ path
if (__dirname && !__dirname.startsWith('bare:')) {
return path.join(__dirname, '..', 'extension', 'dashboard');
}
// Distribution mode: try executable directory as fallback
try {
const os = require('bare-os');
const execPath = os.execPath();
if (execPath && !execPath.startsWith('bare:')) {
return path.join(path.dirname(execPath), 'extension', 'dashboard');
}
} catch (_) {}
return null;
}
const DEV_DASHBOARD_DIR = _resolveDevDashboardDir();
const DASHBOARD_HOSTNAME = 'my.dash.board'; const DASHBOARD_HOSTNAME = 'my.dash.board';
@@ -67,12 +83,14 @@ function _readFileByKey(bundleKey, diskRelPath) {
} }
} catch (_) {} } catch (_) {}
// Development mode: read from disk // Disk fallback (dev mode, or distribution mode without bundle assets)
try { if (DEV_DASHBOARD_DIR) {
const fs = require('bare-fs'); try {
const fullPath = path.join(DEV_DASHBOARD_DIR, diskRelPath); const fs = require('bare-fs');
return fs.readFileSync(fullPath); const fullPath = path.join(DEV_DASHBOARD_DIR, diskRelPath);
} catch (_) {} return fs.readFileSync(fullPath);
} catch (_) {}
}
return null; return null;
} }
+11
View File
@@ -0,0 +1,11 @@
import 'bare-process/global';
import { createRequire } from 'bare-module';
const require = createRequire(import.meta.url);
// Simulate: startup.js (in host/) requires dashboard-server.js (in native-host/)
const startup_require = createRequire(new URL('./host/startup.js', import.meta.url));
const dashServer = startup_require('../dashboard-server.js');
console.log('dashServer.getHostname():', dashServer.getHostname());
const result = await dashServer.start();
console.log('start result:', result);
await dashServer.stop();
+11
View File
@@ -0,0 +1,11 @@
const path = require('bare-path');
console.log('__dirname:', __dirname);
const DEV_DASHBOARD_DIR = path.join(__dirname, '..', 'extension', 'dashboard');
console.log('DEV_DASHBOARD_DIR:', DEV_DASHBOARD_DIR);
const fs = require('bare-fs');
try {
const f = fs.readFileSync(path.join(DEV_DASHBOARD_DIR, 'dashboard.html'));
console.log('READ OK, size:', f.length);
} catch(e) {
console.log('READ FAILED:', e.message);
}