@fern-api/generator-cli 0.6.3 → 0.6.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.
- package/dist/api.js +19 -16
- package/dist/cli.js +2119 -2086
- package/package.json +2 -2
package/dist/api.js
CHANGED
|
@@ -9666,16 +9666,19 @@ var consolePipelineLogger = {
|
|
|
9666
9666
|
`)
|
|
9667
9667
|
};
|
|
9668
9668
|
|
|
9669
|
-
// src/pipeline/
|
|
9670
|
-
var
|
|
9671
|
-
var import_promises2 = require("fs/promises");
|
|
9672
|
-
var import_path3 = require("path");
|
|
9669
|
+
// src/pipeline/PostGenerationPipeline.ts
|
|
9670
|
+
var import_child_process4 = require("child_process");
|
|
9673
9671
|
|
|
9674
9672
|
// src/pipeline/github/constants.ts
|
|
9675
9673
|
var FERN_BOT_NAME = "fern-api";
|
|
9676
9674
|
var FERN_BOT_EMAIL = "115122769+fern-api[bot]@users.noreply.github.com";
|
|
9677
9675
|
var FERN_BOT_LOGIN = "fern-api[bot]";
|
|
9678
9676
|
|
|
9677
|
+
// src/pipeline/steps/GithubStep.ts
|
|
9678
|
+
var import_rest2 = require("@octokit/rest");
|
|
9679
|
+
var import_promises2 = require("fs/promises");
|
|
9680
|
+
var import_path3 = require("path");
|
|
9681
|
+
|
|
9679
9682
|
// src/pipeline/github/createReplayBranch.ts
|
|
9680
9683
|
async function createReplayBranch(repository, branchName, commitMessage, replayConflictInfo, logger) {
|
|
9681
9684
|
if (replayConflictInfo?.hasConflicts) {
|
|
@@ -9835,10 +9838,10 @@ function logReplaySummary(result, logger) {
|
|
|
9835
9838
|
`Replay: flow=${result.flow}, detected=${result.patchesDetected ?? 0}, applied=${applied}, absorbed=${absorbed}, conflicts=${conflicts2}`
|
|
9836
9839
|
);
|
|
9837
9840
|
if (preserved > 0) {
|
|
9838
|
-
const absorbedNote = absorbed > 0 ? ` (
|
|
9839
|
-
logger.info(`Replay:
|
|
9841
|
+
const absorbedNote = absorbed > 0 ? ` (some customizations now part of generated code)` : "";
|
|
9842
|
+
logger.info(`Replay: customizations preserved${absorbedNote}`);
|
|
9840
9843
|
} else if (absorbed > 0) {
|
|
9841
|
-
logger.info(`Replay:
|
|
9844
|
+
logger.info(`Replay: customizations now part of generated code`);
|
|
9842
9845
|
}
|
|
9843
9846
|
if (conflicts2 > 0) {
|
|
9844
9847
|
const totalFiles = (result.conflictDetails ?? []).reduce((sum, d) => sum + d.files.length, 0);
|
|
@@ -9869,10 +9872,10 @@ function formatReplayPrBody(result, options) {
|
|
|
9869
9872
|
}
|
|
9870
9873
|
const parts = [];
|
|
9871
9874
|
if (preserved > 0 && conflicts2 === 0) {
|
|
9872
|
-
parts.push(`\u2705
|
|
9875
|
+
parts.push(`\u2705 Customizations automatically preserved in this update.`);
|
|
9873
9876
|
} else if (preserved > 0) {
|
|
9874
9877
|
parts.push(
|
|
9875
|
-
`\u2705
|
|
9878
|
+
`\u2705 Customizations automatically preserved, but ${plural(conflicts2, "file")} ${conflicts2 === 1 ? "needs" : "need"} your attention.`
|
|
9876
9879
|
);
|
|
9877
9880
|
}
|
|
9878
9881
|
if (conflicts2 > 0) {
|
|
@@ -10034,13 +10037,6 @@ var GithubStep = class extends BaseStep {
|
|
|
10034
10037
|
const now = /* @__PURE__ */ new Date();
|
|
10035
10038
|
const formattedDate = now.toISOString().replace("T", "_").replace(/:/g, "-").replace("Z", "").replace(".", "_");
|
|
10036
10039
|
const newPrBranch = `fern-bot/${formattedDate}`;
|
|
10037
|
-
try {
|
|
10038
|
-
await repository.setUserAndEmail({
|
|
10039
|
-
name: FERN_BOT_NAME,
|
|
10040
|
-
email: FERN_BOT_EMAIL
|
|
10041
|
-
});
|
|
10042
|
-
} catch {
|
|
10043
|
-
}
|
|
10044
10040
|
const mode = this.config.mode;
|
|
10045
10041
|
switch (mode) {
|
|
10046
10042
|
case "pull-request":
|
|
@@ -10728,6 +10724,13 @@ var PostGenerationPipeline = class {
|
|
|
10728
10724
|
}
|
|
10729
10725
|
steps = [];
|
|
10730
10726
|
async run() {
|
|
10727
|
+
if (this.config.github?.enabled) {
|
|
10728
|
+
try {
|
|
10729
|
+
(0, import_child_process4.execFileSync)("git", ["config", "user.name", FERN_BOT_NAME], { cwd: this.config.outputDir });
|
|
10730
|
+
(0, import_child_process4.execFileSync)("git", ["config", "user.email", FERN_BOT_EMAIL], { cwd: this.config.outputDir });
|
|
10731
|
+
} catch {
|
|
10732
|
+
}
|
|
10733
|
+
}
|
|
10731
10734
|
const result = {
|
|
10732
10735
|
success: true,
|
|
10733
10736
|
steps: {}
|