@fern-api/generator-cli 0.0.10-41618efd4 → 0.0.12-7cbcf4cc7
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.cjs +24 -8
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -13316,21 +13316,35 @@ var ReferenceGenerator = class {
|
|
|
13316
13316
|
}
|
|
13317
13317
|
async generate({ output }) {
|
|
13318
13318
|
const writer = new StreamWriter(output);
|
|
13319
|
+
writer.writeLine("# Reference");
|
|
13320
|
+
if (this.referenceConfig.rootSection != null) {
|
|
13321
|
+
this.writeRootSection({ section: this.referenceConfig.rootSection, writer });
|
|
13322
|
+
}
|
|
13319
13323
|
for (const section of this.referenceConfig.sections) {
|
|
13320
13324
|
this.writeSection({ section, writer });
|
|
13321
13325
|
}
|
|
13322
13326
|
writer.end();
|
|
13323
13327
|
}
|
|
13328
|
+
writeRootSection({ section, writer }) {
|
|
13329
|
+
if (section.description != null) {
|
|
13330
|
+
writer.writeLine(`${section.description}`);
|
|
13331
|
+
}
|
|
13332
|
+
for (const endpoint of section.endpoints) {
|
|
13333
|
+
this.writeEndpoint({ endpoint, writer });
|
|
13334
|
+
}
|
|
13335
|
+
}
|
|
13324
13336
|
writeSection({ section, writer }) {
|
|
13325
13337
|
writer.writeLine(`## ${section.title}`);
|
|
13326
|
-
|
|
13338
|
+
if (section.description != null) {
|
|
13339
|
+
writer.writeLine(`${section.description}`);
|
|
13340
|
+
}
|
|
13327
13341
|
for (const endpoint of section.endpoints) {
|
|
13328
13342
|
this.writeEndpoint({ endpoint, writer });
|
|
13329
13343
|
}
|
|
13330
13344
|
}
|
|
13331
13345
|
writeEndpoint({ endpoint, writer }) {
|
|
13332
13346
|
const stringWriter = new StringWriter();
|
|
13333
|
-
if (endpoint.description
|
|
13347
|
+
if (endpoint.description != null) {
|
|
13334
13348
|
stringWriter.writeLine(
|
|
13335
13349
|
`#### \u{1F4DD} Description
|
|
13336
13350
|
|
|
@@ -13358,16 +13372,18 @@ ${this.writeIndentedBlock(
|
|
|
13358
13372
|
`
|
|
13359
13373
|
);
|
|
13360
13374
|
}
|
|
13361
|
-
|
|
13362
|
-
|
|
13363
|
-
|
|
13375
|
+
let linkedSnippet = this.wrapInLinksAndJoin(endpoint.title.snippetParts);
|
|
13376
|
+
if (endpoint.title.returnValue != null) {
|
|
13377
|
+
linkedSnippet += ` -> ${this.wrapInLink(endpoint.title.returnValue.text, endpoint.title.returnValue.location)}`;
|
|
13378
|
+
}
|
|
13379
|
+
writer.writeLine(`<details><summary><code>${linkedSnippet}</code></summary>`);
|
|
13364
13380
|
writer.writeLine(this.writeIndentedBlock(stringWriter.toString()));
|
|
13365
13381
|
writer.writeLine("</details>\n");
|
|
13366
13382
|
}
|
|
13367
13383
|
writeParameter(parameter) {
|
|
13368
13384
|
const desc = parameter.description?.match(/[^\r\n]+/g)?.length;
|
|
13369
|
-
const containsLineBreak = desc
|
|
13370
|
-
return `**${parameter.name}:** \`${this.wrapInLink(parameter.type, parameter.location)}\` ${parameter.description
|
|
13385
|
+
const containsLineBreak = desc != null && desc > 1;
|
|
13386
|
+
return `**${parameter.name}:** \`${this.wrapInLink(parameter.type, parameter.location)}\` ${parameter.description != null ? (containsLineBreak ? "\n\n" : "\u2014 ") + parameter.description : ""}
|
|
13371
13387
|
`;
|
|
13372
13388
|
}
|
|
13373
13389
|
writeIndentedBlock(content) {
|
|
@@ -13382,7 +13398,7 @@ ${content}
|
|
|
13382
13398
|
return content.map(({ text, location }) => this.wrapInLink(text, location)).join("");
|
|
13383
13399
|
}
|
|
13384
13400
|
wrapInLink(content, link) {
|
|
13385
|
-
return link
|
|
13401
|
+
return link != null ? `<a href="${link.path}">${content}</a>` : content;
|
|
13386
13402
|
}
|
|
13387
13403
|
};
|
|
13388
13404
|
|