chore: attemp to fix nodecar missing dependencies

This commit is contained in:
zhom
2025-05-29 11:07:01 +04:00
parent d87ef3ccf6
commit 8b7fcf1a4d
2 changed files with 55 additions and 45 deletions
+54 -44
View File
@@ -23,58 +23,68 @@ program
.option("--ignore-certificate", "ignore certificate errors for HTTPS proxies")
.option("--id <id>", "proxy ID for stop command")
.description("manage proxy servers")
.action(async (action, options) => {
if (action === "start") {
if (!options.upstream) {
console.error("Error: Upstream proxy URL is required");
console.log(
"Example: proxy start -u http://username:password@proxy.example.com:8080"
);
return;
.action(
async (
action: string,
options: {
upstream?: string;
port?: number;
ignoreCertificate?: boolean;
id?: string;
}
try {
const config = await startProxyProcess(options.upstream, {
port: options.port,
ignoreProxyCertificate: options.ignoreCertificate,
});
console.log(JSON.stringify(config));
} catch (error: any) {
console.error(`Failed to start proxy: ${error.message}`);
}
} else if (action === "stop") {
if (options.id) {
const stopped = await stopProxyProcess(options.id);
console.log(`{
"success": ${stopped}}`);
} else if (options.upstream) {
// Find proxies with this upstream URL
const configs = listProxyConfigs().filter(
(config) => config.upstreamUrl === options.upstream
);
if (configs.length === 0) {
console.error(`No proxies found for ${options.upstream}`);
) => {
if (action === "start") {
if (!options.upstream) {
console.error("Error: Upstream proxy URL is required");
console.log(
"Example: proxy start -u http://username:password@proxy.example.com:8080"
);
return;
}
for (const config of configs) {
const stopped = await stopProxyProcess(config.id);
try {
const config = await startProxyProcess(options.upstream, {
port: options.port,
ignoreProxyCertificate: options.ignoreCertificate,
});
console.log(JSON.stringify(config));
} catch (error: any) {
console.error(`Failed to start proxy: ${error.message}`);
}
} else if (action === "stop") {
if (options.id) {
const stopped = await stopProxyProcess(options.id);
console.log(`{
"success": ${stopped}}`);
}
} else {
await stopAllProxyProcesses();
console.log(`{
} else if (options.upstream) {
// Find proxies with this upstream URL
const configs = listProxyConfigs().filter(
(config) => config.upstreamUrl === options.upstream
);
if (configs.length === 0) {
console.error(`No proxies found for ${options.upstream}`);
return;
}
for (const config of configs) {
const stopped = await stopProxyProcess(config.id);
console.log(`{
"success": ${stopped}}`);
}
} else {
await stopAllProxyProcesses();
console.log(`{
"success": true}`);
}
} else if (action === "list") {
const configs = listProxyConfigs();
console.log(JSON.stringify(configs));
} else {
console.error("Invalid action. Use 'start', 'stop', or 'list'");
}
} else if (action === "list") {
const configs = listProxyConfigs();
console.log(JSON.stringify(configs));
} else {
console.error("Invalid action. Use 'start', 'stop', or 'list'");
}
});
);
// Command for proxy worker (internal use)
program
@@ -82,7 +92,7 @@ program
.argument("<action>", "start a proxy worker")
.requiredOption("--id <id>", "proxy configuration ID")
.description("run a proxy worker process")
.action(async (action, options) => {
.action(async (action: string, options: { id: string }) => {
if (action === "start") {
await runProxyWorker(options.id);
} else {
+1 -1
View File
@@ -31,5 +31,5 @@
"next-env.d.ts",
"dist/types/**/*.ts"
],
"exclude": ["node_modules"]
"exclude": ["node_modules", "nodecar"]
}