@fern-api/generator-cli 0.0.13-eaaf17704 → 0.0.14-cec22478b

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.
Files changed (2) hide show
  1. package/dist/cli.cjs +31 -27
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -12059,10 +12059,8 @@ var README_FILEPATH = "README.md";
12059
12059
 
12060
12060
  // ../../packages/commons/github/dist/ClonedRepository.js
12061
12061
  var ClonedRepository = class {
12062
- git;
12063
12062
  clonePath;
12064
- constructor({ git, clonePath }) {
12065
- this.git = git;
12063
+ constructor({ clonePath }) {
12066
12064
  this.clonePath = clonePath;
12067
12065
  }
12068
12066
  async getReadme() {
@@ -12136,7 +12134,6 @@ async function cloneRepository({ githubRepository, installationToken }) {
12136
12134
  const git = esm_default2(clonePath);
12137
12135
  await git.clone(cloneUrl, ".");
12138
12136
  return new ClonedRepository({
12139
- git,
12140
12137
  clonePath
12141
12138
  });
12142
12139
  }
@@ -13041,11 +13038,12 @@ var BlockList = class {
13041
13038
 
13042
13039
  // src/readme/ReadmeGenerator.ts
13043
13040
  var ReadmeGenerator = class {
13044
- ADVANCED_FEATURES = [
13041
+ ADVANCED_FEATURE_ID = "ADVANCED";
13042
+ ADVANCED_FEATURES = /* @__PURE__ */ new Set([
13045
13043
  api_exports.StructuredFeatureId.Retries,
13046
13044
  api_exports.StructuredFeatureId.Timeouts,
13047
13045
  api_exports.StructuredFeatureId.CustomClient
13048
- ];
13046
+ ]);
13049
13047
  readmeParser;
13050
13048
  readmeConfig;
13051
13049
  originalReadme;
@@ -13084,8 +13082,8 @@ var ReadmeGenerator = class {
13084
13082
  if (this.readmeConfig.language != null && this.readmeConfig.language.publishInfo != null) {
13085
13083
  blocks.push(this.generateInstallation({ language: this.readmeConfig.language }));
13086
13084
  }
13087
- const coreFeatures = this.readmeConfig.features?.filter((feat) => !this.ADVANCED_FEATURES.includes(feat.id)) ?? [];
13088
- const advancedFeatures = this.readmeConfig.features?.filter((feat) => this.ADVANCED_FEATURES.includes(feat.id)) ?? [];
13085
+ const coreFeatures = this.readmeConfig.features?.filter((feat) => !this.ADVANCED_FEATURES.has(feat.id)) ?? [];
13086
+ const advancedFeatures = this.readmeConfig.features?.filter((feat) => this.ADVANCED_FEATURES.has(feat.id)) ?? [];
13089
13087
  for (const feature of coreFeatures) {
13090
13088
  if (this.shouldSkipFeature({ feature })) {
13091
13089
  continue;
@@ -13096,42 +13094,48 @@ var ReadmeGenerator = class {
13096
13094
  })
13097
13095
  );
13098
13096
  }
13099
- blocks.push(...this.generateNestedFeatureBlocks({ features: advancedFeatures, sectionTitle: "Advanced" }));
13097
+ const advancedFeatureBlock = this.generateNestedFeatureBlock({
13098
+ featureId: this.ADVANCED_FEATURE_ID,
13099
+ features: advancedFeatures
13100
+ });
13101
+ if (advancedFeatureBlock != null) {
13102
+ blocks.push(advancedFeatureBlock);
13103
+ }
13100
13104
  blocks.push(this.generateContributing());
13101
13105
  return blocks;
13102
13106
  }
13103
- generateNestedFeatureBlocks({
13104
- features,
13105
- sectionTitle
13107
+ generateNestedFeatureBlock({
13108
+ featureId,
13109
+ features
13106
13110
  }) {
13107
- if (!this.hasUnskippedFeatures({ features })) {
13108
- return [];
13111
+ if (!this.shouldGenerateFeatures({ features })) {
13112
+ return void 0;
13109
13113
  }
13110
- const blocks = [];
13111
13114
  const writer = new StringWriter();
13112
- writer.writeLine(`## ${sectionTitle}`);
13115
+ writer.writeLine(`## ${featureIDToTitle(featureId)}`);
13113
13116
  writer.writeLine();
13114
13117
  for (const feature of features) {
13115
13118
  if (this.shouldSkipFeature({ feature })) {
13116
13119
  continue;
13117
13120
  }
13118
- blocks.push(
13119
- this.generateFeatureBlock({
13120
- feature,
13121
- heading: "h3",
13122
- maybeWriter: writer
13123
- })
13124
- );
13121
+ this.generateFeatureBlock({
13122
+ feature,
13123
+ heading: "###",
13124
+ maybeWriter: writer
13125
+ });
13125
13126
  }
13126
- return blocks;
13127
+ return new Block({
13128
+ id: featureId,
13129
+ content: writer.toString()
13130
+ });
13127
13131
  }
13128
13132
  generateFeatureBlock({
13129
13133
  feature,
13130
- heading = "h2",
13134
+ heading = "##",
13131
13135
  maybeWriter
13132
13136
  }) {
13133
13137
  const writer = maybeWriter ?? new StringWriter();
13134
- writer.writeLine(`${heading === "h2" ? "##" : "###"} ${featureIDToTitle(feature.id)}`);
13138
+ writer.writeLine(`${heading} ${featureIDToTitle(feature.id)}`);
13135
13139
  writer.writeLine();
13136
13140
  if (feature.description != null) {
13137
13141
  writer.writeLine(feature.description);
@@ -13487,7 +13491,7 @@ On the other hand, contributions to the README are always very welcome!
13487
13491
  shouldSkipFeature({ feature }) {
13488
13492
  return !feature.snippetsAreOptional && (feature.snippets == null || feature.snippets.length === 0);
13489
13493
  }
13490
- hasUnskippedFeatures({ features }) {
13494
+ shouldGenerateFeatures({ features }) {
13491
13495
  return features.some((feature) => !this.shouldSkipFeature({ feature }));
13492
13496
  }
13493
13497
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fern-api/generator-cli",
3
- "version": "0.0.13-eaaf17704",
3
+ "version": "0.0.14-cec22478b",
4
4
  "files": [
5
5
  "dist"
6
6
  ],