@fern-api/generator-cli 0.6.4 → 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 +15 -12
- package/package.json +1 -1
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: {}
|
package/dist/cli.js
CHANGED
|
@@ -30827,15 +30827,18 @@ var consolePipelineLogger = {
|
|
|
30827
30827
|
`)
|
|
30828
30828
|
};
|
|
30829
30829
|
|
|
30830
|
-
// src/pipeline/
|
|
30831
|
-
var
|
|
30832
|
-
var import_path7 = require("path");
|
|
30830
|
+
// src/pipeline/PostGenerationPipeline.ts
|
|
30831
|
+
var import_child_process4 = require("child_process");
|
|
30833
30832
|
|
|
30834
30833
|
// src/pipeline/github/constants.ts
|
|
30835
30834
|
var FERN_BOT_NAME = "fern-api";
|
|
30836
30835
|
var FERN_BOT_EMAIL = "115122769+fern-api[bot]@users.noreply.github.com";
|
|
30837
30836
|
var FERN_BOT_LOGIN = "fern-api[bot]";
|
|
30838
30837
|
|
|
30838
|
+
// src/pipeline/steps/GithubStep.ts
|
|
30839
|
+
var import_promises3 = require("fs/promises");
|
|
30840
|
+
var import_path7 = require("path");
|
|
30841
|
+
|
|
30839
30842
|
// src/pipeline/github/createReplayBranch.ts
|
|
30840
30843
|
async function createReplayBranch(repository, branchName, commitMessage, replayConflictInfo, logger) {
|
|
30841
30844
|
if (replayConflictInfo?.hasConflicts) {
|
|
@@ -30996,10 +30999,10 @@ function formatReplayPrBody(result, options) {
|
|
|
30996
30999
|
}
|
|
30997
31000
|
const parts = [];
|
|
30998
31001
|
if (preserved > 0 && conflicts2 === 0) {
|
|
30999
|
-
parts.push(`\u2705
|
|
31002
|
+
parts.push(`\u2705 Customizations automatically preserved in this update.`);
|
|
31000
31003
|
} else if (preserved > 0) {
|
|
31001
31004
|
parts.push(
|
|
31002
|
-
`\u2705
|
|
31005
|
+
`\u2705 Customizations automatically preserved, but ${plural(conflicts2, "file")} ${conflicts2 === 1 ? "needs" : "need"} your attention.`
|
|
31003
31006
|
);
|
|
31004
31007
|
}
|
|
31005
31008
|
if (conflicts2 > 0) {
|
|
@@ -31161,13 +31164,6 @@ var GithubStep = class extends BaseStep {
|
|
|
31161
31164
|
const now = /* @__PURE__ */ new Date();
|
|
31162
31165
|
const formattedDate = now.toISOString().replace("T", "_").replace(/:/g, "-").replace("Z", "").replace(".", "_");
|
|
31163
31166
|
const newPrBranch = `fern-bot/${formattedDate}`;
|
|
31164
|
-
try {
|
|
31165
|
-
await repository.setUserAndEmail({
|
|
31166
|
-
name: FERN_BOT_NAME,
|
|
31167
|
-
email: FERN_BOT_EMAIL
|
|
31168
|
-
});
|
|
31169
|
-
} catch {
|
|
31170
|
-
}
|
|
31171
31167
|
const mode = this.config.mode;
|
|
31172
31168
|
switch (mode) {
|
|
31173
31169
|
case "pull-request":
|
|
@@ -31855,6 +31851,13 @@ var PostGenerationPipeline = class {
|
|
|
31855
31851
|
}
|
|
31856
31852
|
steps = [];
|
|
31857
31853
|
async run() {
|
|
31854
|
+
if (this.config.github?.enabled) {
|
|
31855
|
+
try {
|
|
31856
|
+
(0, import_child_process4.execFileSync)("git", ["config", "user.name", FERN_BOT_NAME], { cwd: this.config.outputDir });
|
|
31857
|
+
(0, import_child_process4.execFileSync)("git", ["config", "user.email", FERN_BOT_EMAIL], { cwd: this.config.outputDir });
|
|
31858
|
+
} catch {
|
|
31859
|
+
}
|
|
31860
|
+
}
|
|
31858
31861
|
const result = {
|
|
31859
31862
|
success: true,
|
|
31860
31863
|
steps: {}
|