@fern-api/generator-cli 0.9.7 → 0.9.8
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.
- package/dist/api.d.ts +7 -1
- package/dist/api.js +32 -4
- package/dist/cli.js +32 -4
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -536,8 +536,14 @@ interface GithubStepConfig {
|
|
|
536
536
|
changelogEntry?: string;
|
|
537
537
|
/** Structured PR description with Before/After code fences for breaking changes. Takes priority over changelogEntry for PR body. */
|
|
538
538
|
prDescription?: string;
|
|
539
|
-
/** One-sentence justification for WHY the version bump was chosen.
|
|
539
|
+
/** One-sentence justification for WHY the version bump was chosen. Shown only for breaking changes. */
|
|
540
540
|
versionBumpReason?: string;
|
|
541
|
+
/** The previous SDK version before this change (e.g. "1.2.3"). Used for version header in PR body. */
|
|
542
|
+
previousVersion?: string;
|
|
543
|
+
/** The new SDK version after this change (e.g. "1.3.0"). Used for version header in PR body. */
|
|
544
|
+
newVersion?: string;
|
|
545
|
+
/** The version bump level: MAJOR, MINOR, or PATCH. Used for version header formatting. */
|
|
546
|
+
versionBump?: string;
|
|
541
547
|
/** Skip push/PR creation, just prepare branches locally */
|
|
542
548
|
previewMode?: boolean;
|
|
543
549
|
/** Generator name for namespaced fern-generation-base tag */
|
package/dist/api.js
CHANGED
|
@@ -10122,15 +10122,37 @@ async function checkPRHasOnlyGenerationCommits(octokit, owner, repo, pullNumber,
|
|
|
10122
10122
|
}
|
|
10123
10123
|
|
|
10124
10124
|
// src/pipeline/github/parseCommitMessage.ts
|
|
10125
|
-
function parseCommitMessageForPR(commitMessage, changelogEntry, prDescription, versionBumpReason) {
|
|
10125
|
+
function parseCommitMessageForPR(commitMessage, changelogEntry, prDescription, versionBumpReason, previousVersion, newVersion, versionBump, changelogUrl) {
|
|
10126
10126
|
const lines = commitMessage.split("\n");
|
|
10127
10127
|
const prTitle = lines[0]?.trim() || "SDK Generation";
|
|
10128
10128
|
const bodyFromCommit = lines.slice(1).join("\n").trim() || "Automated SDK generation by Fern";
|
|
10129
10129
|
let prBody = prDescription?.trim() || changelogEntry?.trim() || bodyFromCommit;
|
|
10130
|
-
|
|
10131
|
-
|
|
10130
|
+
const isBreaking = versionBump === "MAJOR";
|
|
10131
|
+
if (previousVersion?.trim() && newVersion?.trim()) {
|
|
10132
|
+
const emoji = isBreaking ? "\u26A0\uFE0F " : "";
|
|
10133
|
+
const header = `## ${emoji}${previousVersion.trim()} \u2192 ${newVersion.trim()}`;
|
|
10134
|
+
if (isBreaking && versionBumpReason?.trim()) {
|
|
10135
|
+
prBody = `${header}
|
|
10136
|
+
|
|
10137
|
+
**Breaking:** ${versionBumpReason.trim()}
|
|
10138
|
+
|
|
10139
|
+
${prBody}`;
|
|
10140
|
+
} else {
|
|
10141
|
+
prBody = `${header}
|
|
10132
10142
|
|
|
10133
10143
|
${prBody}`;
|
|
10144
|
+
}
|
|
10145
|
+
} else if (isBreaking && versionBumpReason?.trim()) {
|
|
10146
|
+
prBody = `\u26A0\uFE0F **Breaking:** ${versionBumpReason.trim()}
|
|
10147
|
+
|
|
10148
|
+
${prBody}`;
|
|
10149
|
+
}
|
|
10150
|
+
if (changelogUrl?.trim()) {
|
|
10151
|
+
prBody += `
|
|
10152
|
+
|
|
10153
|
+
---
|
|
10154
|
+
|
|
10155
|
+
[See full changelog](${changelogUrl.trim()})`;
|
|
10134
10156
|
}
|
|
10135
10157
|
return { prTitle, prBody };
|
|
10136
10158
|
}
|
|
@@ -10415,11 +10437,17 @@ var GithubStep = class extends BaseStep {
|
|
|
10415
10437
|
}
|
|
10416
10438
|
}
|
|
10417
10439
|
const finalCommitMessage = this.config.commitMessage ?? "SDK Generation";
|
|
10440
|
+
const headSha = await repository.getHeadSha();
|
|
10441
|
+
const changelogUrl = this.config.changelogEntry ? `https://github.com/${this.config.uri}/blob/${headSha}/changelog.md` : void 0;
|
|
10418
10442
|
const { prTitle, prBody } = parseCommitMessageForPR(
|
|
10419
10443
|
finalCommitMessage,
|
|
10420
10444
|
this.config.changelogEntry,
|
|
10421
10445
|
this.config.prDescription,
|
|
10422
|
-
this.config.versionBumpReason
|
|
10446
|
+
this.config.versionBumpReason,
|
|
10447
|
+
this.config.previousVersion,
|
|
10448
|
+
this.config.newVersion,
|
|
10449
|
+
this.config.versionBump,
|
|
10450
|
+
changelogUrl
|
|
10423
10451
|
);
|
|
10424
10452
|
const replaySection = formatReplayPrBody(replayResult, { branchName: prBranch, repoUri: this.config.uri });
|
|
10425
10453
|
let enrichedBody = replaySection != null ? prBody + "\n\n---\n\n" + replaySection : prBody;
|
package/dist/cli.js
CHANGED
|
@@ -33032,15 +33032,37 @@ async function checkPRHasOnlyGenerationCommits(octokit, owner, repo, pullNumber,
|
|
|
33032
33032
|
}
|
|
33033
33033
|
|
|
33034
33034
|
// src/pipeline/github/parseCommitMessage.ts
|
|
33035
|
-
function parseCommitMessageForPR(commitMessage, changelogEntry, prDescription, versionBumpReason) {
|
|
33035
|
+
function parseCommitMessageForPR(commitMessage, changelogEntry, prDescription, versionBumpReason, previousVersion, newVersion, versionBump, changelogUrl) {
|
|
33036
33036
|
const lines = commitMessage.split("\n");
|
|
33037
33037
|
const prTitle = lines[0]?.trim() || "SDK Generation";
|
|
33038
33038
|
const bodyFromCommit = lines.slice(1).join("\n").trim() || "Automated SDK generation by Fern";
|
|
33039
33039
|
let prBody = prDescription?.trim() || changelogEntry?.trim() || bodyFromCommit;
|
|
33040
|
-
|
|
33041
|
-
|
|
33040
|
+
const isBreaking = versionBump === "MAJOR";
|
|
33041
|
+
if (previousVersion?.trim() && newVersion?.trim()) {
|
|
33042
|
+
const emoji = isBreaking ? "\u26A0\uFE0F " : "";
|
|
33043
|
+
const header = `## ${emoji}${previousVersion.trim()} \u2192 ${newVersion.trim()}`;
|
|
33044
|
+
if (isBreaking && versionBumpReason?.trim()) {
|
|
33045
|
+
prBody = `${header}
|
|
33046
|
+
|
|
33047
|
+
**Breaking:** ${versionBumpReason.trim()}
|
|
33048
|
+
|
|
33049
|
+
${prBody}`;
|
|
33050
|
+
} else {
|
|
33051
|
+
prBody = `${header}
|
|
33042
33052
|
|
|
33043
33053
|
${prBody}`;
|
|
33054
|
+
}
|
|
33055
|
+
} else if (isBreaking && versionBumpReason?.trim()) {
|
|
33056
|
+
prBody = `\u26A0\uFE0F **Breaking:** ${versionBumpReason.trim()}
|
|
33057
|
+
|
|
33058
|
+
${prBody}`;
|
|
33059
|
+
}
|
|
33060
|
+
if (changelogUrl?.trim()) {
|
|
33061
|
+
prBody += `
|
|
33062
|
+
|
|
33063
|
+
---
|
|
33064
|
+
|
|
33065
|
+
[See full changelog](${changelogUrl.trim()})`;
|
|
33044
33066
|
}
|
|
33045
33067
|
return { prTitle, prBody };
|
|
33046
33068
|
}
|
|
@@ -33289,11 +33311,17 @@ var GithubStep = class extends BaseStep {
|
|
|
33289
33311
|
}
|
|
33290
33312
|
}
|
|
33291
33313
|
const finalCommitMessage = this.config.commitMessage ?? "SDK Generation";
|
|
33314
|
+
const headSha = await repository.getHeadSha();
|
|
33315
|
+
const changelogUrl = this.config.changelogEntry ? `https://github.com/${this.config.uri}/blob/${headSha}/changelog.md` : void 0;
|
|
33292
33316
|
const { prTitle, prBody } = parseCommitMessageForPR(
|
|
33293
33317
|
finalCommitMessage,
|
|
33294
33318
|
this.config.changelogEntry,
|
|
33295
33319
|
this.config.prDescription,
|
|
33296
|
-
this.config.versionBumpReason
|
|
33320
|
+
this.config.versionBumpReason,
|
|
33321
|
+
this.config.previousVersion,
|
|
33322
|
+
this.config.newVersion,
|
|
33323
|
+
this.config.versionBump,
|
|
33324
|
+
changelogUrl
|
|
33297
33325
|
);
|
|
33298
33326
|
const replaySection = formatReplayPrBody(replayResult, { branchName: prBranch, repoUri: this.config.uri });
|
|
33299
33327
|
let enrichedBody = replaySection != null ? prBody + "\n\n---\n\n" + replaySection : prBody;
|