@purecore/one-server-4-all 0.1.0 → 0.3.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/src/deployer.ts CHANGED
@@ -22,7 +22,7 @@ export class Deployer {
22
22
 
23
23
  private printBanner() {
24
24
  console.log(
25
- `\n ${bold(magenta("🚀 HOT-SERVER DEPLOYER"))} ${gray("v0.4.0")}`
25
+ `\n ${bold(magenta("🚀 one-server-4-all DEPLOYER"))} ${gray("v0.4.0")}`
26
26
  );
27
27
  console.log(` ${gray("─────────────────────────────────────────")}\n`);
28
28
  }
@@ -45,9 +45,9 @@ export class Deployer {
45
45
  const port =
46
46
  (await this.question(
47
47
  ` ${cyan("➜")} ${bold("Qual a porta do servidor?")} ${gray(
48
- "(padrão 6000)"
48
+ "(padrão 7000)"
49
49
  )}\n ${green("❯")} `
50
- )) || "6000";
50
+ )) || "7000";
51
51
 
52
52
  const confirmNginx = await this.question(
53
53
  ` ${cyan("➜")} ${bold(
@@ -69,19 +69,18 @@ export class Deployer {
69
69
  const name = domain.split(".")[0];
70
70
 
71
71
  // Monta o comando PM2
72
- // Se temos certificados do Certbot e o usuário quer usar no node direto (embora com nginx proxy não precise necessariamente)
73
- // O user pediu para "ter o caminho para apontar para eles".
74
- // Vamos gerar o comando COM os certificados se eles existirem, e setar https=true
72
+ // Quando Nginx+Certbot está configurado, o Nginx faz terminação SSL
73
+ // O server roda em HTTP simples (Nginx faz proxy_pass http://localhost:porta)
74
+ // Argumentos devem estar DENTRO das aspas para PM2 processar corretamente
75
75
 
76
- let pm2Command = `pm2 start dist/index.js --name "${domain}" -- --port=${port} --open=false`;
76
+ let pm2Command: string;
77
77
 
78
78
  if (certPaths.key && certPaths.cert) {
79
- // Nota: Node node pode não ter permissão de ler /etc/letsencrypt diretamente dependendo do user
80
- // Mas vamos atender o pedido de colocar o caminho
81
- pm2Command += ` --https=true --ssl-key="${certPaths.key}" --ssl-cert="${certPaths.cert}"`;
79
+ // Com Nginx+Certbot: server roda HTTP, Nginx cuida do SSL
80
+ pm2Command = `pm2 start "npx vai-server --port=${port} --open=false" --name "${domain}"`;
82
81
  } else {
83
- // Se nao tem certbot, roda http normal (ou auto-assinado se forcer https)
84
- pm2Command += ` --https=false`;
82
+ // Sem Nginx: pode rodar HTTPS auto-assinado ou HTTP
83
+ pm2Command = `pm2 start "npx vai-server --port=${port} --open=false" --name "${domain}"`;
85
84
  }
86
85
 
87
86
  console.log(`\n ${bold("📦 Configuração Final:")}`);
package/src/index.ts CHANGED
@@ -24,7 +24,7 @@ if (args[0] === "deploy") {
24
24
  const rootArg = args[0] && !args[0].startsWith("--") ? args[0] : ".";
25
25
 
26
26
  const rawConfig = {
27
- port: parseInt(getArg("port", "6000")),
27
+ port: parseInt(getArg("port", "7000")),
28
28
  root: path.resolve(process.cwd(), rootArg),
29
29
  open: getArg("open", "true"), // 'true' por padrão
30
30
  spa: getArg("spa", "false"), // 'false' por padrão
package/src/server.ts CHANGED
@@ -14,22 +14,22 @@ const INJECTED_SCRIPT = `
14
14
  <!-- Code injected by auto-server -->
15
15
  <script>
16
16
  (function() {
17
- console.log('[hot-server] Connected to hot reload');
17
+ console.log('[one-server-4-all] Connected to hot reload');
18
18
  const evtSource = new EventSource('/_hot_server_sse');
19
19
  evtSource.onmessage = function(event) {
20
20
  try {
21
21
  const data = JSON.parse(event.data);
22
22
  if (data.type === 'css') {
23
- console.log('[hot-server] CSS changed, injecting...');
23
+ console.log('[one-server-4-all] CSS changed, injecting...');
24
24
  injectCSS(data.file);
25
25
  } else {
26
- console.log('[hot-server] Reloading...');
26
+ console.log('[one-server-4-all] Reloading...');
27
27
  window.location.reload();
28
28
  }
29
29
  } catch (e) {
30
30
  // Fallback para compatibilidade
31
31
  if (event.data === 'reload') {
32
- console.log('[hot-server] Reloading...');
32
+ console.log('[one-server-4-all] Reloading...');
33
33
  window.location.reload();
34
34
  }
35
35
  }
@@ -46,13 +46,13 @@ const INJECTED_SCRIPT = `
46
46
  // Força reload do CSS adicionando/removendo timestamp
47
47
  const newHref = href.split('?')[0] + '?v=' + timestamp;
48
48
  link.setAttribute('href', newHref);
49
- console.log('[hot-server] CSS injected:', filePath);
49
+ console.log('[one-server-4-all] CSS injected:', filePath);
50
50
  }
51
51
  });
52
52
  }
53
53
 
54
54
  evtSource.onerror = function() {
55
- console.log('[hot-server] Disconnected. Retrying...');
55
+ console.log('[one-server-4-all] Disconnected. Retrying...');
56
56
  };
57
57
  })();
58
58
  </script>
@@ -383,7 +383,7 @@ export class HotServer {
383
383
  const gray = (text: string) => `\x1b[90m${text}\x1b[0m`;
384
384
 
385
385
  console.log(
386
- `\n ${bold(cyan("HOT-SERVER"))} ${cyan("v" + version)} ${gray(
386
+ `\n ${bold(cyan("one-server-4-all"))} ${cyan("v" + version)} ${gray(
387
387
  "ready in"
388
388
  )} ${bold(green(readyTime + " ms"))}\n`
389
389
  );
@@ -656,7 +656,7 @@ export class HotServer {
656
656
  </div>
657
657
 
658
658
  <div class="back">
659
- Servido por <strong>purecore-hot-server</strong>
659
+ Servido por <strong>purecore-one-server-4-all</strong>
660
660
  </div>
661
661
  </div>
662
662
  </body>