@fern-api/generator-cli 0.4.4-rc0 → 0.4.5

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 (3) hide show
  1. package/dist/api.cjs +80 -48
  2. package/dist/cli.cjs +80 -48
  3. package/package.json +6 -6
package/dist/api.cjs CHANGED
@@ -1520,6 +1520,10 @@ module.exports = __toCommonJS(api_exports2);
1520
1520
  // src/api/generate-readme.ts
1521
1521
  var import_node_stream = require("stream");
1522
1522
 
1523
+ // ../commons/github/lib/ClonedRepository.js
1524
+ var import_promises = require("fs/promises");
1525
+ var import_path = __toESM(require("path"), 1);
1526
+
1523
1527
  // ../../node_modules/.pnpm/simple-git@3.30.0/node_modules/simple-git/dist/esm/index.js
1524
1528
  var import_node_buffer = require("buffer");
1525
1529
  var import_file_exists = __toESM(require_dist(), 1);
@@ -6065,15 +6069,9 @@ function gitInstanceFactory(baseDir, options) {
6065
6069
  return new Git(config, plugins);
6066
6070
  }
6067
6071
  init_git_response_error();
6072
+ var simpleGit = gitInstanceFactory;
6068
6073
  var esm_default = gitInstanceFactory;
6069
6074
 
6070
- // ../commons/github/lib/cloneRepository.js
6071
- var import_tmp_promise = __toESM(require_tmp_promise(), 1);
6072
-
6073
- // ../commons/github/lib/ClonedRepository.js
6074
- var import_promises = require("fs/promises");
6075
- var import_path = __toESM(require("path"), 1);
6076
-
6077
6075
  // ../commons/github/lib/constants.js
6078
6076
  var DEFAULT_REMOTE = "github.com";
6079
6077
  var README_FILEPATH = "README.md";
@@ -6083,13 +6081,19 @@ var GIT_DIR = ".git";
6083
6081
 
6084
6082
  // ../commons/github/lib/ClonedRepository.js
6085
6083
  var DEFAULT_IGNORED_FILES = [FERNIGNORE, GITIGNORE, GIT_DIR];
6086
- var ClonedRepository = class {
6084
+ var ClonedRepository = class _ClonedRepository {
6087
6085
  clonePath;
6088
6086
  git;
6089
6087
  constructor({ clonePath, git }) {
6090
6088
  this.clonePath = clonePath;
6091
6089
  this.git = git;
6092
6090
  }
6091
+ static createAtPath(clonePath) {
6092
+ return new _ClonedRepository({
6093
+ clonePath,
6094
+ git: simpleGit(clonePath)
6095
+ });
6096
+ }
6093
6097
  async getDefaultBranch() {
6094
6098
  await this.git.cwd(this.clonePath);
6095
6099
  const remoteInfo = await this.git.remote(["show", "origin"]);
@@ -6102,6 +6106,11 @@ var ClonedRepository = class {
6102
6106
  }
6103
6107
  return match[1].trim();
6104
6108
  }
6109
+ async getCurrentBranch() {
6110
+ await this.git.cwd(this.clonePath);
6111
+ const branch = await this.git.branchLocal();
6112
+ return branch.current;
6113
+ }
6105
6114
  async getReadme() {
6106
6115
  return await this.readFile({ relativeFilePath: README_FILEPATH });
6107
6116
  }
@@ -6129,6 +6138,11 @@ var ClonedRepository = class {
6129
6138
  "--allow-empty": null
6130
6139
  });
6131
6140
  }
6141
+ async commitAllChanges(message) {
6142
+ await this.git.cwd(this.clonePath);
6143
+ await this.git.add(".");
6144
+ await this.commit(message);
6145
+ }
6132
6146
  async checkout(branch) {
6133
6147
  await this.git.cwd(this.clonePath);
6134
6148
  try {
@@ -6200,6 +6214,9 @@ async function doesPathExist(filepath) {
6200
6214
  }
6201
6215
  }
6202
6216
 
6217
+ // ../commons/github/lib/cloneRepository.js
6218
+ var import_tmp_promise = __toESM(require_tmp_promise(), 1);
6219
+
6203
6220
  // ../commons/github/lib/parseRepository.js
6204
6221
  function parseRepository(githubRepository) {
6205
6222
  let remote = DEFAULT_REMOTE;
@@ -6243,12 +6260,16 @@ function getCloneUrl({ remote, owner, repo }) {
6243
6260
  }
6244
6261
 
6245
6262
  // ../commons/github/lib/cloneRepository.js
6246
- async function cloneRepository({ githubRepository, installationToken }) {
6263
+ async function cloneRepository({ githubRepository, installationToken, targetDirectory, timeoutMs }) {
6247
6264
  const repositoryReference = parseRepository(githubRepository);
6248
6265
  const cloneUrl = installationToken != null ? repositoryReference.getAuthedCloneUrl(installationToken) : repositoryReference.cloneUrl;
6249
- const dir = await import_tmp_promise.default.dir();
6250
- const clonePath = dir.path;
6251
- const git = esm_default(clonePath);
6266
+ const clonePath = targetDirectory ?? (await import_tmp_promise.default.dir()).path;
6267
+ const git = esm_default(clonePath, {
6268
+ timeout: timeoutMs != null ? {
6269
+ block: timeoutMs
6270
+ // Kill the process if no data is received for the specified time
6271
+ } : void 0
6272
+ });
6252
6273
  await git.clone(cloneUrl, ".");
6253
6274
  return new ClonedRepository({
6254
6275
  clonePath,
@@ -6256,27 +6277,45 @@ async function cloneRepository({ githubRepository, installationToken }) {
6256
6277
  });
6257
6278
  }
6258
6279
 
6259
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/predicate/isLength.mjs
6280
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/predicate/isLength.mjs
6260
6281
  function isLength(value) {
6261
6282
  return Number.isSafeInteger(value) && value >= 0;
6262
6283
  }
6263
6284
 
6264
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.mjs
6285
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.mjs
6265
6286
  function isArrayLike2(value) {
6266
6287
  return value != null && typeof value !== "function" && isLength(value.length);
6267
6288
  }
6268
6289
 
6269
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/predicate/isObject.mjs
6290
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/compat/util/toString.mjs
6291
+ function toString(value) {
6292
+ if (value == null) {
6293
+ return "";
6294
+ }
6295
+ if (typeof value === "string") {
6296
+ return value;
6297
+ }
6298
+ if (Array.isArray(value)) {
6299
+ return value.map(toString).join(",");
6300
+ }
6301
+ const result = String(value);
6302
+ if (result === "0" && Object.is(Number(value), -0)) {
6303
+ return "-0";
6304
+ }
6305
+ return result;
6306
+ }
6307
+
6308
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/compat/predicate/isObject.mjs
6270
6309
  function isObject(value) {
6271
6310
  return value !== null && (typeof value === "object" || typeof value === "function");
6272
6311
  }
6273
6312
 
6274
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/util/eq.mjs
6313
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/compat/util/eq.mjs
6275
6314
  function eq(value, other) {
6276
6315
  return value === other || Number.isNaN(value) && Number.isNaN(other);
6277
6316
  }
6278
6317
 
6279
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/_internal/isIndex.mjs
6318
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/compat/_internal/isIndex.mjs
6280
6319
  var IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\d*)$/;
6281
6320
  function isIndex(value, length = Number.MAX_SAFE_INTEGER) {
6282
6321
  switch (typeof value) {
@@ -6292,7 +6331,7 @@ function isIndex(value, length = Number.MAX_SAFE_INTEGER) {
6292
6331
  }
6293
6332
  }
6294
6333
 
6295
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/_internal/isIterateeCall.mjs
6334
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/compat/_internal/isIterateeCall.mjs
6296
6335
  function isIterateeCall(value, index, object) {
6297
6336
  if (!isObject(object)) {
6298
6337
  return false;
@@ -6303,7 +6342,12 @@ function isIterateeCall(value, index, object) {
6303
6342
  return false;
6304
6343
  }
6305
6344
 
6306
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/function/attempt.mjs
6345
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/predicate/isNil.mjs
6346
+ function isNil(x) {
6347
+ return x == null;
6348
+ }
6349
+
6350
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/compat/function/attempt.mjs
6307
6351
  function attempt(func, ...args) {
6308
6352
  try {
6309
6353
  return func(...args);
@@ -6312,25 +6356,7 @@ function attempt(func, ...args) {
6312
6356
  }
6313
6357
  }
6314
6358
 
6315
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/util/toString.mjs
6316
- function toString(value) {
6317
- if (value == null) {
6318
- return "";
6319
- }
6320
- if (typeof value === "string") {
6321
- return value;
6322
- }
6323
- if (Array.isArray(value)) {
6324
- return value.map(toString).join(",");
6325
- }
6326
- const result = String(value);
6327
- if (result === "0" && Object.is(Number(value), -0)) {
6328
- return "-0";
6329
- }
6330
- return result;
6331
- }
6332
-
6333
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/object/defaults.mjs
6359
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/compat/object/defaults.mjs
6334
6360
  function defaults(object, ...sources) {
6335
6361
  object = Object(object);
6336
6362
  const objectProto = Object.prototype;
@@ -6340,6 +6366,9 @@ function defaults(object, ...sources) {
6340
6366
  length = 1;
6341
6367
  }
6342
6368
  for (let i = 0; i < length; i++) {
6369
+ if (isNil(sources[i])) {
6370
+ continue;
6371
+ }
6343
6372
  const source = sources[i];
6344
6373
  const keys = Object.keys(source);
6345
6374
  for (let j = 0; j < keys.length; j++) {
@@ -6353,18 +6382,18 @@ function defaults(object, ...sources) {
6353
6382
  return object;
6354
6383
  }
6355
6384
 
6356
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/string/capitalize.mjs
6385
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/string/capitalize.mjs
6357
6386
  function capitalize(str) {
6358
6387
  return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
6359
6388
  }
6360
6389
 
6361
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/string/words.mjs
6390
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/string/words.mjs
6362
6391
  var CASE_SPLIT_PATTERN = /\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;
6363
6392
  function words(str) {
6364
6393
  return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);
6365
6394
  }
6366
6395
 
6367
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/string/camelCase.mjs
6396
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/string/camelCase.mjs
6368
6397
  function camelCase(str) {
6369
6398
  const words$1 = words(str);
6370
6399
  if (words$1.length === 0) {
@@ -6374,7 +6403,7 @@ function camelCase(str) {
6374
6403
  return `${first2.toLowerCase()}${rest.map((word) => capitalize(word)).join("")}`;
6375
6404
  }
6376
6405
 
6377
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/string/escape.mjs
6406
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/string/escape.mjs
6378
6407
  var htmlEscapes = {
6379
6408
  "&": "&amp;",
6380
6409
  "<": "&lt;",
@@ -6386,18 +6415,18 @@ function escape(str) {
6386
6415
  return str.replace(/[&<>"']/g, (match) => htmlEscapes[match]);
6387
6416
  }
6388
6417
 
6389
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/string/escape.mjs
6418
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/compat/string/escape.mjs
6390
6419
  function escape2(string) {
6391
6420
  return escape(toString(string));
6392
6421
  }
6393
6422
 
6394
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/string/snakeCase.mjs
6423
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/string/snakeCase.mjs
6395
6424
  function snakeCase(str) {
6396
6425
  const words$1 = words(str);
6397
6426
  return words$1.map((word) => word.toLowerCase()).join("_");
6398
6427
  }
6399
6428
 
6400
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/string/template.mjs
6429
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/compat/string/template.mjs
6401
6430
  var esTemplateRegExp = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
6402
6431
  var unEscapedRegExp = /['\n\r\u2028\u2029\\]/g;
6403
6432
  var noMatchExp = /($^)/;
@@ -6482,7 +6511,7 @@ ${source}
6482
6511
  return result;
6483
6512
  }
6484
6513
 
6485
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/string/upperFirst.mjs
6514
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/string/upperFirst.mjs
6486
6515
  function upperFirst(str) {
6487
6516
  return str.substring(0, 1).toUpperCase() + str.substring(1);
6488
6517
  }
@@ -7771,7 +7800,7 @@ var ReadmeParser = class {
7771
7800
  for (const line of lines) {
7772
7801
  const h2Match = line.match(/^##\s+(.*)/);
7773
7802
  if (h2Match) {
7774
- if (currentBlock) {
7803
+ if (currentBlock && !this.isTableOfContentsBlock(currentBlock.id)) {
7775
7804
  blocks.push(currentBlock);
7776
7805
  }
7777
7806
  currentBlock = new Block({
@@ -7786,7 +7815,7 @@ var ReadmeParser = class {
7786
7815
  currentBlock.content += `${line}
7787
7816
  `;
7788
7817
  }
7789
- if (currentBlock) {
7818
+ if (currentBlock && !this.isTableOfContentsBlock(currentBlock.id)) {
7790
7819
  blocks.push(currentBlock);
7791
7820
  }
7792
7821
  return {
@@ -7794,6 +7823,9 @@ var ReadmeParser = class {
7794
7823
  blocks
7795
7824
  };
7796
7825
  }
7826
+ isTableOfContentsBlock(blockId) {
7827
+ return blockId === "TABLE_OF_CONTENTS" || blockId === "CONTENTS";
7828
+ }
7797
7829
  };
7798
7830
  function sectionNameToID(sectionName) {
7799
7831
  return snakeCase(
package/dist/cli.cjs CHANGED
@@ -7659,6 +7659,10 @@ var yargs_default = Yargs;
7659
7659
  // src/api/generate-readme.ts
7660
7660
  var import_node_stream = require("stream");
7661
7661
 
7662
+ // ../commons/github/lib/ClonedRepository.js
7663
+ var import_promises2 = require("fs/promises");
7664
+ var import_path6 = __toESM(require("path"), 1);
7665
+
7662
7666
  // ../../node_modules/.pnpm/simple-git@3.30.0/node_modules/simple-git/dist/esm/index.js
7663
7667
  var import_node_buffer = require("buffer");
7664
7668
  var import_file_exists = __toESM(require_dist(), 1);
@@ -12204,15 +12208,9 @@ function gitInstanceFactory(baseDir, options) {
12204
12208
  return new Git(config, plugins);
12205
12209
  }
12206
12210
  init_git_response_error();
12211
+ var simpleGit = gitInstanceFactory;
12207
12212
  var esm_default2 = gitInstanceFactory;
12208
12213
 
12209
- // ../commons/github/lib/cloneRepository.js
12210
- var import_tmp_promise = __toESM(require_tmp_promise(), 1);
12211
-
12212
- // ../commons/github/lib/ClonedRepository.js
12213
- var import_promises2 = require("fs/promises");
12214
- var import_path6 = __toESM(require("path"), 1);
12215
-
12216
12214
  // ../commons/github/lib/constants.js
12217
12215
  var DEFAULT_REMOTE = "github.com";
12218
12216
  var README_FILEPATH = "README.md";
@@ -12222,13 +12220,19 @@ var GIT_DIR = ".git";
12222
12220
 
12223
12221
  // ../commons/github/lib/ClonedRepository.js
12224
12222
  var DEFAULT_IGNORED_FILES = [FERNIGNORE, GITIGNORE, GIT_DIR];
12225
- var ClonedRepository = class {
12223
+ var ClonedRepository = class _ClonedRepository {
12226
12224
  clonePath;
12227
12225
  git;
12228
12226
  constructor({ clonePath, git }) {
12229
12227
  this.clonePath = clonePath;
12230
12228
  this.git = git;
12231
12229
  }
12230
+ static createAtPath(clonePath) {
12231
+ return new _ClonedRepository({
12232
+ clonePath,
12233
+ git: simpleGit(clonePath)
12234
+ });
12235
+ }
12232
12236
  async getDefaultBranch() {
12233
12237
  await this.git.cwd(this.clonePath);
12234
12238
  const remoteInfo = await this.git.remote(["show", "origin"]);
@@ -12241,6 +12245,11 @@ var ClonedRepository = class {
12241
12245
  }
12242
12246
  return match[1].trim();
12243
12247
  }
12248
+ async getCurrentBranch() {
12249
+ await this.git.cwd(this.clonePath);
12250
+ const branch = await this.git.branchLocal();
12251
+ return branch.current;
12252
+ }
12244
12253
  async getReadme() {
12245
12254
  return await this.readFile({ relativeFilePath: README_FILEPATH });
12246
12255
  }
@@ -12268,6 +12277,11 @@ var ClonedRepository = class {
12268
12277
  "--allow-empty": null
12269
12278
  });
12270
12279
  }
12280
+ async commitAllChanges(message) {
12281
+ await this.git.cwd(this.clonePath);
12282
+ await this.git.add(".");
12283
+ await this.commit(message);
12284
+ }
12271
12285
  async checkout(branch) {
12272
12286
  await this.git.cwd(this.clonePath);
12273
12287
  try {
@@ -12339,6 +12353,9 @@ async function doesPathExist2(filepath) {
12339
12353
  }
12340
12354
  }
12341
12355
 
12356
+ // ../commons/github/lib/cloneRepository.js
12357
+ var import_tmp_promise = __toESM(require_tmp_promise(), 1);
12358
+
12342
12359
  // ../commons/github/lib/parseRepository.js
12343
12360
  function parseRepository(githubRepository) {
12344
12361
  let remote = DEFAULT_REMOTE;
@@ -12382,12 +12399,16 @@ function getCloneUrl({ remote, owner, repo }) {
12382
12399
  }
12383
12400
 
12384
12401
  // ../commons/github/lib/cloneRepository.js
12385
- async function cloneRepository({ githubRepository, installationToken }) {
12402
+ async function cloneRepository({ githubRepository, installationToken, targetDirectory, timeoutMs }) {
12386
12403
  const repositoryReference = parseRepository(githubRepository);
12387
12404
  const cloneUrl = installationToken != null ? repositoryReference.getAuthedCloneUrl(installationToken) : repositoryReference.cloneUrl;
12388
- const dir = await import_tmp_promise.default.dir();
12389
- const clonePath = dir.path;
12390
- const git = esm_default2(clonePath);
12405
+ const clonePath = targetDirectory ?? (await import_tmp_promise.default.dir()).path;
12406
+ const git = esm_default2(clonePath, {
12407
+ timeout: timeoutMs != null ? {
12408
+ block: timeoutMs
12409
+ // Kill the process if no data is received for the specified time
12410
+ } : void 0
12411
+ });
12391
12412
  await git.clone(cloneUrl, ".");
12392
12413
  return new ClonedRepository({
12393
12414
  clonePath,
@@ -12395,27 +12416,45 @@ async function cloneRepository({ githubRepository, installationToken }) {
12395
12416
  });
12396
12417
  }
12397
12418
 
12398
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/predicate/isLength.mjs
12419
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/predicate/isLength.mjs
12399
12420
  function isLength(value) {
12400
12421
  return Number.isSafeInteger(value) && value >= 0;
12401
12422
  }
12402
12423
 
12403
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.mjs
12424
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.mjs
12404
12425
  function isArrayLike2(value) {
12405
12426
  return value != null && typeof value !== "function" && isLength(value.length);
12406
12427
  }
12407
12428
 
12408
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/predicate/isObject.mjs
12429
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/compat/util/toString.mjs
12430
+ function toString(value) {
12431
+ if (value == null) {
12432
+ return "";
12433
+ }
12434
+ if (typeof value === "string") {
12435
+ return value;
12436
+ }
12437
+ if (Array.isArray(value)) {
12438
+ return value.map(toString).join(",");
12439
+ }
12440
+ const result = String(value);
12441
+ if (result === "0" && Object.is(Number(value), -0)) {
12442
+ return "-0";
12443
+ }
12444
+ return result;
12445
+ }
12446
+
12447
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/compat/predicate/isObject.mjs
12409
12448
  function isObject(value) {
12410
12449
  return value !== null && (typeof value === "object" || typeof value === "function");
12411
12450
  }
12412
12451
 
12413
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/util/eq.mjs
12452
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/compat/util/eq.mjs
12414
12453
  function eq(value, other) {
12415
12454
  return value === other || Number.isNaN(value) && Number.isNaN(other);
12416
12455
  }
12417
12456
 
12418
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/_internal/isIndex.mjs
12457
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/compat/_internal/isIndex.mjs
12419
12458
  var IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\d*)$/;
12420
12459
  function isIndex(value, length = Number.MAX_SAFE_INTEGER) {
12421
12460
  switch (typeof value) {
@@ -12431,7 +12470,7 @@ function isIndex(value, length = Number.MAX_SAFE_INTEGER) {
12431
12470
  }
12432
12471
  }
12433
12472
 
12434
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/_internal/isIterateeCall.mjs
12473
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/compat/_internal/isIterateeCall.mjs
12435
12474
  function isIterateeCall(value, index, object) {
12436
12475
  if (!isObject(object)) {
12437
12476
  return false;
@@ -12442,7 +12481,12 @@ function isIterateeCall(value, index, object) {
12442
12481
  return false;
12443
12482
  }
12444
12483
 
12445
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/function/attempt.mjs
12484
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/predicate/isNil.mjs
12485
+ function isNil(x) {
12486
+ return x == null;
12487
+ }
12488
+
12489
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/compat/function/attempt.mjs
12446
12490
  function attempt(func, ...args) {
12447
12491
  try {
12448
12492
  return func(...args);
@@ -12451,25 +12495,7 @@ function attempt(func, ...args) {
12451
12495
  }
12452
12496
  }
12453
12497
 
12454
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/util/toString.mjs
12455
- function toString(value) {
12456
- if (value == null) {
12457
- return "";
12458
- }
12459
- if (typeof value === "string") {
12460
- return value;
12461
- }
12462
- if (Array.isArray(value)) {
12463
- return value.map(toString).join(",");
12464
- }
12465
- const result = String(value);
12466
- if (result === "0" && Object.is(Number(value), -0)) {
12467
- return "-0";
12468
- }
12469
- return result;
12470
- }
12471
-
12472
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/object/defaults.mjs
12498
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/compat/object/defaults.mjs
12473
12499
  function defaults(object, ...sources) {
12474
12500
  object = Object(object);
12475
12501
  const objectProto = Object.prototype;
@@ -12479,6 +12505,9 @@ function defaults(object, ...sources) {
12479
12505
  length = 1;
12480
12506
  }
12481
12507
  for (let i = 0; i < length; i++) {
12508
+ if (isNil(sources[i])) {
12509
+ continue;
12510
+ }
12482
12511
  const source = sources[i];
12483
12512
  const keys = Object.keys(source);
12484
12513
  for (let j = 0; j < keys.length; j++) {
@@ -12492,18 +12521,18 @@ function defaults(object, ...sources) {
12492
12521
  return object;
12493
12522
  }
12494
12523
 
12495
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/string/capitalize.mjs
12524
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/string/capitalize.mjs
12496
12525
  function capitalize(str) {
12497
12526
  return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
12498
12527
  }
12499
12528
 
12500
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/string/words.mjs
12529
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/string/words.mjs
12501
12530
  var CASE_SPLIT_PATTERN = /\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;
12502
12531
  function words(str) {
12503
12532
  return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);
12504
12533
  }
12505
12534
 
12506
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/string/camelCase.mjs
12535
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/string/camelCase.mjs
12507
12536
  function camelCase2(str) {
12508
12537
  const words$1 = words(str);
12509
12538
  if (words$1.length === 0) {
@@ -12513,7 +12542,7 @@ function camelCase2(str) {
12513
12542
  return `${first2.toLowerCase()}${rest.map((word) => capitalize(word)).join("")}`;
12514
12543
  }
12515
12544
 
12516
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/string/escape.mjs
12545
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/string/escape.mjs
12517
12546
  var htmlEscapes = {
12518
12547
  "&": "&amp;",
12519
12548
  "<": "&lt;",
@@ -12525,18 +12554,18 @@ function escape(str) {
12525
12554
  return str.replace(/[&<>"']/g, (match) => htmlEscapes[match]);
12526
12555
  }
12527
12556
 
12528
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/string/escape.mjs
12557
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/compat/string/escape.mjs
12529
12558
  function escape2(string) {
12530
12559
  return escape(toString(string));
12531
12560
  }
12532
12561
 
12533
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/string/snakeCase.mjs
12562
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/string/snakeCase.mjs
12534
12563
  function snakeCase(str) {
12535
12564
  const words$1 = words(str);
12536
12565
  return words$1.map((word) => word.toLowerCase()).join("_");
12537
12566
  }
12538
12567
 
12539
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/string/template.mjs
12568
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/compat/string/template.mjs
12540
12569
  var esTemplateRegExp = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
12541
12570
  var unEscapedRegExp = /['\n\r\u2028\u2029\\]/g;
12542
12571
  var noMatchExp = /($^)/;
@@ -12621,7 +12650,7 @@ ${source}
12621
12650
  return result;
12622
12651
  }
12623
12652
 
12624
- // ../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/string/upperFirst.mjs
12653
+ // ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/string/upperFirst.mjs
12625
12654
  function upperFirst(str) {
12626
12655
  return str.substring(0, 1).toUpperCase() + str.substring(1);
12627
12656
  }
@@ -13910,7 +13939,7 @@ var ReadmeParser = class {
13910
13939
  for (const line of lines) {
13911
13940
  const h2Match = line.match(/^##\s+(.*)/);
13912
13941
  if (h2Match) {
13913
- if (currentBlock) {
13942
+ if (currentBlock && !this.isTableOfContentsBlock(currentBlock.id)) {
13914
13943
  blocks.push(currentBlock);
13915
13944
  }
13916
13945
  currentBlock = new Block({
@@ -13925,7 +13954,7 @@ var ReadmeParser = class {
13925
13954
  currentBlock.content += `${line}
13926
13955
  `;
13927
13956
  }
13928
- if (currentBlock) {
13957
+ if (currentBlock && !this.isTableOfContentsBlock(currentBlock.id)) {
13929
13958
  blocks.push(currentBlock);
13930
13959
  }
13931
13960
  return {
@@ -13933,6 +13962,9 @@ var ReadmeParser = class {
13933
13962
  blocks
13934
13963
  };
13935
13964
  }
13965
+ isTableOfContentsBlock(blockId) {
13966
+ return blockId === "TABLE_OF_CONTENTS" || blockId === "CONTENTS";
13967
+ }
13936
13968
  };
13937
13969
  function sectionNameToID(sectionName) {
13938
13970
  return snakeCase(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fern-api/generator-cli",
3
- "version": "0.4.4-rc0",
3
+ "version": "0.4.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern"
@@ -22,21 +22,21 @@
22
22
  "test:update": "vitest -u --run --passWithNoTests --globals --disable-console-intercept"
23
23
  },
24
24
  "devDependencies": {
25
- "@octokit/rest": "^20.1.2",
26
- "es-toolkit": "^1.32.0",
25
+ "@fern-api/configs": "workspace:*",
27
26
  "@fern-api/fs-utils": "workspace:*",
28
27
  "@fern-api/github": "workspace:*",
29
- "@fern-api/configs": "workspace:*",
28
+ "@octokit/rest": "^20.1.2",
30
29
  "@types/jest": "^29.5.11",
31
30
  "@types/node": "^22.0.0",
32
31
  "@types/yargs": "^17.0.32",
33
32
  "depcheck": "^1.4.7",
34
- "esbuild": "^0.24.2",
33
+ "es-toolkit": "^1.32.0",
34
+ "esbuild": "^0.25.0",
35
35
  "execa": "^9.5.1",
36
36
  "tmp-promise": "^3.0.3",
37
37
  "tsup": "^8.5.0",
38
38
  "typescript": "5.9.3",
39
- "vitest": "^2.1.9",
39
+ "vitest": "^4.0.8",
40
40
  "yargs": "^17.4.1"
41
41
  }
42
42
  }