@theholocron/cli 3.32.0 → 3.33.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/cli.mjs CHANGED
@@ -260,6 +260,7 @@ function resolveConfig(raw) {
260
260
  description: raw.description,
261
261
  homepage,
262
262
  org: raw.org,
263
+ domain: raw.domain,
263
264
  repo: raw.repo,
264
265
  workflows: raw.workflows,
265
266
  providers,
@@ -2844,7 +2845,7 @@ function extractPreviewConfig(raw, ctx = {}) {
2844
2845
  if (!preview) return null;
2845
2846
  if (preview === true) {
2846
2847
  const project = ctx.org ? `${ctx.org}-preview` : null;
2847
- const domain = ctx.docsDomain ? `preview.${ctx.docsDomain}` : void 0;
2848
+ const domain = ctx.domain ? `preview.${ctx.domain}` : void 0;
2848
2849
  if (!project) return null;
2849
2850
  return {
2850
2851
  project,
@@ -2855,7 +2856,7 @@ function extractPreviewConfig(raw, ctx = {}) {
2855
2856
  const p = preview;
2856
2857
  const project = typeof p["project"] === "string" && p["project"] ? p["project"] : ctx.org ? `${ctx.org}-preview` : null;
2857
2858
  if (!project) return null;
2858
- const domain = typeof p["domain"] === "string" && p["domain"] ? p["domain"] : ctx.docsDomain ? `preview.${ctx.docsDomain}` : void 0;
2859
+ const domain = typeof p["domain"] === "string" && p["domain"] ? p["domain"] : ctx.domain ? `preview.${ctx.domain}` : void 0;
2859
2860
  return {
2860
2861
  project,
2861
2862
  ...domain ? { domain } : {}
@@ -2935,7 +2936,7 @@ function generateCombinedDeployContent(deployWith, paths, preview) {
2935
2936
  *
2936
2937
  * Used by both `holocron setup` and `sync-workflow-templates`.
2937
2938
  */
2938
- function normalizeWorkflowWith(raw) {
2939
+ function normalizeWorkflowWith(raw, repoName) {
2939
2940
  const result = { ...raw };
2940
2941
  delete result["preview"];
2941
2942
  const hasDocs = raw["docs"] === true || raw["docs"] !== null && typeof raw["docs"] === "object";
@@ -2943,6 +2944,7 @@ function normalizeWorkflowWith(raw) {
2943
2944
  if (hasDocs) {
2944
2945
  result["type"] = "docs";
2945
2946
  delete result["docs"];
2947
+ if (!result["name"] && repoName) result["name"] = repoName;
2946
2948
  }
2947
2949
  if (Array.isArray(storybookProjects)) {
2948
2950
  if (!hasDocs) result["type"] = "storybook";
@@ -3488,7 +3490,7 @@ async function runSetup(input) {
3488
3490
  for (const entry of workflows) {
3489
3491
  const name = typeof entry === "string" ? entry : entry.name;
3490
3492
  const rawWith = typeof entry === "object" ? entry.with : void 0;
3491
- const withOverrides = rawWith ? normalizeWorkflowWith(rawWith) : void 0;
3493
+ const withOverrides = rawWith ? normalizeWorkflowWith(rawWith, config.name) : void 0;
3492
3494
  const additionalPaths = (typeof entry === "object" ? entry.paths : void 0) ?? (name === "deploy" && rawWith ? deriveDeployPaths(rawWith) : void 0);
3493
3495
  if (name === "test" && withOverrides) {
3494
3496
  const runUnit = withOverrides["run-unit"];
@@ -3508,7 +3510,7 @@ async function runSetup(input) {
3508
3510
  if (name === "deploy" && rawWith) {
3509
3511
  const previewCfg = extractPreviewConfig(rawWith, {
3510
3512
  org: config.org,
3511
- docsDomain: config.docs?.domain
3513
+ domain: config.domain
3512
3514
  });
3513
3515
  if (previewCfg) {
3514
3516
  const paths = additionalPaths;
@@ -3691,7 +3693,16 @@ async function runSetup(input) {
3691
3693
  }));
3692
3694
  print(formatStep(steps[steps.length - 1]));
3693
3695
  const deployEntry = (config.workflows ?? []).map((e) => typeof e === "string" ? { name: e } : e).find((e) => e.name === "deploy");
3694
- const previewCfg = deployEntry?.with ? extractPreviewConfig(deployEntry.with) : null;
3696
+ const previewCfg = deployEntry?.with ? extractPreviewConfig(deployEntry.with, {
3697
+ org: config.org,
3698
+ domain: config.domain
3699
+ }) : null;
3700
+ if (previewCfg) {
3701
+ steps.push(await runStep("deployment", `ensureProject ${previewCfg.project}`, dryRun, async () => {
3702
+ await deploy.ensureProject({ name: previewCfg.project });
3703
+ }));
3704
+ print(formatStep(steps[steps.length - 1]));
3705
+ }
3695
3706
  if (previewCfg?.domain && deploy.ensureCustomDomain) {
3696
3707
  const wildcardDomain = `*.${previewCfg.domain}`;
3697
3708
  steps.push(await runStep("deployment", `ensureCustomDomain ${wildcardDomain}`, dryRun, async () => {
@@ -4779,10 +4790,12 @@ function parseWorkflowsFromTs(source) {
4779
4790
  */
4780
4791
  function parseOrgContextFromTs(source) {
4781
4792
  const orgMatch = source.match(/\borg\s*:\s*["']([^"']+)["']/);
4782
- const domainMatch = source.match(/\bdocs\s*:[^}]*?domain\s*:\s*["']([^"']+)["']/s);
4793
+ const domainMatch = source.match(/\bdomain\s*:\s*["']([^"']+)["']/);
4794
+ const nameMatch = source.split(/\bworkflows\s*:/)[0].match(/\bname\s*:\s*["']([^"']+)["']/);
4783
4795
  return {
4784
4796
  org: orgMatch?.[1],
4785
- docsDomain: domainMatch?.[1]
4797
+ domain: domainMatch?.[1],
4798
+ repoName: nameMatch?.[1]
4786
4799
  };
4787
4800
  }
4788
4801
  function reusableHeader(source) {
@@ -4822,7 +4835,7 @@ function buildBatch(repo, allowedWorkflows, withOverrides, orgContext) {
4822
4835
  if (name === "deploy-preview") continue;
4823
4836
  if (allowedWorkflows && !allowedWorkflows.has(name)) continue;
4824
4837
  const rawWith = withOverrides?.get(name);
4825
- const normalizedWith = rawWith ? normalizeWorkflowWith(rawWith) : void 0;
4838
+ const normalizedWith = rawWith ? normalizeWorkflowWith(rawWith, orgContext?.repoName) : void 0;
4826
4839
  const additionalPaths = name === "deploy" && rawWith ? deriveDeployPaths(rawWith) : void 0;
4827
4840
  if (name === "deploy" && rawWith) {
4828
4841
  const previewCfg = extractPreviewConfig(rawWith, orgContext);