@fern-api/fern-api-dev 5.29.0 → 5.30.0

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/cli.cjs +102 -22
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -369696,18 +369696,16 @@ var require_pushSignedCommit = __commonJS({
369696
369696
  await repository.pushObjectToRef(localHeadSha, tempRef);
369697
369697
  tempRefPushed = true;
369698
369698
  for (let attempt = 0; attempt < MAX_CONCURRENT_PUSH_RETRIES; attempt++) {
369699
- const commitAuthor = {
369700
- name: author?.name ?? constants_1.FERN_BOT_NAME,
369701
- email: author?.email ?? constants_1.FERN_BOT_EMAIL
369702
- };
369699
+ const resolvedAuthor = author ?? { name: constants_1.FERN_BOT_NAME, email: constants_1.FERN_BOT_EMAIL };
369700
+ const committerField = author != null ? { committer: author } : {};
369703
369701
  const { data: signedCommit } = await octokit.git.createCommit({
369704
369702
  owner,
369705
369703
  repo,
369706
369704
  message,
369707
369705
  tree: treeSha,
369708
369706
  parents,
369709
- author: commitAuthor,
369710
- committer: commitAuthor
369707
+ author: resolvedAuthor,
369708
+ ...committerField
369711
369709
  });
369712
369710
  const signedSha = signedCommit.sha;
369713
369711
  try {
@@ -369998,6 +369996,8 @@ var require_GithubStep = __commonJS({
369998
369996
  return await this.executePullRequestMode(repository, newPrBranch, skipCommit, replayConflictInfo, replayResult, resolvedPrFields);
369999
369997
  case "push":
370000
369998
  return await this.executePushMode(repository, resolvedPrFields);
369999
+ case "commit-and-release":
370000
+ return await this.executeCommitAndReleaseMode(repository, resolvedPrFields);
370001
370001
  default: {
370002
370002
  const exhaustive = mode;
370003
370003
  throw new Error(`Unexpected GitHub mode: ${String(exhaustive)}`);
@@ -370202,6 +370202,69 @@ var require_GithubStep = __commonJS({
370202
370202
  }
370203
370203
  return result;
370204
370204
  }
370205
+ async executeCommitAndReleaseMode(repository, resolved) {
370206
+ const baseBranch = this.config.branch ?? await repository.getDefaultBranch();
370207
+ if (this.config.branch != null) {
370208
+ this.logger.debug(`Checking out branch ${this.config.branch}`);
370209
+ await repository.checkout(this.config.branch);
370210
+ }
370211
+ await this.ensureFernignore();
370212
+ this.logger.debug("Committing changes...");
370213
+ await repository.commitAllChanges(resolved.commitMessage);
370214
+ this.logger.debug(`Committed changes to local copy of GitHub repository at ${this.outputDir}`);
370215
+ if (shouldCheckNoDiff(this.config)) {
370216
+ const noDiff = await repository.treeHashEquals(`origin/${baseBranch}`);
370217
+ if (noDiff) {
370218
+ this.logger.info("No changes detected after generation \u2014 skipping commit-and-release");
370219
+ return { executed: true, success: true, skippedNoDiff: true };
370220
+ }
370221
+ }
370222
+ const result = {
370223
+ executed: true,
370224
+ success: true
370225
+ };
370226
+ if (!this.config.previewMode) {
370227
+ const octokit = this.createOctokit();
370228
+ const { owner, repo, remote } = (0, github_1.parseRepository)(this.config.uri);
370229
+ await (0, pushSignedCommit_1.pushSignedCommit)({
370230
+ repository,
370231
+ octokit,
370232
+ owner,
370233
+ repo,
370234
+ branch: baseBranch,
370235
+ force: false,
370236
+ rebaseOnConflict: true,
370237
+ author: this.config.author,
370238
+ logger: this.logger
370239
+ });
370240
+ const pushedBranch = await repository.getCurrentBranch();
370241
+ result.branchUrl = `https://${remote}/${owner}/${repo}/tree/${pushedBranch}`;
370242
+ this.logger.info(`Pushed branch: ${result.branchUrl}`);
370243
+ if (resolved.newVersion == null) {
370244
+ this.logger.warn("No new version available \u2014 skipping release tag creation. Pass --version <semver> or --version AUTO to fern generate to enable release tagging.");
370245
+ } else {
370246
+ try {
370247
+ const tagName = resolved.newVersion;
370248
+ const headSha = await repository.getHeadSha();
370249
+ await octokit.repos.createRelease({
370250
+ owner,
370251
+ repo,
370252
+ tag_name: tagName,
370253
+ target_commitish: headSha,
370254
+ name: tagName,
370255
+ body: resolved.changelogEntry ?? resolved.commitMessage,
370256
+ draft: false,
370257
+ prerelease: false
370258
+ });
370259
+ this.logger.info(`Created GitHub release ${tagName}`);
370260
+ result.releaseUrl = `https://${remote}/${owner}/${repo}/releases/tag/${tagName}`;
370261
+ } catch (error50) {
370262
+ this.logger.warn(`Could not create GitHub release: ${(0, core_utils_1.extractErrorMessage)(error50)}`);
370263
+ }
370264
+ }
370265
+ }
370266
+ return result;
370267
+ }
370205
370268
  createOctokit() {
370206
370269
  const opts = { auth: this.config.token };
370207
370270
  if (this.config.apiBaseUrl != null) {
@@ -370781,8 +370844,8 @@ var require_PostGenerationPipeline = __commonJS({
370781
370844
  this.logger = logger4;
370782
370845
  let replayEnabled = config5.replay?.enabled ?? false;
370783
370846
  let autoVersionEnabled = config5.autoVersion?.enabled ?? false;
370784
- if (replayEnabled && config5.github?.mode === "push") {
370785
- this.logger.warn("Replay is not supported with GitHub push mode. Disabling replay to prevent force push to base branch.");
370847
+ if (replayEnabled && (config5.github?.mode === "push" || config5.github?.mode === "commit-and-release")) {
370848
+ this.logger.warn(`Replay is not supported with GitHub ${config5.github.mode} mode. Disabling replay to prevent push to base branch.`);
370786
370849
  replayEnabled = false;
370787
370850
  }
370788
370851
  if (autoVersionEnabled && !replayEnabled) {
@@ -559471,7 +559534,8 @@ var GithubCommitAndReleaseMode = {
559471
559534
  // ../configuration/lib/generators-yml/schemas/api/resources/group/types/GithubSelfhostedMode.js
559472
559535
  var GithubSelfhostedMode = {
559473
559536
  PullRequest: "pull-request",
559474
- Push: "push"
559537
+ Push: "push",
559538
+ CommitAndRelease: "commit-and-release"
559475
559539
  };
559476
559540
 
559477
559541
  // ../configuration/lib/generators-yml/schemas/api/resources/license/index.js
@@ -561974,7 +562038,7 @@ var GithubPushSchema = schemas_exports8.object({
561974
562038
  });
561975
562039
 
561976
562040
  // ../configuration/lib/generators-yml/schemas/serialization/resources/group/types/GithubSelfhostedMode.js
561977
- var GithubSelfhostedMode2 = schemas_exports8.enum_(["pull-request", "push"]);
562041
+ var GithubSelfhostedMode2 = schemas_exports8.enum_(["pull-request", "push", "commit-and-release"]);
561978
562042
 
561979
562043
  // ../configuration/lib/generators-yml/schemas/serialization/resources/group/types/GithubSelfhostedSchema.js
561980
562044
  var GithubSelfhostedSchema = schemas_exports8.object({
@@ -596152,7 +596216,8 @@ async function convertOutputMode({ absolutePathToGeneratorsConfiguration, genera
596152
596216
  const mode = generator.github.mode ?? "release";
596153
596217
  switch (mode) {
596154
596218
  case "commit":
596155
- case "release": {
596219
+ case "release":
596220
+ case "commit-and-release": {
596156
596221
  const releaseConfig = generator.github;
596157
596222
  const commitAndReleaseValue = {
596158
596223
  owner,
@@ -661063,7 +661128,7 @@ var GitHubRepositoryOutputSchema = external_exports.object({
661063
661128
  }).strict();
661064
661129
 
661065
661130
  // ../config/lib/schemas/GitSelfHostedOutputModeSchema.js
661066
- var GitSelfHostedOutputModeSchema = external_exports.enum(["pr", "push"]);
661131
+ var GitSelfHostedOutputModeSchema = external_exports.enum(["pr", "push", "release"]);
661067
661132
 
661068
661133
  // ../config/lib/schemas/GitSelfHostedOutputSchema.js
661069
661134
  var GitSelfHostedOutputSchema = external_exports.object({
@@ -667961,7 +668026,7 @@ var AccessTokenPosthogManager = class {
667961
668026
  properties: {
667962
668027
  ...event,
667963
668028
  ...event.properties,
667964
- version: "5.29.0",
668029
+ version: "5.30.0",
667965
668030
  usingAccessToken: true,
667966
668031
  ...getRunIdProperties()
667967
668032
  }
@@ -668025,7 +668090,7 @@ var UserPosthogManager = class {
668025
668090
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
668026
668091
  event: "CLI",
668027
668092
  properties: {
668028
- version: "5.29.0",
668093
+ version: "5.30.0",
668029
668094
  ...event,
668030
668095
  ...event.properties,
668031
668096
  usingAccessToken: false,
@@ -859736,7 +859801,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
859736
859801
  var LOGS_FOLDER_NAME = "logs";
859737
859802
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
859738
859803
  function getCliSource() {
859739
- const version7 = "5.29.0";
859804
+ const version7 = "5.30.0";
859740
859805
  return `cli@${version7}`;
859741
859806
  }
859742
859807
  var DebugLogger = class {
@@ -876387,8 +876452,13 @@ function extractRepoUriFromGenerator(generatorInvocation) {
876387
876452
  }
876388
876453
  function extractGithubModeFromGenerator(generatorInvocation) {
876389
876454
  const github = generatorInvocation.raw?.github;
876390
- if (github != null && "mode" in github && github.mode === "pull-request") {
876391
- return "pull-request";
876455
+ if (github != null && "mode" in github) {
876456
+ if (github.mode === "pull-request") {
876457
+ return "pull-request";
876458
+ }
876459
+ if (github.mode === "commit-and-release") {
876460
+ return "commit-and-release";
876461
+ }
876392
876462
  }
876393
876463
  return "push";
876394
876464
  }
@@ -878472,7 +878542,7 @@ var LegacyDocsPublisher = class {
878472
878542
  previewId,
878473
878543
  disableTemplates: void 0,
878474
878544
  skipUpload,
878475
- cliVersion: "5.29.0",
878545
+ cliVersion: "5.30.0",
878476
878546
  loginCommand: "fern auth login"
878477
878547
  });
878478
878548
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -931243,7 +931313,7 @@ generators:
931243
931313
  // 30 seconds timeout for credential/network issues
931244
931314
  });
931245
931315
  const mode = selfhostedGithubConfig.mode ?? "push";
931246
- if ((mode === "push" || mode === "pull-request") && selfhostedGithubConfig.branch != null) {
931316
+ if ((mode === "push" || mode === "pull-request" || mode === "commit-and-release") && selfhostedGithubConfig.branch != null) {
931247
931317
  interactiveTaskContext.logger.debug(`Checking out branch ${selfhostedGithubConfig.branch} before generation`);
931248
931318
  if (mode === "pull-request") {
931249
931319
  const branchExists = await repo.remoteBranchExists(selfhostedGithubConfig.branch);
@@ -931324,7 +931394,7 @@ generators:
931324
931394
  prDescription: autoVersioningPrDescription,
931325
931395
  versionBumpReason: autoVersioningVersionBumpReason,
931326
931396
  previousVersion: autoVersioningPreviousVersion,
931327
- newVersion: autoVersioningNewVersion,
931397
+ newVersion: autoVersioningNewVersion ?? version7,
931328
931398
  versionBump: autoVersioningVersionBump,
931329
931399
  previewMode: selfhostedGithubConfig.previewMode,
931330
931400
  generatorName: generatorInvocation.name,
@@ -931805,6 +931875,8 @@ var LegacyGeneratorInvocationAdapter = class {
931805
931875
  return generators_yml_exports.GithubSelfhostedMode.PullRequest;
931806
931876
  case "push":
931807
931877
  return generators_yml_exports.GithubSelfhostedMode.Push;
931878
+ case "release":
931879
+ return generators_yml_exports.GithubSelfhostedMode.CommitAndRelease;
931808
931880
  default:
931809
931881
  assertNever(mode);
931810
931882
  }
@@ -931879,6 +931951,14 @@ var LegacyGeneratorInvocationAdapter = class {
931879
931951
  license,
931880
931952
  publishInfo
931881
931953
  }));
931954
+ case "release":
931955
+ return api_exports4.remoteGen.OutputMode.githubV2(api_exports4.GithubOutputModeV2.commitAndRelease({
931956
+ owner: repository.owner,
931957
+ repo: repository.repo,
931958
+ branch: git.branch,
931959
+ license,
931960
+ publishInfo
931961
+ }));
931882
931962
  default:
931883
931963
  assertNever(mode);
931884
931964
  }
@@ -952872,7 +952952,7 @@ function getAutomationContextFromEnv() {
952872
952952
  config_branch: process.env.FERN_CONFIG_BRANCH,
952873
952953
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
952874
952954
  trigger: process.env.GITHUB_EVENT_NAME,
952875
- cli_version: "5.29.0"
952955
+ cli_version: "5.30.0"
952876
952956
  };
952877
952957
  }
952878
952958
  function isAutomationMode() {
@@ -953698,7 +953778,7 @@ var CliContext = class _CliContext {
953698
953778
  if (false) {
953699
953779
  this.logger.error("CLI_VERSION is not defined");
953700
953780
  }
953701
- return "5.29.0";
953781
+ return "5.30.0";
953702
953782
  }
953703
953783
  getCliName() {
953704
953784
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.29.0",
2
+ "version": "5.30.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",