onveloz 0.0.0-beta.12 → 0.0.0-beta.13

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.
Files changed (2) hide show
  1. package/dist/index.mjs +44 -26
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -63,9 +63,20 @@ function endGroup() {
63
63
  if (getOutputMode() === "github-actions") process.stdout.write("::endgroup::\n");
64
64
  }
65
65
 
66
+ //#endregion
67
+ //#region ../../packages/config/src/index.ts
68
+ const SERVICE_TYPES = [
69
+ "WEB",
70
+ "STATIC",
71
+ "WORKER"
72
+ ];
73
+ const BUILD_TIMEOUT_MS = 600 * 1e3;
74
+ const DEPLOY_TIMEOUT_MS = 300 * 1e3;
75
+
66
76
  //#endregion
67
77
  //#region ../../packages/config/veloz-config.ts
68
- const ServiceTypeSchema = z.enum(["web", "static"]);
78
+ const LOWERCASE_SERVICE_TYPES = SERVICE_TYPES.map((t) => t.toLowerCase());
79
+ const ServiceTypeSchema = z.enum(LOWERCASE_SERVICE_TYPES);
69
80
  const PackageManagerSchema = z.enum([
70
81
  "npm",
71
82
  "yarn",
@@ -864,7 +875,7 @@ const linkCommand = new Command("link").description("Verificar vínculo do proje
864
875
  if (services.length > 0) {
865
876
  console.log(`\n ${chalk.bold("Serviços:")}`);
866
877
  services.forEach(([key, service]) => {
867
- const type = service.type === "web" ? "Serviço Web" : "Site Estático";
878
+ const type = service.type === "web" ? "Serviço Web" : service.type === "worker" ? "Worker" : "Site Estático";
868
879
  console.log(` • ${chalk.cyan(service.name)} (${key}) - ${type}`);
869
880
  });
870
881
  }
@@ -1770,7 +1781,7 @@ const LOGO_LINES = [
1770
1781
  ];
1771
1782
  const BRAND_COLOR = "#FF4D00";
1772
1783
  function getVersion() {
1773
- return "0.0.0-beta.12";
1784
+ return "0.0.0-beta.13";
1774
1785
  }
1775
1786
  function printBanner(subtitle) {
1776
1787
  const mode = getOutputMode();
@@ -2274,7 +2285,7 @@ async function fetchLatestVersion() {
2274
2285
  async function autoUpdate() {
2275
2286
  const pm = detectPackageManager();
2276
2287
  if (!pm) return;
2277
- const currentVersion = "0.0.0-beta.12";
2288
+ const currentVersion = "0.0.0-beta.13";
2278
2289
  const latestVersion = await fetchLatestVersion();
2279
2290
  if (!latestVersion || latestVersion === currentVersion) return;
2280
2291
  const installCmd = getInstallCommand(pm, latestVersion);
@@ -2291,6 +2302,11 @@ async function autoUpdate() {
2291
2302
 
2292
2303
  //#endregion
2293
2304
  //#region src/commands/deploy.ts
2305
+ const SERVICE_TYPE_LABELS = {
2306
+ WEB: "Serviço Web",
2307
+ STATIC: "Site Estático",
2308
+ WORKER: "Worker"
2309
+ };
2294
2310
  /**
2295
2311
  * If a Dockerfile exists in a subdirectory (rootDirectory), copy it to tar root
2296
2312
  * so BuildKit can find it. If no Dockerfile exists anywhere, return nothing —
@@ -2407,14 +2423,14 @@ function printSummary(settings) {
2407
2423
  console.log();
2408
2424
  console.log(chalk.dim("─".repeat(40)));
2409
2425
  console.log(` ${chalk.bold("Nome:")} ${settings.name}`);
2410
- console.log(` ${chalk.bold("Tipo:")} ${settings.type === "WEB" ? "Serviço Web" : "Site Estático"}`);
2426
+ console.log(` ${chalk.bold("Tipo:")} ${SERVICE_TYPE_LABELS[settings.type] ?? settings.type}`);
2411
2427
  console.log(` ${chalk.bold("Branch:")} ${settings.branch}`);
2412
2428
  if (settings.framework) console.log(` ${chalk.bold("Framework:")} ${settings.framework}`);
2413
2429
  if (settings.packageManager) console.log(` ${chalk.bold("Package Mgr:")} ${settings.packageManager}`);
2414
2430
  if (settings.buildCommand) console.log(` ${chalk.bold("Build:")} ${settings.buildCommand}`);
2415
2431
  if (settings.startCommand) console.log(` ${chalk.bold("Start:")} ${settings.startCommand}`);
2416
2432
  if (settings.outputDir) console.log(` ${chalk.bold("Output:")} ${settings.outputDir}`);
2417
- if (settings.port) console.log(` ${chalk.bold("Porta:")} ${settings.port}`);
2433
+ if (settings.port && settings.type !== "WORKER") console.log(` ${chalk.bold("Porta:")} ${settings.port}`);
2418
2434
  console.log(chalk.dim("─".repeat(40)));
2419
2435
  console.log();
2420
2436
  });
@@ -2656,13 +2672,20 @@ async function createServiceFlow(projectId, projectName, repoName, opts = {}) {
2656
2672
  if (!await promptConfirm("Confirmar e fazer deploy?")) {
2657
2673
  const newName = await prompt(`Nome do serviço: ${chalk.dim(`(${settings.name})`)}`);
2658
2674
  if (newName) settings.name = newName;
2659
- settings.type = await promptSelect("Tipo de serviço:", [{
2660
- label: "Serviço Web",
2661
- value: "WEB"
2662
- }, {
2663
- label: "Site Estático",
2664
- value: "STATIC"
2665
- }]);
2675
+ settings.type = await promptSelect("Tipo de serviço:", [
2676
+ {
2677
+ label: "Serviço Web",
2678
+ value: "WEB"
2679
+ },
2680
+ {
2681
+ label: "Site Estático",
2682
+ value: "STATIC"
2683
+ },
2684
+ {
2685
+ label: "Worker",
2686
+ value: "WORKER"
2687
+ }
2688
+ ]);
2666
2689
  const newBuild = await prompt(`Build command: ${chalk.dim(`(${settings.buildCommand ?? "—"})`)}`);
2667
2690
  if (newBuild) settings.buildCommand = newBuild;
2668
2691
  const newStart = await prompt(`Start command: ${chalk.dim(`(${settings.startCommand ?? "—"})`)}`);
@@ -3628,19 +3651,16 @@ domainsCommand.command("list").alias("listar").description("Listar domínios dos
3628
3651
  printTable([
3629
3652
  "ID",
3630
3653
  "Domínio",
3631
- "Verificado",
3632
3654
  "TLS",
3633
3655
  "Tipo"
3634
3656
  ], domains.map((d) => [
3635
3657
  d.id,
3636
3658
  chalk.bold(d.domain),
3637
- d.verified ? chalk.green("✓ Sim") : chalk.yellow("✗ Não"),
3638
3659
  tlsStatusLabels[d.tlsStatus] ?? d.tlsStatus,
3639
3660
  d.isAutoGenerated ? "Auto" : "Personalizado"
3640
3661
  ]), domains.map((d) => ({
3641
3662
  id: d.id,
3642
3663
  domain: d.domain,
3643
- verified: d.verified,
3644
3664
  tlsStatus: d.tlsStatus,
3645
3665
  isAutoGenerated: d.isAutoGenerated
3646
3666
  })));
@@ -3685,16 +3705,14 @@ domainsCommand.command("verify <domainId>").alias("verificar").description("Veri
3685
3705
  const result = await (await getClient()).domains.verify({ domainId });
3686
3706
  spin.stop();
3687
3707
  output({
3688
- type: "domain_verified",
3708
+ type: "domain_status",
3689
3709
  domain: result.domain.domain,
3690
- verified: result.verified
3710
+ ready: result.ready
3691
3711
  }, () => {
3692
- if (result.verified) {
3693
- success(`Domínio ${chalk.bold(result.domain.domain)} verificado com sucesso!`);
3694
- info("O certificado TLS será provisionado automaticamente.");
3695
- } else {
3696
- console.log(chalk.yellow(`\n⚠ Domínio ${chalk.bold(result.domain.domain)} ainda não verificado.`));
3697
- info("Verifique se o CNAME foi propagado e tente novamente.");
3712
+ if (result.ready) success(`Domínio ${chalk.bold(result.domain.domain)} com TLS ativo!`);
3713
+ else {
3714
+ console.log(chalk.yellow(`\n⚠ Certificado TLS de ${chalk.bold(result.domain.domain)} ainda sendo provisionado.`));
3715
+ info("Verifique se o CNAME foi configurado para cname.onveloz.com.");
3698
3716
  }
3699
3717
  });
3700
3718
  } catch (error) {
@@ -3722,7 +3740,7 @@ function formatValue(value) {
3722
3740
  }
3723
3741
  function printServiceConfig(service) {
3724
3742
  console.log(` ${chalk.bold("Nome:")} ${formatValue(service.name)}`);
3725
- console.log(` ${chalk.bold("Tipo:")} ${formatValue(service.type === "WEB" ? "Serviço Web" : "Site Estático")}`);
3743
+ console.log(` ${chalk.bold("Tipo:")} ${formatValue(service.type === "WEB" ? "Serviço Web" : service.type === "WORKER" ? "Worker" : "Site Estático")}`);
3726
3744
  console.log(` ${chalk.bold("Branch:")} ${formatValue(service.branch)}`);
3727
3745
  console.log(` ${chalk.bold("Root Dir:")} ${formatValue(service.rootDirectory || "/")}`);
3728
3746
  console.log(` ${chalk.bold("Build Command:")} ${formatValue(service.buildCommand)}`);
@@ -4039,7 +4057,7 @@ const whoamiCommand = new Command("whoami").description("Mostrar usuário autent
4039
4057
 
4040
4058
  //#endregion
4041
4059
  //#region src/index.ts
4042
- const program = new Command().name("veloz").description("CLI da plataforma Veloz — deploy rápido para o Brasil").version("0.0.0-beta.12").option("--output <format>", "Formato de saída: fancy, json, github-actions, plain").option("--env <environment>", "Ambiente alvo (ex: preview, staging)").hook("preAction", (thisCommand) => {
4060
+ const program = new Command().name("veloz").description("CLI da plataforma Veloz — deploy rápido para o Brasil").version("0.0.0-beta.13").option("--output <format>", "Formato de saída: fancy, json, github-actions, plain").option("--env <environment>", "Ambiente alvo (ex: preview, staging)").hook("preAction", (thisCommand) => {
4043
4061
  const opts = thisCommand.opts();
4044
4062
  if (opts.output) {
4045
4063
  const valid = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "onveloz",
3
- "version": "0.0.0-beta.12",
3
+ "version": "0.0.0-beta.13",
4
4
  "description": "CLI da plataforma Veloz — deploy rápido para o Brasil",
5
5
  "keywords": [
6
6
  "brasil",