@fern-api/generator-cli 0.9.2 → 0.9.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.
Files changed (3) hide show
  1. package/dist/api.js +43 -1
  2. package/dist/cli.js +43 -1
  3. package/package.json +1 -1
package/dist/api.js CHANGED
@@ -6600,6 +6600,7 @@ var JsonError = class _JsonError extends Error {
6600
6600
  this.errors = errors;
6601
6601
  Object.setPrototypeOf(this, _JsonError.prototype);
6602
6602
  }
6603
+ errors;
6603
6604
  };
6604
6605
 
6605
6606
  // src/configuration/sdk/core/schemas/builders/schema-utils/ParseError.ts
@@ -6609,6 +6610,7 @@ var ParseError = class _ParseError extends Error {
6609
6610
  this.errors = errors;
6610
6611
  Object.setPrototypeOf(this, _ParseError.prototype);
6611
6612
  }
6613
+ errors;
6612
6614
  };
6613
6615
 
6614
6616
  // src/configuration/sdk/core/schemas/builders/schema-utils/getSchemaUtils.ts
@@ -8288,6 +8290,7 @@ var StreamWriter = class extends Writer {
8288
8290
  this.stream = stream;
8289
8291
  this.stream = stream;
8290
8292
  }
8293
+ stream;
8291
8294
  async write(content) {
8292
8295
  return new Promise((resolve4, reject) => {
8293
8296
  const handleError = (err) => {
@@ -9953,6 +9956,8 @@ var BaseStep = class {
9953
9956
  this.outputDir = outputDir;
9954
9957
  this.logger = logger;
9955
9958
  }
9959
+ outputDir;
9960
+ logger;
9956
9961
  };
9957
9962
 
9958
9963
  // src/pipeline/steps/GithubStep.ts
@@ -9961,6 +9966,7 @@ var GithubStep = class extends BaseStep {
9961
9966
  super(outputDir, logger);
9962
9967
  this.config = config;
9963
9968
  }
9969
+ config;
9964
9970
  name = "github";
9965
9971
  async execute(context) {
9966
9972
  const replayResult = context.previousStepResults.replay;
@@ -10191,7 +10197,8 @@ var import_path5 = require("path");
10191
10197
  var import_fs2 = require("fs");
10192
10198
  var import_promises3 = require("fs/promises");
10193
10199
  var import_path4 = require("path");
10194
- var REPLAY_FERNIGNORE_ENTRIES = [".fern/replay.lock"];
10200
+ var REPLAY_FERNIGNORE_ENTRIES = [".fern/replay.lock", ".fern/replay.yml", ".gitattributes"];
10201
+ var GITATTRIBUTES_ENTRIES = [".fern/replay.lock linguist-generated=true"];
10195
10202
  async function ensureReplayFernignoreEntries(outputDir) {
10196
10203
  const fernignorePath = (0, import_path4.join)(outputDir, ".fernignore");
10197
10204
  let content = "";
@@ -10208,6 +10215,20 @@ async function ensureReplayFernignoreEntries(outputDir) {
10208
10215
  }
10209
10216
  return false;
10210
10217
  }
10218
+ async function ensureGitattributesEntries(outputDir) {
10219
+ const gitattributesPath = (0, import_path4.join)(outputDir, ".gitattributes");
10220
+ let content = "";
10221
+ try {
10222
+ content = await (0, import_promises3.readFile)(gitattributesPath, "utf-8");
10223
+ } catch {
10224
+ }
10225
+ const lines = content.split("\n");
10226
+ const toAdd = GITATTRIBUTES_ENTRIES.filter((entry) => !lines.some((line) => line.trim() === entry));
10227
+ if (toAdd.length > 0) {
10228
+ const suffix = content.length > 0 && !content.endsWith("\n") ? "\n" : "";
10229
+ await (0, import_promises3.writeFile)(gitattributesPath, content + suffix + toAdd.join("\n") + "\n", "utf-8");
10230
+ }
10231
+ }
10211
10232
  function ensureReplayFernignoreEntriesSync(outputDir) {
10212
10233
  const fernignorePath = (0, import_path4.join)(outputDir, ".fernignore");
10213
10234
  let content = "";
@@ -10221,6 +10242,19 @@ function ensureReplayFernignoreEntriesSync(outputDir) {
10221
10242
  (0, import_fs2.writeFileSync)(fernignorePath, content + suffix + toAdd.join("\n") + "\n", "utf-8");
10222
10243
  }
10223
10244
  }
10245
+ function ensureGitattributesEntriesSync(outputDir) {
10246
+ const gitattributesPath = (0, import_path4.join)(outputDir, ".gitattributes");
10247
+ let content = "";
10248
+ if ((0, import_fs2.existsSync)(gitattributesPath)) {
10249
+ content = (0, import_fs2.readFileSync)(gitattributesPath, "utf-8");
10250
+ }
10251
+ const lines = content.split("\n");
10252
+ const toAdd = GITATTRIBUTES_ENTRIES.filter((entry) => !lines.some((line) => line.trim() === entry));
10253
+ if (toAdd.length > 0) {
10254
+ const suffix = content.length > 0 && !content.endsWith("\n") ? "\n" : "";
10255
+ (0, import_fs2.writeFileSync)(gitattributesPath, content + suffix + toAdd.join("\n") + "\n", "utf-8");
10256
+ }
10257
+ }
10224
10258
 
10225
10259
  // src/replay/replay-run.ts
10226
10260
  async function replayRun(params) {
@@ -10326,6 +10360,7 @@ async function replayRun(params) {
10326
10360
  } catch {
10327
10361
  }
10328
10362
  const fernignoreUpdated = await ensureReplayFernignoreEntries(outputDir);
10363
+ await ensureGitattributesEntries(outputDir);
10329
10364
  return {
10330
10365
  report,
10331
10366
  fernignoreUpdated,
@@ -10367,6 +10402,10 @@ var ReplayStep = class extends BaseStep {
10367
10402
  this.generatorVersions = generatorVersions;
10368
10403
  this.generatorName = generatorName;
10369
10404
  }
10405
+ config;
10406
+ cliVersion;
10407
+ generatorVersions;
10408
+ generatorName;
10370
10409
  name = "replay";
10371
10410
  async execute(_context) {
10372
10411
  const result = await replayRun({
@@ -10447,6 +10486,8 @@ var PostGenerationPipeline = class {
10447
10486
  this.steps.push(new GithubStep(config.outputDir, this.logger, config.github));
10448
10487
  }
10449
10488
  }
10489
+ config;
10490
+ logger;
10450
10491
  steps = [];
10451
10492
  async run() {
10452
10493
  if (this.config.github?.enabled) {
@@ -10524,6 +10565,7 @@ async function replayInit(params) {
10524
10565
  return { bootstrap: bootstrapResult, fernignoreEntries: [] };
10525
10566
  }
10526
10567
  ensureReplayFernignoreEntriesSync(repoPath);
10568
+ ensureGitattributesEntriesSync(repoPath);
10527
10569
  const lockfilePath = (0, import_path6.join)(repoPath, ".fern", "replay.lock");
10528
10570
  const lockfileContent = (0, import_fs4.existsSync)(lockfilePath) ? (0, import_fs4.readFileSync)(lockfilePath, "utf-8") : void 0;
10529
10571
  const replayYmlPath = (0, import_path6.join)(repoPath, ".fern", "replay.yml");
package/dist/cli.js CHANGED
@@ -29135,6 +29135,7 @@ var JsonError = class _JsonError extends Error {
29135
29135
  this.errors = errors;
29136
29136
  Object.setPrototypeOf(this, _JsonError.prototype);
29137
29137
  }
29138
+ errors;
29138
29139
  };
29139
29140
 
29140
29141
  // src/configuration/sdk/core/schemas/builders/schema-utils/ParseError.ts
@@ -29144,6 +29145,7 @@ var ParseError = class _ParseError extends Error {
29144
29145
  this.errors = errors;
29145
29146
  Object.setPrototypeOf(this, _ParseError.prototype);
29146
29147
  }
29148
+ errors;
29147
29149
  };
29148
29150
 
29149
29151
  // src/configuration/sdk/core/schemas/builders/schema-utils/getSchemaUtils.ts
@@ -30823,6 +30825,7 @@ var StreamWriter = class extends Writer {
30823
30825
  this.stream = stream;
30824
30826
  this.stream = stream;
30825
30827
  }
30828
+ stream;
30826
30829
  async write(content) {
30827
30830
  return new Promise((resolve8, reject) => {
30828
30831
  const handleError = (err) => {
@@ -32286,6 +32289,8 @@ var BaseStep = class {
32286
32289
  this.outputDir = outputDir;
32287
32290
  this.logger = logger;
32288
32291
  }
32292
+ outputDir;
32293
+ logger;
32289
32294
  };
32290
32295
 
32291
32296
  // src/pipeline/steps/GithubStep.ts
@@ -32294,6 +32299,7 @@ var GithubStep = class extends BaseStep {
32294
32299
  super(outputDir, logger);
32295
32300
  this.config = config;
32296
32301
  }
32302
+ config;
32297
32303
  name = "github";
32298
32304
  async execute(context) {
32299
32305
  const replayResult = context.previousStepResults.replay;
@@ -32524,7 +32530,8 @@ var import_path14 = require("path");
32524
32530
  var import_fs11 = require("fs");
32525
32531
  var import_promises5 = require("fs/promises");
32526
32532
  var import_path13 = require("path");
32527
- var REPLAY_FERNIGNORE_ENTRIES2 = [".fern/replay.lock"];
32533
+ var REPLAY_FERNIGNORE_ENTRIES2 = [".fern/replay.lock", ".fern/replay.yml", ".gitattributes"];
32534
+ var GITATTRIBUTES_ENTRIES2 = [".fern/replay.lock linguist-generated=true"];
32528
32535
  async function ensureReplayFernignoreEntries(outputDir) {
32529
32536
  const fernignorePath = (0, import_path13.join)(outputDir, ".fernignore");
32530
32537
  let content = "";
@@ -32541,6 +32548,20 @@ async function ensureReplayFernignoreEntries(outputDir) {
32541
32548
  }
32542
32549
  return false;
32543
32550
  }
32551
+ async function ensureGitattributesEntries2(outputDir) {
32552
+ const gitattributesPath = (0, import_path13.join)(outputDir, ".gitattributes");
32553
+ let content = "";
32554
+ try {
32555
+ content = await (0, import_promises5.readFile)(gitattributesPath, "utf-8");
32556
+ } catch {
32557
+ }
32558
+ const lines = content.split("\n");
32559
+ const toAdd = GITATTRIBUTES_ENTRIES2.filter((entry) => !lines.some((line) => line.trim() === entry));
32560
+ if (toAdd.length > 0) {
32561
+ const suffix = content.length > 0 && !content.endsWith("\n") ? "\n" : "";
32562
+ await (0, import_promises5.writeFile)(gitattributesPath, content + suffix + toAdd.join("\n") + "\n", "utf-8");
32563
+ }
32564
+ }
32544
32565
  function ensureReplayFernignoreEntriesSync(outputDir) {
32545
32566
  const fernignorePath = (0, import_path13.join)(outputDir, ".fernignore");
32546
32567
  let content = "";
@@ -32554,6 +32575,19 @@ function ensureReplayFernignoreEntriesSync(outputDir) {
32554
32575
  (0, import_fs11.writeFileSync)(fernignorePath, content + suffix + toAdd.join("\n") + "\n", "utf-8");
32555
32576
  }
32556
32577
  }
32578
+ function ensureGitattributesEntriesSync(outputDir) {
32579
+ const gitattributesPath = (0, import_path13.join)(outputDir, ".gitattributes");
32580
+ let content = "";
32581
+ if ((0, import_fs11.existsSync)(gitattributesPath)) {
32582
+ content = (0, import_fs11.readFileSync)(gitattributesPath, "utf-8");
32583
+ }
32584
+ const lines = content.split("\n");
32585
+ const toAdd = GITATTRIBUTES_ENTRIES2.filter((entry) => !lines.some((line) => line.trim() === entry));
32586
+ if (toAdd.length > 0) {
32587
+ const suffix = content.length > 0 && !content.endsWith("\n") ? "\n" : "";
32588
+ (0, import_fs11.writeFileSync)(gitattributesPath, content + suffix + toAdd.join("\n") + "\n", "utf-8");
32589
+ }
32590
+ }
32557
32591
 
32558
32592
  // src/replay/replay-run.ts
32559
32593
  async function replayRun(params) {
@@ -32659,6 +32693,7 @@ async function replayRun(params) {
32659
32693
  } catch {
32660
32694
  }
32661
32695
  const fernignoreUpdated = await ensureReplayFernignoreEntries(outputDir);
32696
+ await ensureGitattributesEntries2(outputDir);
32662
32697
  return {
32663
32698
  report,
32664
32699
  fernignoreUpdated,
@@ -32700,6 +32735,10 @@ var ReplayStep = class extends BaseStep {
32700
32735
  this.generatorVersions = generatorVersions;
32701
32736
  this.generatorName = generatorName;
32702
32737
  }
32738
+ config;
32739
+ cliVersion;
32740
+ generatorVersions;
32741
+ generatorName;
32703
32742
  name = "replay";
32704
32743
  async execute(_context) {
32705
32744
  const result = await replayRun({
@@ -32780,6 +32819,8 @@ var PostGenerationPipeline = class {
32780
32819
  this.steps.push(new GithubStep(config.outputDir, this.logger, config.github));
32781
32820
  }
32782
32821
  }
32822
+ config;
32823
+ logger;
32783
32824
  steps = [];
32784
32825
  async run() {
32785
32826
  if (this.config.github?.enabled) {
@@ -32857,6 +32898,7 @@ async function replayInit(params) {
32857
32898
  return { bootstrap: bootstrapResult, fernignoreEntries: [] };
32858
32899
  }
32859
32900
  ensureReplayFernignoreEntriesSync(repoPath);
32901
+ ensureGitattributesEntriesSync(repoPath);
32860
32902
  const lockfilePath = (0, import_path15.join)(repoPath, ".fern", "replay.lock");
32861
32903
  const lockfileContent = (0, import_fs13.existsSync)(lockfilePath) ? (0, import_fs13.readFileSync)(lockfilePath, "utf-8") : void 0;
32862
32904
  const replayYmlPath = (0, import_path15.join)(repoPath, ".fern", "replay.yml");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fern-api/generator-cli",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/fern-api/fern.git",