rush-ai 0.9.0 → 0.9.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/dist/index.js CHANGED
@@ -9080,6 +9080,27 @@ async function streamPublishPod(client, projectId, opts) {
9080
9080
  };
9081
9081
  }
9082
9082
 
9083
+ // src/util/rush-domain.ts
9084
+ function deriveDomainSuffix(apiBaseUrl) {
9085
+ let host;
9086
+ try {
9087
+ host = new URL(apiBaseUrl).hostname;
9088
+ } catch {
9089
+ return "rush.zhenguanyu.com";
9090
+ }
9091
+ if (host.includes("rush-test") || host.includes("local")) {
9092
+ return "rush-dev.zhenguanyu.com";
9093
+ }
9094
+ return "rush.zhenguanyu.com";
9095
+ }
9096
+ function buildDeployDomain(prefix, env, apiBaseUrl) {
9097
+ const suffix = deriveDomainSuffix(apiBaseUrl);
9098
+ return env === "test" ? `${prefix}-test.${suffix}` : `${prefix}.${suffix}`;
9099
+ }
9100
+ function buildDeployUrl(prefix, env, apiBaseUrl) {
9101
+ return `https://${buildDeployDomain(prefix, env, apiBaseUrl)}`;
9102
+ }
9103
+
9083
9104
  // src/commands/task/push.ts
9084
9105
  import { resolve as resolve20 } from "path";
9085
9106
  import chalk5 from "chalk";
@@ -9531,6 +9552,13 @@ async function publishNextjs(client, projectId, commitHash, domain, format) {
9531
9552
  }
9532
9553
  }
9533
9554
  });
9555
+ if (domain !== void 0) {
9556
+ const { api: apiBase } = getGlobalConfig();
9557
+ return {
9558
+ url: buildDeployUrl(domain, "production", apiBase),
9559
+ domain: buildDeployDomain(domain, "production", apiBase)
9560
+ };
9561
+ }
9534
9562
  return { url: result.url, domain: result.domain };
9535
9563
  } catch (err) {
9536
9564
  throw toStepError("publish", err, { taskId: projectId, commitHash });
@@ -9566,14 +9594,15 @@ async function publishStatic(client, projectId, commitHash, env, domain) {
9566
9594
  { taskId: projectId, reason: "publish_failed" }
9567
9595
  );
9568
9596
  }
9569
- const url = publishResp.data.data?.url;
9570
- const returnedDomain = publishResp.data.data?.domain;
9597
+ const { api: apiBase } = getGlobalConfig();
9598
+ const resolvedDomain = domain !== void 0 ? buildDeployDomain(domain, env, apiBase) : publishResp.data.data?.domain;
9599
+ const resolvedUrl = domain !== void 0 ? buildDeployUrl(domain, env, apiBase) : publishResp.data.data?.url;
9571
9600
  const versionId = commitHash;
9572
9601
  const deployBody = {
9573
9602
  versionId,
9574
9603
  // Spec §Environment mapping: deploy-version uses `production` literal.
9575
9604
  environment: toDeployVersionEnv(env),
9576
- deployedUrl: url ?? "",
9605
+ deployedUrl: resolvedUrl ?? "",
9577
9606
  ...domain !== void 0 ? { customDomainPrefix: domain } : {}
9578
9607
  };
9579
9608
  try {
@@ -9587,7 +9616,7 @@ async function publishStatic(client, projectId, commitHash, env, domain) {
9587
9616
  `deploy-version write failed (best-effort; deploy succeeded): ${details}`
9588
9617
  );
9589
9618
  }
9590
- return { url, domain: returnedDomain };
9619
+ return { url: resolvedUrl, domain: resolvedDomain };
9591
9620
  }
9592
9621
  function emitSuccess(args) {
9593
9622
  if (args.format === "json") {
@@ -9673,7 +9702,9 @@ function registerDomainSubcommand(task, program) {
9673
9702
  return;
9674
9703
  }
9675
9704
  if (data.available) {
9676
- output.success(`Prefix available: https://${prefix}.<suffix>`);
9705
+ const { api } = getGlobalConfig();
9706
+ const url = buildDeployUrl(prefix, "production", api);
9707
+ output.success(`Prefix available: ${url}`);
9677
9708
  } else {
9678
9709
  throw new RushError(
9679
9710
  `Domain prefix "${prefix}" is taken${data.conflictProjectId ? ` by project ${data.conflictProjectId}` : ""}.`,
@@ -9718,7 +9749,7 @@ function registerVersionsSubcommand(task, program) {
9718
9749
  "#": String(idx + 1),
9719
9750
  Version: v.versionNumber != null ? String(v.versionNumber) : "",
9720
9751
  Commit: shortHash2(v.id),
9721
- Created: formatCreatedAt(v.createdAt),
9752
+ Created: formatCreatedAt(v.timestamp ?? v.createdAt),
9722
9753
  Test: v.deployedToTest ? MARK_YES : MARK_NO,
9723
9754
  Production: v.deployedToProduction ? MARK_YES : MARK_NO
9724
9755
  }));