bonzai-tools 1.0.104 → 1.0.106
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/dist/bconfig.js +4 -4
- package/dist/graph-templates/receiver.js +27 -27
- package/dist/index.js +4 -4
- package/package.json +1 -1
package/dist/bconfig.js
CHANGED
|
@@ -163,9 +163,9 @@ async function main() {
|
|
|
163
163
|
|
|
164
164
|
console.log('\nListener endpoints successfully deployed');
|
|
165
165
|
console.log('All code stays on your machine\n');
|
|
166
|
-
console.log('Relay server running on localhost:
|
|
167
|
-
console.log('Terminal WebSocket available at ws://localhost:
|
|
168
|
-
console.log('App available at http://localhost:
|
|
166
|
+
console.log('Relay server running on localhost:6767');
|
|
167
|
+
console.log('Terminal WebSocket available at ws://localhost:6767/terminal');
|
|
168
|
+
console.log('App available at http://localhost:6767\n');
|
|
169
169
|
|
|
170
170
|
// Start the server automatically
|
|
171
171
|
const server = spawn('node', ['receiver.js'], {
|
|
@@ -178,7 +178,7 @@ async function main() {
|
|
|
178
178
|
});
|
|
179
179
|
|
|
180
180
|
// Open browser automatically
|
|
181
|
-
exec('open http://localhost:
|
|
181
|
+
exec('open http://localhost:6767/visualize?ref=btools');
|
|
182
182
|
|
|
183
183
|
// Handle server process
|
|
184
184
|
server.on('close', (serverCode) => {
|
|
@@ -7,39 +7,13 @@ const fs = require('fs');
|
|
|
7
7
|
const path = require('path');
|
|
8
8
|
const { ROOT } = require('./config');
|
|
9
9
|
|
|
10
|
-
const port =
|
|
10
|
+
const port = 6767;
|
|
11
11
|
const app = express();
|
|
12
12
|
const server = http.createServer(app);
|
|
13
13
|
|
|
14
14
|
app.use(cors());
|
|
15
15
|
app.use(express.json());
|
|
16
16
|
|
|
17
|
-
// Embed shell - loads app from CDN
|
|
18
|
-
app.get('/', (req, res) => {
|
|
19
|
-
const repoName = path.basename(ROOT);
|
|
20
|
-
res.send(`<!DOCTYPE html>
|
|
21
|
-
<html>
|
|
22
|
-
<head>
|
|
23
|
-
<meta charset="UTF-8">
|
|
24
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
25
|
-
<title>Bonzai - ${repoName}</title>
|
|
26
|
-
<link rel="stylesheet" href="https://bonzai.dev/app.css">
|
|
27
|
-
<style>
|
|
28
|
-
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
29
|
-
html, body, #root { height: 100%; }
|
|
30
|
-
</style>
|
|
31
|
-
</head>
|
|
32
|
-
<body>
|
|
33
|
-
<div id="root"></div>
|
|
34
|
-
<script>
|
|
35
|
-
window.BONZAI_REPO = "${repoName}";
|
|
36
|
-
window.BONZAI_API = "http://localhost:${port}";
|
|
37
|
-
</script>
|
|
38
|
-
<script src="https://bonzai.dev/app.js"></script>
|
|
39
|
-
</body>
|
|
40
|
-
</html>`);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
17
|
// Health check
|
|
44
18
|
app.get('/health', (req, res) => {
|
|
45
19
|
const repoName = path.basename(ROOT);
|
|
@@ -80,6 +54,32 @@ if (terminalHandlers) {
|
|
|
80
54
|
app.get('/terminal', terminalHandlers.terminalHandler);
|
|
81
55
|
}
|
|
82
56
|
|
|
57
|
+
// Catch-all for SPA routing - serve HTML shell for any non-API route
|
|
58
|
+
app.get('*', (req, res) => {
|
|
59
|
+
const repoName = path.basename(ROOT);
|
|
60
|
+
res.send(`<!DOCTYPE html>
|
|
61
|
+
<html>
|
|
62
|
+
<head>
|
|
63
|
+
<meta charset="UTF-8">
|
|
64
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
65
|
+
<title>Bonzai - ${repoName}</title>
|
|
66
|
+
<link rel="stylesheet" href="https://bonzai.dev/app.css">
|
|
67
|
+
<style>
|
|
68
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
69
|
+
html, body, #root { height: 100%; }
|
|
70
|
+
</style>
|
|
71
|
+
</head>
|
|
72
|
+
<body>
|
|
73
|
+
<div id="root"></div>
|
|
74
|
+
<script>
|
|
75
|
+
window.BONZAI_REPO = "${repoName}";
|
|
76
|
+
window.BONZAI_API = "http://localhost:${port}";
|
|
77
|
+
</script>
|
|
78
|
+
<script src="https://bonzai.dev/app.js"></script>
|
|
79
|
+
</body>
|
|
80
|
+
</html>`);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
83
|
server.listen(port, () => {
|
|
84
84
|
console.log('File server running on http://localhost:' + port);
|
|
85
85
|
});
|
package/dist/index.js
CHANGED
|
@@ -150,9 +150,9 @@ async function main() {
|
|
|
150
150
|
}
|
|
151
151
|
console.log("\nListener endpoints successfully deployed");
|
|
152
152
|
console.log("All code stays on your machine\n");
|
|
153
|
-
console.log("Relay server running on localhost:
|
|
154
|
-
console.log("Terminal WebSocket available at ws://localhost:
|
|
155
|
-
console.log("App available at http://localhost:
|
|
153
|
+
console.log("Relay server running on localhost:6767");
|
|
154
|
+
console.log("Terminal WebSocket available at ws://localhost:6767/terminal");
|
|
155
|
+
console.log("App available at http://localhost:6767\n");
|
|
156
156
|
const server = spawn("node", ["receiver.js"], {
|
|
157
157
|
stdio: "inherit",
|
|
158
158
|
cwd: bonzaiDir,
|
|
@@ -161,7 +161,7 @@ async function main() {
|
|
|
161
161
|
BONZAI_REPO_DIR: currentDir
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
|
-
exec("open http://localhost:
|
|
164
|
+
exec("open http://localhost:6767/visualize?ref=btools");
|
|
165
165
|
server.on("close", (serverCode) => {
|
|
166
166
|
console.log(`
|
|
167
167
|
Server stopped with code ${serverCode}`);
|