@fern-api/generator-cli 0.0.40 → 0.0.42
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 +23 -10
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -12865,6 +12865,7 @@ var StructuredFeatureId = {
|
|
|
12865
12865
|
Streaming: "STREAMING",
|
|
12866
12866
|
Timeouts: "TIMEOUTS",
|
|
12867
12867
|
CustomClient: "CUSTOM_CLIENT",
|
|
12868
|
+
Contributing: "CONTRIBUTING",
|
|
12868
12869
|
_visit: (value, visitor) => {
|
|
12869
12870
|
switch (value) {
|
|
12870
12871
|
case StructuredFeatureId.Authentication:
|
|
@@ -12885,6 +12886,8 @@ var StructuredFeatureId = {
|
|
|
12885
12886
|
return visitor.timeouts();
|
|
12886
12887
|
case StructuredFeatureId.CustomClient:
|
|
12887
12888
|
return visitor.customClient();
|
|
12889
|
+
case StructuredFeatureId.Contributing:
|
|
12890
|
+
return visitor.contributing();
|
|
12888
12891
|
default:
|
|
12889
12892
|
return visitor._other();
|
|
12890
12893
|
}
|
|
@@ -13259,6 +13262,7 @@ var ReadmeGenerator = class {
|
|
|
13259
13262
|
originalReadme;
|
|
13260
13263
|
languageTitle;
|
|
13261
13264
|
organizationPascalCase;
|
|
13265
|
+
apiName;
|
|
13262
13266
|
constructor({
|
|
13263
13267
|
readmeParser,
|
|
13264
13268
|
readmeConfig,
|
|
@@ -13269,6 +13273,7 @@ var ReadmeGenerator = class {
|
|
|
13269
13273
|
this.originalReadme = originalReadme;
|
|
13270
13274
|
this.languageTitle = languageToTitle(this.readmeConfig.language);
|
|
13271
13275
|
this.organizationPascalCase = pascalCase(this.readmeConfig.organization);
|
|
13276
|
+
this.apiName = this.readmeConfig.apiName ?? this.organizationPascalCase;
|
|
13272
13277
|
}
|
|
13273
13278
|
async generateReadme({
|
|
13274
13279
|
output
|
|
@@ -13331,9 +13336,14 @@ var ReadmeGenerator = class {
|
|
|
13331
13336
|
if (advancedFeatureBlock != null) {
|
|
13332
13337
|
blocks.push(advancedFeatureBlock);
|
|
13333
13338
|
}
|
|
13334
|
-
|
|
13339
|
+
if (!this.featureDisabled(api_exports.StructuredFeatureId.Contributing)) {
|
|
13340
|
+
blocks.push(this.generateContributing());
|
|
13341
|
+
}
|
|
13335
13342
|
return blocks;
|
|
13336
13343
|
}
|
|
13344
|
+
featureDisabled(featureId) {
|
|
13345
|
+
return this.readmeConfig.disabledFeatures?.includes(featureId) ?? false;
|
|
13346
|
+
}
|
|
13337
13347
|
isAdvanced(feat) {
|
|
13338
13348
|
if (this.ADVANCED_FEATURES.has(feat.id)) {
|
|
13339
13349
|
return true;
|
|
@@ -13427,9 +13437,7 @@ var ReadmeGenerator = class {
|
|
|
13427
13437
|
}
|
|
13428
13438
|
}
|
|
13429
13439
|
async writeHeader({ writer }) {
|
|
13430
|
-
await writer.writeLine(
|
|
13431
|
-
`# ${this.organizationPascalCase} ${this.languageTitle} Library`
|
|
13432
|
-
);
|
|
13440
|
+
await writer.writeLine(`# ${this.apiName} ${this.languageTitle} Library`);
|
|
13433
13441
|
await writer.writeLine();
|
|
13434
13442
|
if (this.readmeConfig.bannerLink != null) {
|
|
13435
13443
|
await this.writeBanner({
|
|
@@ -13437,7 +13445,9 @@ var ReadmeGenerator = class {
|
|
|
13437
13445
|
bannerLink: this.readmeConfig.bannerLink
|
|
13438
13446
|
});
|
|
13439
13447
|
}
|
|
13440
|
-
|
|
13448
|
+
if (!this.isWhiteLabel()) {
|
|
13449
|
+
await this.writeFernShield({ writer });
|
|
13450
|
+
}
|
|
13441
13451
|
if (this.readmeConfig.language != null) {
|
|
13442
13452
|
await this.writeShield({
|
|
13443
13453
|
writer,
|
|
@@ -13447,6 +13457,9 @@ var ReadmeGenerator = class {
|
|
|
13447
13457
|
await writer.writeLine();
|
|
13448
13458
|
await this.writeIntro({ writer });
|
|
13449
13459
|
}
|
|
13460
|
+
isWhiteLabel() {
|
|
13461
|
+
return this.readmeConfig.whiteLabel ?? false;
|
|
13462
|
+
}
|
|
13450
13463
|
async writeBanner({
|
|
13451
13464
|
writer,
|
|
13452
13465
|
bannerLink
|
|
@@ -13462,7 +13475,7 @@ var ReadmeGenerator = class {
|
|
|
13462
13475
|
}
|
|
13463
13476
|
async writeIntro({ writer }) {
|
|
13464
13477
|
await writer.writeLine(
|
|
13465
|
-
this.readmeConfig.introduction != null ? this.readmeConfig.introduction : `The ${this.
|
|
13478
|
+
this.readmeConfig.introduction != null ? this.readmeConfig.introduction : `The ${this.apiName} ${this.languageTitle} library provides convenient access to the ${this.apiName} APIs from ${this.languageTitle}.`
|
|
13466
13479
|
);
|
|
13467
13480
|
await writer.writeLine();
|
|
13468
13481
|
}
|
|
@@ -13915,9 +13928,9 @@ var ReadmeGenerator = class {
|
|
|
13915
13928
|
async writeShieldForSwiftPackageManager({
|
|
13916
13929
|
writer
|
|
13917
13930
|
}) {
|
|
13918
|
-
await writer.write("
|
|
13919
|
-
await writer.
|
|
13920
|
-
"(https://img.shields.io/badge/SwiftPM-compatible-orange.svg)
|
|
13931
|
+
await writer.write("![SwiftPM compatible]");
|
|
13932
|
+
await writer.writeLine(
|
|
13933
|
+
"(https://img.shields.io/badge/SwiftPM-compatible-orange.svg)"
|
|
13921
13934
|
);
|
|
13922
13935
|
}
|
|
13923
13936
|
generateContributing() {
|
|
@@ -13938,7 +13951,7 @@ On the other hand, contributions to the README are always very welcome!
|
|
|
13938
13951
|
shouldSkipFeature({
|
|
13939
13952
|
feature
|
|
13940
13953
|
}) {
|
|
13941
|
-
return !feature.snippetsAreOptional && (feature.snippets == null || feature.snippets.length === 0);
|
|
13954
|
+
return this.featureDisabled(feature.id) || !feature.snippetsAreOptional && (feature.snippets == null || feature.snippets.length === 0);
|
|
13942
13955
|
}
|
|
13943
13956
|
shouldGenerateFeatures({
|
|
13944
13957
|
features
|