@crustjs/man 0.2.0 → 0.3.0

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/README.md CHANGED
@@ -5,7 +5,7 @@ Generate mdoc(7) manual pages from Crust CLI definitions
5
5
  ## Install
6
6
 
7
7
  ```sh
8
- bun add -d @crustjs/man
8
+ npm install -D @crustjs/man
9
9
  ```
10
10
 
11
11
  ## Documentation
package/dist/index.d.ts CHANGED
@@ -6,8 +6,8 @@ interface ManOptions {
6
6
  readonly section?: number;
7
7
  /**
8
8
  * Installed command name used for the page title and filename. Defaults to
9
- * the application name; set it when `crust build --name` or the npm bin key
10
- * installs the CLI under a different name.
9
+ * the application name; set it when the npm bin key installs the CLI under a
10
+ * different name.
11
11
  */
12
12
  readonly name?: string;
13
13
  }
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { dirname, join } from "node:path";
2
1
  import { defineExtension, defineExtensionId } from "@crustjs/core";
3
2
  import { buildCommandDocumentation, formatDescription, sectionsFor } from "@crustjs/core/tooling";
4
3
  import { mkdir, writeFile } from "node:fs/promises";
4
+ import { dirname } from "node:path";
5
5
  //#region \0rolldown/runtime.js
6
6
  var __defProp = Object.defineProperty;
7
7
  var __exportAll = (all, no_symbols) => {
@@ -19,22 +19,23 @@ const MAN = defineExtensionId("crust:man");
19
19
  /** Adds build-time mdoc generation for the application. */
20
20
  const man = defineExtension(MAN, (options = {}) => {
21
21
  const section = options.section ?? 1;
22
- return { async build({ snapshot, outDir }) {
23
- const { writeManPage } = await Promise.resolve().then(() => write_man_page_exports);
22
+ return { async build({ snapshot }) {
23
+ const { renderManPageMdoc } = await Promise.resolve().then(() => mdoc_exports);
24
24
  const name = options.name ?? snapshot.meta.name;
25
25
  if (/[\\/]/.test(name)) throw new Error(`Manual name "${name}" must not contain path separators.`);
26
- const outfile = join("man", `${name}.${section}`);
27
- await writeManPage({
28
- root: snapshot,
29
- name,
30
- section,
31
- outfile: join(outDir, outfile)
32
- });
33
- return [outfile];
26
+ return [{
27
+ path: `man/${name}.${section}`,
28
+ content: renderManPageMdoc({
29
+ root: snapshot,
30
+ name,
31
+ section
32
+ })
33
+ }];
34
34
  } };
35
35
  });
36
36
  //#endregion
37
37
  //#region src/mdoc.ts
38
+ var mdoc_exports = /* @__PURE__ */ __exportAll({ renderManPageMdoc: () => renderManPageMdoc });
38
39
  function escapeMdocBodyLine(line) {
39
40
  return /^[.']/.test(line) ? `\\&${line}` : line;
40
41
  }
@@ -149,7 +150,6 @@ function renderManPageMdoc(options) {
149
150
  }
150
151
  //#endregion
151
152
  //#region src/write-man-page.ts
152
- var write_man_page_exports = /* @__PURE__ */ __exportAll({ writeManPage: () => writeManPage });
153
153
  /** Render an mdoc(7) manual page from a Command Snapshot and write it to `outfile`. */
154
154
  async function writeManPage(options) {
155
155
  const { root, name, outfile, section = 1, date } = options;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crustjs/man",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Generate mdoc(7) manual pages from Crust CLI definitions",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -45,13 +45,13 @@
45
45
  },
46
46
  "devDependencies": {
47
47
  "@crustjs/config": "0.0.0",
48
- "@crustjs/core": "0.2.0",
49
- "@crustjs/extensions": "0.2.0",
50
- "@crustjs/skills": "0.2.0",
48
+ "@crustjs/core": "0.3.0",
49
+ "@crustjs/extensions": "0.3.0",
50
+ "@crustjs/skills": "0.3.0",
51
51
  "tsdown": "^0.23.0"
52
52
  },
53
53
  "peerDependencies": {
54
- "@crustjs/core": "^0.2.0",
54
+ "@crustjs/core": "^0.3.0",
55
55
  "typescript": "^7.0.0"
56
56
  },
57
57
  "peerDependenciesMeta": {
@@ -60,7 +60,7 @@
60
60
  }
61
61
  },
62
62
  "engines": {
63
- "bun": ">=1.3.14",
63
+ "bun": ">=1.4.0",
64
64
  "node": ">=22",
65
65
  "deno": ">=2.8"
66
66
  }