@theholocron/cli 5.0.0-alpha.26 → 5.0.0-alpha.28

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/cli.mjs CHANGED
@@ -5489,11 +5489,9 @@ async function runSetup(input) {
5489
5489
  const wikiProxy = wiki.proxyConfig?.();
5490
5490
  if (wikiDns && loader.has("dns")) {
5491
5491
  const dns = loader.get("dns");
5492
- steps.push(await runStep("dns", `upsertRecord ${wikiDns.cname}`, dryRun, async () => {
5492
+ steps.push(await runStep("dns", `upsertRecord ${wikiDns.record.name}`, dryRun, async () => {
5493
5493
  await dns.upsertRecord(wikiDns.zone, {
5494
- type: "CNAME",
5495
- name: wikiDns.cname,
5496
- content: wikiDns.target,
5494
+ ...wikiDns.record,
5497
5495
  ttl: 1,
5498
5496
  ...wikiProxy ? { proxied: true } : {}
5499
5497
  });
@@ -5502,8 +5500,8 @@ async function runSetup(input) {
5502
5500
  }
5503
5501
  if (wikiProxy && wikiDns && loader.has("workers")) {
5504
5502
  const workers = loader.get("workers");
5505
- steps.push(await runStep("workers", `upsertProxy ${wikiDns.cname}`, dryRun, async () => {
5506
- await workers.upsertProxy(wikiDns.cname, wikiProxy);
5503
+ steps.push(await runStep("workers", `upsertProxy ${wikiDns.record.name}`, dryRun, async () => {
5504
+ await workers.upsertProxy(wikiDns.record.name, wikiProxy);
5507
5505
  }));
5508
5506
  print(formatStep(steps[steps.length - 1]));
5509
5507
  }
@@ -5516,11 +5514,31 @@ async function runSetup(input) {
5516
5514
  org: config.org,
5517
5515
  domain: config.domain
5518
5516
  }) : null;
5517
+ const ensureCustomDomain = async (projectId, hostname) => {
5518
+ if (!deploy.ensureCustomDomain) return;
5519
+ const customDomainDns = { value: null };
5520
+ steps.push(await runStep("deployment", `ensureCustomDomain ${hostname}`, dryRun, async () => {
5521
+ customDomainDns.value = await deploy.ensureCustomDomain(projectId, hostname);
5522
+ }));
5523
+ print(formatStep(steps[steps.length - 1]));
5524
+ if (customDomainDns.value && loader.has("dns")) {
5525
+ const dns = loader.get("dns");
5526
+ const dnsRecord = customDomainDns.value;
5527
+ steps.push(await runStep("dns", `upsertRecord ${dnsRecord.record.name}`, dryRun, async () => {
5528
+ await dns.upsertRecord(dnsRecord.zone, {
5529
+ ...dnsRecord.record,
5530
+ ttl: 1
5531
+ });
5532
+ }));
5533
+ print(formatStep(steps[steps.length - 1]));
5534
+ }
5535
+ };
5519
5536
  if (!previewCfg) {
5520
5537
  steps.push(await runStep("deployment", `ensureProject ${config.name}`, dryRun, async () => {
5521
5538
  await deploy.ensureProject({ name: config.name });
5522
5539
  }));
5523
5540
  print(formatStep(steps[steps.length - 1]));
5541
+ if (deploy.domain) await ensureCustomDomain(config.name, deploy.domain);
5524
5542
  }
5525
5543
  if (previewCfg) {
5526
5544
  steps.push(await runStep("deployment", `ensureProject ${previewCfg.project}`, dryRun, async () => {
@@ -5528,13 +5546,8 @@ async function runSetup(input) {
5528
5546
  }));
5529
5547
  print(formatStep(steps[steps.length - 1]));
5530
5548
  }
5531
- if (previewCfg?.domain && deploy.ensureCustomDomain) {
5532
- steps.push(await runStep("deployment", `ensureCustomDomain ${previewCfg.domain}`, dryRun, async () => {
5533
- await deploy.ensureCustomDomain(previewCfg.project, previewCfg.domain);
5534
- }));
5535
- print(formatStep(steps[steps.length - 1]));
5536
- }
5537
- if (previewCfg?.domain && loader.has("dns")) {
5549
+ if (previewCfg?.domain) await ensureCustomDomain(previewCfg.project, previewCfg.domain);
5550
+ if (previewCfg?.domain && deploy.providerName === "cloudflare" && loader.has("dns")) {
5538
5551
  const dns = loader.get("dns");
5539
5552
  const wildcardDomain = `*.${previewCfg.domain}`;
5540
5553
  steps.push(await runStep("dns", `upsertRecord ${previewCfg.domain}`, dryRun, async () => {