project-foundry 1.1.0 → 1.1.1
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/bin/foundry.js +2 -1
- package/package.json +1 -1
- package/src/daemon.js +8 -0
- package/src/service-manager.js +3 -0
package/bin/foundry.js
CHANGED
|
@@ -6,7 +6,7 @@ import * as p from '@clack/prompts';
|
|
|
6
6
|
import pc from 'picocolors';
|
|
7
7
|
import { hasConfig, writeConfig, readConfig, getDefaultStorageDir } from '../src/config.js';
|
|
8
8
|
import { registerNodeWithCloud } from '../src/api-client.js';
|
|
9
|
-
import { installAutostartService, isServerHealthy, startDaemonBackground } from '../src/service-manager.js';
|
|
9
|
+
import { installAutostartService, isServerHealthy, startDaemonBackground, stopRunningDaemon } from '../src/service-manager.js';
|
|
10
10
|
import { runInteractiveTui } from '../src/tui.js';
|
|
11
11
|
import { startDaemon } from '../src/daemon.js';
|
|
12
12
|
|
|
@@ -31,6 +31,7 @@ program
|
|
|
31
31
|
.description('Inicia o servidor local e o túnel com logs visíveis no terminal')
|
|
32
32
|
.action(() => {
|
|
33
33
|
console.log(pc.bold(pc.cyan('Iniciando Project Foundry Local Server...')));
|
|
34
|
+
stopRunningDaemon();
|
|
34
35
|
startDaemon();
|
|
35
36
|
});
|
|
36
37
|
|
package/package.json
CHANGED
package/src/daemon.js
CHANGED
|
@@ -167,6 +167,14 @@ export function startDaemon() {
|
|
|
167
167
|
}
|
|
168
168
|
});
|
|
169
169
|
|
|
170
|
+
server.on('error', (err) => {
|
|
171
|
+
if (err.code === 'EADDRINUSE') {
|
|
172
|
+
console.warn(`[Foundry Daemon] Aviso: Porta ${port} já está em uso por outro processo. O túnel reverso segue operando normalmente.`);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
console.error(`[Foundry Daemon] Erro no servidor HTTP local: ${err.message}`);
|
|
176
|
+
});
|
|
177
|
+
|
|
170
178
|
server.listen(port, '0.0.0.0', () => {
|
|
171
179
|
console.log(`[Foundry Daemon] Servidor local escutando em http://0.0.0.0:${port}`);
|
|
172
180
|
console.log(`[Foundry Daemon] Diretório de arquivos: ${config.storagePath}`);
|
package/src/service-manager.js
CHANGED