@crustjs/man 0.2.1 → 0.3.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/README.md +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -12
- package/package.json +5 -5
package/README.md
CHANGED
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
|
|
10
|
-
*
|
|
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
|
|
23
|
-
const {
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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.
|
|
3
|
+
"version": "0.3.1",
|
|
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.
|
|
49
|
-
"@crustjs/extensions": "0.
|
|
50
|
-
"@crustjs/skills": "0.
|
|
48
|
+
"@crustjs/core": "0.3.1",
|
|
49
|
+
"@crustjs/extensions": "0.3.1",
|
|
50
|
+
"@crustjs/skills": "0.3.1",
|
|
51
51
|
"tsdown": "^0.23.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@crustjs/core": "^0.
|
|
54
|
+
"@crustjs/core": "^0.3.1",
|
|
55
55
|
"typescript": "^7.0.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|