repoburg 1.2.2 → 1.2.4
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/package.json
CHANGED
package/platform-cli.js
CHANGED
|
@@ -186,7 +186,7 @@ program
|
|
|
186
186
|
.requiredOption('-u, --url <url>', 'The URL of the target application (e.g., http://localhost:5173)')
|
|
187
187
|
.action(async (options) => {
|
|
188
188
|
const { default: chalk } = await import('chalk');
|
|
189
|
-
|
|
189
|
+
|
|
190
190
|
// 1. Get active backend port from daemon
|
|
191
191
|
let backendPort;
|
|
192
192
|
try {
|
|
@@ -207,7 +207,7 @@ program
|
|
|
207
207
|
const proxyPath = path.resolve(__dirname, 'visual-editor-proxy');
|
|
208
208
|
console.log(chalk.cyan(`Starting Visual Editor proxy for: ${options.url}`));
|
|
209
209
|
|
|
210
|
-
const child = spawn('npm', ['run', '
|
|
210
|
+
const child = spawn('npm', ['run', 'start'], {
|
|
211
211
|
cwd: proxyPath,
|
|
212
212
|
stdio: 'inherit', // Pipe output to the parent terminal
|
|
213
213
|
shell: true,
|
|
@@ -424,7 +424,7 @@ program
|
|
|
424
424
|
console.warn(chalk.yellow('Could not stop services, continuing with update...'));
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
|
-
|
|
427
|
+
|
|
428
428
|
await runCommand('npm', ['i', '-g', 'repoburg@latest']);
|
|
429
429
|
|
|
430
430
|
console.log(chalk.green.bold('\n✓ Repoburg update complete!'));
|
|
@@ -436,4 +436,4 @@ program
|
|
|
436
436
|
}
|
|
437
437
|
});
|
|
438
438
|
|
|
439
|
-
program.parse(process.argv);
|
|
439
|
+
program.parse(process.argv);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const express = require("express");
|
|
4
|
-
const http_proxy_middleware_1 = require("http-proxy-middleware");
|
|
5
|
-
const http_1 = require("http");
|
|
6
|
-
const path = require("path");
|
|
7
|
-
const app = express();
|
|
8
|
-
const PORT = process.env.PROXY_PORT || 9999;
|
|
9
|
-
const TARGET_URL = process.env.TARGET_URL;
|
|
10
|
-
const BACKEND_PORT = process.env.BACKEND_PORT;
|
|
11
|
-
if (!TARGET_URL) {
|
|
12
|
-
console.error('FATAL: TARGET_URL environment variable is not set.');
|
|
13
|
-
process.exit(1);
|
|
14
|
-
}
|
|
15
|
-
app.get('/repoburg-visual-editor.js', (req, res) => {
|
|
16
|
-
const clientScriptPath = path.resolve(__dirname, '../client/main.js');
|
|
17
|
-
const options = {
|
|
18
|
-
headers: {
|
|
19
|
-
'Content-Type': 'application/javascript',
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
res.sendFile(clientScriptPath, options, (err) => {
|
|
23
|
-
if (err) {
|
|
24
|
-
console.error("Error sending client script:", err);
|
|
25
|
-
res.status(500).send("Could not load client script.");
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
const proxy = (0, http_proxy_middleware_1.createProxyMiddleware)({
|
|
30
|
-
target: TARGET_URL,
|
|
31
|
-
changeOrigin: true,
|
|
32
|
-
selfHandleResponse: true,
|
|
33
|
-
on: {
|
|
34
|
-
proxyRes: (0, http_proxy_middleware_1.responseInterceptor)(async (responseBuffer, proxyRes, req, res) => {
|
|
35
|
-
const contentType = proxyRes.headers['content-type'];
|
|
36
|
-
if (contentType && contentType.includes('text/html')) {
|
|
37
|
-
const html = responseBuffer.toString('utf8');
|
|
38
|
-
const scriptToInject = `<script>window.REPOBURG_BACKEND_PORT = ${BACKEND_PORT};</script><script src="/repoburg-visual-editor.js"></script>`;
|
|
39
|
-
return html.replace('</body>', `${scriptToInject}</body>`);
|
|
40
|
-
}
|
|
41
|
-
return responseBuffer;
|
|
42
|
-
}),
|
|
43
|
-
error: (err, req, res) => {
|
|
44
|
-
console.error('Proxy error:', err);
|
|
45
|
-
if (res instanceof http_1.ServerResponse) {
|
|
46
|
-
if (!res.headersSent) {
|
|
47
|
-
res.writeHead(500, { 'Content-Type': 'text/plain' });
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
res.end('Proxy Error');
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
app.use('/', proxy);
|
|
55
|
-
app.listen(PORT, () => {
|
|
56
|
-
console.log(`\nRepoburg Visual Editor is running!`);
|
|
57
|
-
console.log(`- Proxy URL: http://localhost:${PORT}`);
|
|
58
|
-
console.log(`- Target App: ${TARGET_URL}`);
|
|
59
|
-
console.log(`- Backend Port: ${BACKEND_PORT || 'Not Set'}\n`);
|
|
60
|
-
});
|
|
61
|
-
//# sourceMappingURL=main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,mCAAmC;AACnC,iEAAmF;AACnF,+BAAsC;AACtC,6BAA6B;AAE7B,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;AACtB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC;AAC5C,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;AAC1C,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;AAE9C,IAAI,CAAC,UAAU,EAAE,CAAC;IACd,OAAO,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACpE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC;AAGD,GAAG,CAAC,GAAG,CAAC,4BAA4B,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IAC/C,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;IACtE,MAAM,OAAO,GAAG;QACZ,OAAO,EAAE;YACL,cAAc,EAAE,wBAAwB;S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