@fern-api/fern-api-dev 5.23.3-146-g1ff699af452 → 5.23.3-148-g81022d2f988

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 +98 -16
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -369996,6 +369996,8 @@ var require_GithubStep = __commonJS({
369996
369996
  return await this.executePullRequestMode(repository, newPrBranch, skipCommit, replayConflictInfo, replayResult, resolvedPrFields);
369997
369997
  case "push":
369998
369998
  return await this.executePushMode(repository, resolvedPrFields);
369999
+ case "commit-and-release":
370000
+ return await this.executeCommitAndReleaseMode(repository, resolvedPrFields);
369999
370001
  default: {
370000
370002
  const exhaustive = mode;
370001
370003
  throw new Error(`Unexpected GitHub mode: ${String(exhaustive)}`);
@@ -370200,6 +370202,69 @@ var require_GithubStep = __commonJS({
370200
370202
  }
370201
370203
  return result;
370202
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
+ }
370203
370268
  createOctokit() {
370204
370269
  const opts = { auth: this.config.token };
370205
370270
  if (this.config.apiBaseUrl != null) {
@@ -370779,8 +370844,8 @@ var require_PostGenerationPipeline = __commonJS({
370779
370844
  this.logger = logger4;
370780
370845
  let replayEnabled = config5.replay?.enabled ?? false;
370781
370846
  let autoVersionEnabled = config5.autoVersion?.enabled ?? false;
370782
- if (replayEnabled && config5.github?.mode === "push") {
370783
- 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.`);
370784
370849
  replayEnabled = false;
370785
370850
  }
370786
370851
  if (autoVersionEnabled && !replayEnabled) {
@@ -559469,7 +559534,8 @@ var GithubCommitAndReleaseMode = {
559469
559534
  // ../configuration/lib/generators-yml/schemas/api/resources/group/types/GithubSelfhostedMode.js
559470
559535
  var GithubSelfhostedMode = {
559471
559536
  PullRequest: "pull-request",
559472
- Push: "push"
559537
+ Push: "push",
559538
+ CommitAndRelease: "commit-and-release"
559473
559539
  };
559474
559540
 
559475
559541
  // ../configuration/lib/generators-yml/schemas/api/resources/license/index.js
@@ -561972,7 +562038,7 @@ var GithubPushSchema = schemas_exports8.object({
561972
562038
  });
561973
562039
 
561974
562040
  // ../configuration/lib/generators-yml/schemas/serialization/resources/group/types/GithubSelfhostedMode.js
561975
- var GithubSelfhostedMode2 = schemas_exports8.enum_(["pull-request", "push"]);
562041
+ var GithubSelfhostedMode2 = schemas_exports8.enum_(["pull-request", "push", "commit-and-release"]);
561976
562042
 
561977
562043
  // ../configuration/lib/generators-yml/schemas/serialization/resources/group/types/GithubSelfhostedSchema.js
561978
562044
  var GithubSelfhostedSchema = schemas_exports8.object({
@@ -596150,7 +596216,8 @@ async function convertOutputMode({ absolutePathToGeneratorsConfiguration, genera
596150
596216
  const mode = generator.github.mode ?? "release";
596151
596217
  switch (mode) {
596152
596218
  case "commit":
596153
- case "release": {
596219
+ case "release":
596220
+ case "commit-and-release": {
596154
596221
  const releaseConfig = generator.github;
596155
596222
  const commitAndReleaseValue = {
596156
596223
  owner,
@@ -661061,7 +661128,7 @@ var GitHubRepositoryOutputSchema = external_exports.object({
661061
661128
  }).strict();
661062
661129
 
661063
661130
  // ../config/lib/schemas/GitSelfHostedOutputModeSchema.js
661064
- var GitSelfHostedOutputModeSchema = external_exports.enum(["pr", "push"]);
661131
+ var GitSelfHostedOutputModeSchema = external_exports.enum(["pr", "push", "release"]);
661065
661132
 
661066
661133
  // ../config/lib/schemas/GitSelfHostedOutputSchema.js
661067
661134
  var GitSelfHostedOutputSchema = external_exports.object({
@@ -667959,7 +668026,7 @@ var AccessTokenPosthogManager = class {
667959
668026
  properties: {
667960
668027
  ...event,
667961
668028
  ...event.properties,
667962
- version: "5.23.3-146-g1ff699af452",
668029
+ version: "5.23.3-148-g81022d2f988",
667963
668030
  usingAccessToken: true,
667964
668031
  ...getRunIdProperties()
667965
668032
  }
@@ -668023,7 +668090,7 @@ var UserPosthogManager = class {
668023
668090
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
668024
668091
  event: "CLI",
668025
668092
  properties: {
668026
- version: "5.23.3-146-g1ff699af452",
668093
+ version: "5.23.3-148-g81022d2f988",
668027
668094
  ...event,
668028
668095
  ...event.properties,
668029
668096
  usingAccessToken: false,
@@ -859734,7 +859801,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
859734
859801
  var LOGS_FOLDER_NAME = "logs";
859735
859802
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
859736
859803
  function getCliSource() {
859737
- const version7 = "5.23.3-146-g1ff699af452";
859804
+ const version7 = "5.23.3-148-g81022d2f988";
859738
859805
  return `cli@${version7}`;
859739
859806
  }
859740
859807
  var DebugLogger = class {
@@ -876385,8 +876452,13 @@ function extractRepoUriFromGenerator(generatorInvocation) {
876385
876452
  }
876386
876453
  function extractGithubModeFromGenerator(generatorInvocation) {
876387
876454
  const github = generatorInvocation.raw?.github;
876388
- if (github != null && "mode" in github && github.mode === "pull-request") {
876389
- 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
+ }
876390
876462
  }
876391
876463
  return "push";
876392
876464
  }
@@ -878470,7 +878542,7 @@ var LegacyDocsPublisher = class {
878470
878542
  previewId,
878471
878543
  disableTemplates: void 0,
878472
878544
  skipUpload,
878473
- cliVersion: "5.23.3-146-g1ff699af452",
878545
+ cliVersion: "5.23.3-148-g81022d2f988",
878474
878546
  loginCommand: "fern auth login"
878475
878547
  });
878476
878548
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -931241,7 +931313,7 @@ generators:
931241
931313
  // 30 seconds timeout for credential/network issues
931242
931314
  });
931243
931315
  const mode = selfhostedGithubConfig.mode ?? "push";
931244
- if ((mode === "push" || mode === "pull-request") && selfhostedGithubConfig.branch != null) {
931316
+ if ((mode === "push" || mode === "pull-request" || mode === "commit-and-release") && selfhostedGithubConfig.branch != null) {
931245
931317
  interactiveTaskContext.logger.debug(`Checking out branch ${selfhostedGithubConfig.branch} before generation`);
931246
931318
  if (mode === "pull-request") {
931247
931319
  const branchExists = await repo.remoteBranchExists(selfhostedGithubConfig.branch);
@@ -931322,7 +931394,7 @@ generators:
931322
931394
  prDescription: autoVersioningPrDescription,
931323
931395
  versionBumpReason: autoVersioningVersionBumpReason,
931324
931396
  previousVersion: autoVersioningPreviousVersion,
931325
- newVersion: autoVersioningNewVersion,
931397
+ newVersion: autoVersioningNewVersion ?? version7,
931326
931398
  versionBump: autoVersioningVersionBump,
931327
931399
  previewMode: selfhostedGithubConfig.previewMode,
931328
931400
  generatorName: generatorInvocation.name,
@@ -931803,6 +931875,8 @@ var LegacyGeneratorInvocationAdapter = class {
931803
931875
  return generators_yml_exports.GithubSelfhostedMode.PullRequest;
931804
931876
  case "push":
931805
931877
  return generators_yml_exports.GithubSelfhostedMode.Push;
931878
+ case "release":
931879
+ return generators_yml_exports.GithubSelfhostedMode.CommitAndRelease;
931806
931880
  default:
931807
931881
  assertNever(mode);
931808
931882
  }
@@ -931877,6 +931951,14 @@ var LegacyGeneratorInvocationAdapter = class {
931877
931951
  license,
931878
931952
  publishInfo
931879
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
+ }));
931880
931962
  default:
931881
931963
  assertNever(mode);
931882
931964
  }
@@ -952870,7 +952952,7 @@ function getAutomationContextFromEnv() {
952870
952952
  config_branch: process.env.FERN_CONFIG_BRANCH,
952871
952953
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
952872
952954
  trigger: process.env.GITHUB_EVENT_NAME,
952873
- cli_version: "5.23.3-146-g1ff699af452"
952955
+ cli_version: "5.23.3-148-g81022d2f988"
952874
952956
  };
952875
952957
  }
952876
952958
  function isAutomationMode() {
@@ -953696,7 +953778,7 @@ var CliContext = class _CliContext {
953696
953778
  if (false) {
953697
953779
  this.logger.error("CLI_VERSION is not defined");
953698
953780
  }
953699
- return "5.23.3-146-g1ff699af452";
953781
+ return "5.23.3-148-g81022d2f988";
953700
953782
  }
953701
953783
  getCliName() {
953702
953784
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.23.3-146-g1ff699af452",
2
+ "version": "5.23.3-148-g81022d2f988",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",