@t8/docsgen 0.2.42 → 0.2.44

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/bin.js CHANGED
@@ -252,7 +252,8 @@ async function setCName({ dir = "", name, cname, jsorg }) {
252
252
  // src/bin/setContent.ts
253
253
  import { exec as defaultExec } from "node:child_process";
254
254
  import { access, cp, mkdir, writeFile as writeFile2 } from "node:fs/promises";
255
- import { join as join3 } from "node:path";
255
+ import { dirname, join as join3 } from "node:path";
256
+ import { fileURLToPath } from "node:url";
256
257
  import { promisify } from "node:util";
257
258
 
258
259
  // src/const/packageName.ts
@@ -666,6 +667,8 @@ function toFileContent(x) {
666
667
 
667
668
  // src/bin/setContent.ts
668
669
  var exec = promisify(defaultExec);
670
+ var __filename = fileURLToPath(import.meta.url);
671
+ var __dirname = dirname(__filename);
669
672
  function getDefaultCodeStyleContent(cssRoot) {
670
673
  return `
671
674
  <link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/stackoverflow-light.min.css" media="(prefers-color-scheme: light)">
@@ -688,14 +691,12 @@ async function setContent(ctx) {
688
691
  root,
689
692
  contentDir = "",
690
693
  name,
691
- title,
694
+ title: configTitle,
692
695
  description: packageDescription,
693
696
  backstory,
694
697
  redirect
695
698
  } = ctx;
696
699
  let counterContent = getCounterContent(ctx);
697
- let escapedName = escapeHTML(name);
698
- let escapedTitle = title ? escapeHTML(title) : escapedName;
699
700
  let escapedPackageDescription = escapeHTML(packageDescription);
700
701
  let rootAttrs = "";
701
702
  let cssRoot = {
@@ -748,7 +749,17 @@ ${getInjectedContent(ctx, "redirect", "body")}
748
749
  );
749
750
  return;
750
751
  }
751
- let { description, intro, features, note, installation, sections, nav } = await getParsedContent(ctx);
752
+ let {
753
+ title,
754
+ description,
755
+ intro,
756
+ features,
757
+ note,
758
+ installation,
759
+ sections,
760
+ nav
761
+ } = await getParsedContent(ctx);
762
+ let escapedTitle = configTitle ? escapeHTML(configTitle) : title || escapeHTML(name);
752
763
  let descriptionContent = tweakTypography(description) || (escapedPackageDescription ? `<p>${tweakTypography(escapedPackageDescription)}<p>` : "");
753
764
  let navContent = await getNav(ctx, nav);
754
765
  let dirs = [contentDir];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t8/docsgen",
3
- "version": "0.2.42",
3
+ "version": "0.2.44",
4
4
  "description": "",
5
5
  "main": "dist/bin.js",
6
6
  "type": "module",
@@ -1,6 +1,7 @@
1
1
  import { exec as defaultExec } from "node:child_process";
2
2
  import { access, cp, mkdir, writeFile } from "node:fs/promises";
3
- import { join } from "node:path";
3
+ import { dirname, join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
4
5
  import { promisify } from "node:util";
5
6
  import { packageName } from "../const/packageName.ts";
6
7
  import type { Context } from "../types/Context.ts";
@@ -18,6 +19,9 @@ import { toFileContent } from "./toFileContent.ts";
18
19
 
19
20
  const exec = promisify(defaultExec);
20
21
 
22
+ const __filename = fileURLToPath(import.meta.url);
23
+ const __dirname = dirname(__filename);
24
+
21
25
  function getDefaultCodeStyleContent(cssRoot: string) {
22
26
  return `
23
27
  <link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/stackoverflow-light.min.css" media="(prefers-color-scheme: light)">
@@ -44,15 +48,13 @@ export async function setContent(ctx: Context) {
44
48
  root,
45
49
  contentDir = "",
46
50
  name,
47
- title,
51
+ title: configTitle,
48
52
  description: packageDescription,
49
53
  backstory,
50
54
  redirect,
51
55
  } = ctx;
52
56
 
53
57
  let counterContent = getCounterContent(ctx);
54
- let escapedName = escapeHTML(name);
55
- let escapedTitle = title ? escapeHTML(title) : escapedName;
56
58
  let escapedPackageDescription = escapeHTML(packageDescription);
57
59
 
58
60
  let rootAttrs = "";
@@ -125,8 +127,20 @@ ${getInjectedContent(ctx, "redirect", "body")}
125
127
  return;
126
128
  }
127
129
 
128
- let { description, intro, features, note, installation, sections, nav } =
129
- await getParsedContent(ctx);
130
+ let {
131
+ title,
132
+ description,
133
+ intro,
134
+ features,
135
+ note,
136
+ installation,
137
+ sections,
138
+ nav,
139
+ } = await getParsedContent(ctx);
140
+
141
+ let escapedTitle = configTitle
142
+ ? escapeHTML(configTitle)
143
+ : title || escapeHTML(name);
130
144
 
131
145
  let descriptionContent =
132
146
  tweakTypography(description) ||