@fern-api/generator-cli 0.5.0 → 0.5.3
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/bin/cli +2 -0
- package/dist/{api.cjs → api.js} +8 -3
- package/dist/cli.d.ts +2 -0
- package/dist/{cli.cjs → cli.js} +10 -6
- package/package.json +10 -10
- /package/dist/{api.d.cts → api.d.ts} +0 -0
package/bin/cli
ADDED
package/dist/{api.cjs → api.js}
RENAMED
|
@@ -6863,7 +6863,7 @@ var Language = {
|
|
|
6863
6863
|
};
|
|
6864
6864
|
|
|
6865
6865
|
// src/utils/Writer.ts
|
|
6866
|
-
var import_fs = __toESM(require("fs")
|
|
6866
|
+
var import_fs = __toESM(require("fs"));
|
|
6867
6867
|
var Writer = class {
|
|
6868
6868
|
async writeCodeBlock(language, content) {
|
|
6869
6869
|
await this.writeLine(`\`\`\`${language}`);
|
|
@@ -8071,7 +8071,8 @@ ${this.generateIndentedBlock(
|
|
|
8071
8071
|
generateParameter(parameter) {
|
|
8072
8072
|
const desc = parameter.description?.match(/[^\r\n]+/g)?.length;
|
|
8073
8073
|
const containsLineBreak = desc != null && desc > 1;
|
|
8074
|
-
|
|
8074
|
+
const typeText = parameter.location != null ? `[${parameter.type}](${parameter.location.path})` : `\`${parameter.type}\``;
|
|
8075
|
+
return `**${parameter.name}:** ${typeText} ${parameter.description != null ? (containsLineBreak ? "\n\n" : "\u2014 ") + parameter.description : ""}
|
|
8075
8076
|
`;
|
|
8076
8077
|
}
|
|
8077
8078
|
generateIndentedBlock(content) {
|
|
@@ -8086,7 +8087,11 @@ ${content}
|
|
|
8086
8087
|
return content.map(({ text, location }) => this.wrapInLink(text, location)).join("");
|
|
8087
8088
|
}
|
|
8088
8089
|
wrapInLink(content, link) {
|
|
8089
|
-
|
|
8090
|
+
const encodedContent = this.htmlEncode(content);
|
|
8091
|
+
return link != null ? `<a href="${link.path}">${encodedContent}</a>` : encodedContent;
|
|
8092
|
+
}
|
|
8093
|
+
htmlEncode(content) {
|
|
8094
|
+
return content.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
8090
8095
|
}
|
|
8091
8096
|
};
|
|
8092
8097
|
|
package/dist/cli.d.ts
ADDED
package/dist/{cli.cjs → cli.js}
RENAMED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
"use strict";
|
|
3
2
|
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
@@ -6066,9 +6065,9 @@ function resolve(...paths) {
|
|
|
6066
6065
|
}
|
|
6067
6066
|
|
|
6068
6067
|
// src/cli.ts
|
|
6069
|
-
var import_fs6 = __toESM(require("fs")
|
|
6068
|
+
var import_fs6 = __toESM(require("fs"));
|
|
6070
6069
|
var import_promises6 = require("fs/promises");
|
|
6071
|
-
var import_path7 = __toESM(require("path")
|
|
6070
|
+
var import_path7 = __toESM(require("path"));
|
|
6072
6071
|
|
|
6073
6072
|
// ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/build/lib/yerror.js
|
|
6074
6073
|
var YError = class _YError extends Error {
|
|
@@ -13002,7 +13001,7 @@ var Language = {
|
|
|
13002
13001
|
};
|
|
13003
13002
|
|
|
13004
13003
|
// src/utils/Writer.ts
|
|
13005
|
-
var import_fs5 = __toESM(require("fs")
|
|
13004
|
+
var import_fs5 = __toESM(require("fs"));
|
|
13006
13005
|
var Writer = class {
|
|
13007
13006
|
async writeCodeBlock(language, content) {
|
|
13008
13007
|
await this.writeLine(`\`\`\`${language}`);
|
|
@@ -14190,7 +14189,8 @@ ${this.generateIndentedBlock(
|
|
|
14190
14189
|
generateParameter(parameter) {
|
|
14191
14190
|
const desc = parameter.description?.match(/[^\r\n]+/g)?.length;
|
|
14192
14191
|
const containsLineBreak = desc != null && desc > 1;
|
|
14193
|
-
|
|
14192
|
+
const typeText = parameter.location != null ? `[${parameter.type}](${parameter.location.path})` : `\`${parameter.type}\``;
|
|
14193
|
+
return `**${parameter.name}:** ${typeText} ${parameter.description != null ? (containsLineBreak ? "\n\n" : "\u2014 ") + parameter.description : ""}
|
|
14194
14194
|
`;
|
|
14195
14195
|
}
|
|
14196
14196
|
generateIndentedBlock(content) {
|
|
@@ -14205,7 +14205,11 @@ ${content}
|
|
|
14205
14205
|
return content.map(({ text, location }) => this.wrapInLink(text, location)).join("");
|
|
14206
14206
|
}
|
|
14207
14207
|
wrapInLink(content, link) {
|
|
14208
|
-
|
|
14208
|
+
const encodedContent = this.htmlEncode(content);
|
|
14209
|
+
return link != null ? `<a href="${link.path}">${encodedContent}</a>` : encodedContent;
|
|
14210
|
+
}
|
|
14211
|
+
htmlEncode(content) {
|
|
14212
|
+
return content.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
14209
14213
|
}
|
|
14210
14214
|
};
|
|
14211
14215
|
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fern-api/generator-cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
|
-
"url": "https://github.com/fern-api/fern"
|
|
6
|
+
"url": "git+https://github.com/fern-api/fern.git",
|
|
7
|
+
"directory": "packages/generator-cli"
|
|
7
8
|
},
|
|
8
|
-
"type": "
|
|
9
|
-
"main": "dist/api.
|
|
9
|
+
"type": "commonjs",
|
|
10
|
+
"main": "dist/api.js",
|
|
10
11
|
"source": "src/index.ts",
|
|
11
|
-
"types": "dist/api.d.
|
|
12
|
+
"types": "dist/api.d.ts",
|
|
12
13
|
"bin": {
|
|
13
|
-
"generator-cli": "
|
|
14
|
+
"generator-cli": "bin/cli"
|
|
14
15
|
},
|
|
15
|
-
"files": ["dist"],
|
|
16
|
+
"files": ["bin", "dist"],
|
|
16
17
|
"scripts": {
|
|
17
|
-
"clean": "rm -rf ./dist && tsc --build --clean",
|
|
18
|
-
"compile": "tsup && pnpm compile:api:dts && echo '#!/usr/bin/env node' | cat - dist/cli.cjs > dist/tmp && mv dist/tmp dist/cli.cjs",
|
|
19
|
-
"compile:api:dts": "tsup ./src/api.ts --format cjs --dts --dts-only",
|
|
18
|
+
"clean": "rm -rf ./lib && rm -rf ./dist && tsc --build --clean",
|
|
20
19
|
"depcheck": "depcheck",
|
|
20
|
+
"dist:cli": "node build.mjs",
|
|
21
21
|
"test": "vitest --run --passWithNoTests --globals --disable-console-intercept",
|
|
22
22
|
"test:update": "vitest -u --run --passWithNoTests --globals --disable-console-intercept"
|
|
23
23
|
},
|
|
File without changes
|