@fern-api/fern-api-dev 4.87.0-8-g09119efe4e3 → 4.87.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.
- package/cli.cjs +11 -174
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -58626,46 +58626,6 @@ var init_ClonedRepository = __esm({
|
|
|
58626
58626
|
const result = await this.git.raw(["rev-parse", "HEAD^{tree}"]);
|
|
58627
58627
|
return result.trim();
|
|
58628
58628
|
}
|
|
58629
|
-
async getHeadCommitMessage() {
|
|
58630
|
-
await this.git.cwd(this.clonePath);
|
|
58631
|
-
const result = await this.git.raw(["log", "-1", "--format=%B", "HEAD"]);
|
|
58632
|
-
return result.replace(/\n$/, "");
|
|
58633
|
-
}
|
|
58634
|
-
async getHeadParents() {
|
|
58635
|
-
await this.git.cwd(this.clonePath);
|
|
58636
|
-
const result = await this.git.raw(["rev-list", "--parents", "-n", "1", "HEAD"]);
|
|
58637
|
-
const parts = result.trim().split(/\s+/);
|
|
58638
|
-
return parts.slice(1);
|
|
58639
|
-
}
|
|
58640
|
-
/**
|
|
58641
|
-
* Pushes a specific object (commit SHA) to a remote ref.
|
|
58642
|
-
* Used to upload tree and blob objects to the remote without moving a branch.
|
|
58643
|
-
*
|
|
58644
|
-
* Pass `force: true` when overwriting a ref that may already point to an
|
|
58645
|
-
* unrelated commit (e.g. retrying a temp ref after a local rebase rewrites
|
|
58646
|
-
* history so the new SHA is not a descendant of the previous one).
|
|
58647
|
-
*/
|
|
58648
|
-
async pushObjectToRef(localSha, remoteRef, { force = false } = {}) {
|
|
58649
|
-
await this.git.cwd(this.clonePath);
|
|
58650
|
-
const spec = force ? `+${localSha}:${remoteRef}` : `${localSha}:${remoteRef}`;
|
|
58651
|
-
await this.git.raw(["push", "origin", spec]);
|
|
58652
|
-
}
|
|
58653
|
-
/**
|
|
58654
|
-
* Resets the current branch HEAD to the given SHA. After fetching a newly-created remote
|
|
58655
|
-
* signed commit, use this to align the local branch so subsequent operations (tag push,
|
|
58656
|
-
* getHeadSha(), etc.) see the signed SHA.
|
|
58657
|
-
*/
|
|
58658
|
-
async resetHardToSha(sha) {
|
|
58659
|
-
await this.git.cwd(this.clonePath);
|
|
58660
|
-
await this.git.raw(["reset", "--hard", sha]);
|
|
58661
|
-
}
|
|
58662
|
-
/**
|
|
58663
|
-
* Rebases the current branch onto the given remote branch (`git pull --rebase origin <branch>`).
|
|
58664
|
-
*/
|
|
58665
|
-
async pullWithRebase(branch) {
|
|
58666
|
-
await this.git.cwd(this.clonePath);
|
|
58667
|
-
await this.git.raw(["pull", "origin", branch, "--rebase"]);
|
|
58668
|
-
}
|
|
58669
58629
|
async getCommitTreeHash(commitSha) {
|
|
58670
58630
|
await this.git.cwd(this.clonePath);
|
|
58671
58631
|
const result = await this.git.raw(["rev-parse", `${commitSha}^{tree}`]);
|
|
@@ -330837,113 +330797,6 @@ ${prBody}`;
|
|
|
330837
330797
|
}
|
|
330838
330798
|
});
|
|
330839
330799
|
|
|
330840
|
-
// ../../generator-cli/lib/pipeline/github/pushSignedCommit.js
|
|
330841
|
-
var require_pushSignedCommit = __commonJS({
|
|
330842
|
-
"../../generator-cli/lib/pipeline/github/pushSignedCommit.js"(exports2) {
|
|
330843
|
-
"use strict";
|
|
330844
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
330845
|
-
exports2.pushSignedCommit = pushSignedCommit;
|
|
330846
|
-
exports2.isNonFastForwardError = isNonFastForwardError;
|
|
330847
|
-
var core_utils_1 = (init_lib4(), __toCommonJS(lib_exports));
|
|
330848
|
-
var MAX_CONCURRENT_PUSH_RETRIES = 3;
|
|
330849
|
-
async function pushSignedCommit({ repository, octokit, owner, repo, branch, force, rebaseOnConflict = false, logger: logger4 }) {
|
|
330850
|
-
const tempRef = `refs/temp/fern-${Date.now()}`;
|
|
330851
|
-
let tempRefPushed = false;
|
|
330852
|
-
try {
|
|
330853
|
-
let [localHeadSha, treeSha, message, parents] = await Promise.all([
|
|
330854
|
-
repository.getHeadSha(),
|
|
330855
|
-
repository.getHeadTreeHash(),
|
|
330856
|
-
repository.getHeadCommitMessage(),
|
|
330857
|
-
repository.getHeadParents()
|
|
330858
|
-
]);
|
|
330859
|
-
await repository.pushObjectToRef(localHeadSha, tempRef);
|
|
330860
|
-
tempRefPushed = true;
|
|
330861
|
-
for (let attempt = 0; attempt < MAX_CONCURRENT_PUSH_RETRIES; attempt++) {
|
|
330862
|
-
const { data: signedCommit } = await octokit.git.createCommit({
|
|
330863
|
-
owner,
|
|
330864
|
-
repo,
|
|
330865
|
-
message,
|
|
330866
|
-
tree: treeSha,
|
|
330867
|
-
parents
|
|
330868
|
-
});
|
|
330869
|
-
const signedSha = signedCommit.sha;
|
|
330870
|
-
try {
|
|
330871
|
-
await upsertBranchRef({ octokit, owner, repo, branch, sha: signedSha, force });
|
|
330872
|
-
logger4.debug(`Updated refs/heads/${branch} to signed commit ${signedSha}`);
|
|
330873
|
-
await syncLocalToSignedCommit({ repository, branch, signedSha });
|
|
330874
|
-
return signedSha;
|
|
330875
|
-
} catch (err) {
|
|
330876
|
-
if (!isNonFastForwardError(err) || force || attempt >= MAX_CONCURRENT_PUSH_RETRIES - 1) {
|
|
330877
|
-
throw err;
|
|
330878
|
-
}
|
|
330879
|
-
if (rebaseOnConflict) {
|
|
330880
|
-
logger4.warn(`Non-fast-forward on refs/heads/${branch} (attempt ${attempt + 1}/${MAX_CONCURRENT_PUSH_RETRIES}); rebasing locally and retrying.`);
|
|
330881
|
-
await repository.pullWithRebase(branch);
|
|
330882
|
-
[localHeadSha, treeSha, message, parents] = await Promise.all([
|
|
330883
|
-
repository.getHeadSha(),
|
|
330884
|
-
repository.getHeadTreeHash(),
|
|
330885
|
-
repository.getHeadCommitMessage(),
|
|
330886
|
-
repository.getHeadParents()
|
|
330887
|
-
]);
|
|
330888
|
-
await repository.pushObjectToRef(localHeadSha, tempRef, { force: true });
|
|
330889
|
-
} else {
|
|
330890
|
-
throw err;
|
|
330891
|
-
}
|
|
330892
|
-
}
|
|
330893
|
-
}
|
|
330894
|
-
throw new Error(`Failed to push signed commit to refs/heads/${branch} after ${MAX_CONCURRENT_PUSH_RETRIES} attempts`);
|
|
330895
|
-
} finally {
|
|
330896
|
-
if (tempRefPushed) {
|
|
330897
|
-
try {
|
|
330898
|
-
await octokit.git.deleteRef({ owner, repo, ref: tempRef.replace(/^refs\//, "") });
|
|
330899
|
-
} catch (err) {
|
|
330900
|
-
logger4.debug(`Failed to delete temp ref ${tempRef}: ${(0, core_utils_1.extractErrorMessage)(err)}`);
|
|
330901
|
-
}
|
|
330902
|
-
}
|
|
330903
|
-
}
|
|
330904
|
-
}
|
|
330905
|
-
async function upsertBranchRef({ octokit, owner, repo, branch, sha, force }) {
|
|
330906
|
-
try {
|
|
330907
|
-
await octokit.git.updateRef({
|
|
330908
|
-
owner,
|
|
330909
|
-
repo,
|
|
330910
|
-
ref: `heads/${branch}`,
|
|
330911
|
-
sha,
|
|
330912
|
-
force
|
|
330913
|
-
});
|
|
330914
|
-
} catch (err) {
|
|
330915
|
-
if (isNotFoundError(err)) {
|
|
330916
|
-
await octokit.git.createRef({
|
|
330917
|
-
owner,
|
|
330918
|
-
repo,
|
|
330919
|
-
ref: `refs/heads/${branch}`,
|
|
330920
|
-
sha
|
|
330921
|
-
});
|
|
330922
|
-
return;
|
|
330923
|
-
}
|
|
330924
|
-
throw err;
|
|
330925
|
-
}
|
|
330926
|
-
}
|
|
330927
|
-
async function syncLocalToSignedCommit({ repository, branch, signedSha }) {
|
|
330928
|
-
await repository.fetch(["origin", branch]);
|
|
330929
|
-
await repository.resetHardToSha(signedSha);
|
|
330930
|
-
}
|
|
330931
|
-
function hasNumericStatus(err) {
|
|
330932
|
-
return typeof err === "object" && err != null && "status" in err && typeof err.status === "number";
|
|
330933
|
-
}
|
|
330934
|
-
function isNotFoundError(err) {
|
|
330935
|
-
return hasNumericStatus(err) && err.status === 404;
|
|
330936
|
-
}
|
|
330937
|
-
function isNonFastForwardError(err) {
|
|
330938
|
-
if (!hasNumericStatus(err) || err.status !== 422) {
|
|
330939
|
-
return false;
|
|
330940
|
-
}
|
|
330941
|
-
const message = (0, core_utils_1.extractErrorMessage)(err).toLowerCase();
|
|
330942
|
-
return message.includes("not a fast forward") || message.includes("not a fast-forward") || message.includes("update is not a fast forward");
|
|
330943
|
-
}
|
|
330944
|
-
}
|
|
330945
|
-
});
|
|
330946
|
-
|
|
330947
330800
|
// ../../generator-cli/lib/pipeline/replay-summary.js
|
|
330948
330801
|
var require_replay_summary = __commonJS({
|
|
330949
330802
|
"../../generator-cli/lib/pipeline/replay-summary.js"(exports2) {
|
|
@@ -331089,7 +330942,6 @@ var require_GithubStep = __commonJS({
|
|
|
331089
330942
|
var createReplayBranch_1 = require_createReplayBranch();
|
|
331090
330943
|
var findExistingUpdatablePR_1 = require_findExistingUpdatablePR();
|
|
331091
330944
|
var parseCommitMessage_1 = require_parseCommitMessage();
|
|
331092
|
-
var pushSignedCommit_1 = require_pushSignedCommit();
|
|
331093
330945
|
var replay_summary_1 = require_replay_summary();
|
|
331094
330946
|
var BaseStep_1 = require_BaseStep();
|
|
331095
330947
|
var GithubStep = class extends BaseStep_1.BaseStep {
|
|
@@ -331197,15 +331049,11 @@ var require_GithubStep = __commonJS({
|
|
|
331197
331049
|
updatedExistingPr: isUpdatingExistingPR
|
|
331198
331050
|
};
|
|
331199
331051
|
if (!this.config.previewMode) {
|
|
331200
|
-
|
|
331201
|
-
repository
|
|
331202
|
-
|
|
331203
|
-
|
|
331204
|
-
|
|
331205
|
-
branch: prBranch,
|
|
331206
|
-
force: isUpdatingExistingPR,
|
|
331207
|
-
logger: this.logger
|
|
331208
|
-
});
|
|
331052
|
+
if (isUpdatingExistingPR) {
|
|
331053
|
+
await repository.forcePush();
|
|
331054
|
+
} else {
|
|
331055
|
+
await repository.push();
|
|
331056
|
+
}
|
|
331209
331057
|
const pushedBranch = await repository.getCurrentBranch();
|
|
331210
331058
|
result.branchUrl = `https://github.com/${this.config.uri}/tree/${pushedBranch}`;
|
|
331211
331059
|
this.logger.info(`Pushed branch: ${result.branchUrl}`);
|
|
@@ -331306,18 +331154,7 @@ var require_GithubStep = __commonJS({
|
|
|
331306
331154
|
success: true
|
|
331307
331155
|
};
|
|
331308
331156
|
if (!this.config.previewMode) {
|
|
331309
|
-
|
|
331310
|
-
const { owner, repo } = (0, github_1.parseRepository)(this.config.uri);
|
|
331311
|
-
await (0, pushSignedCommit_1.pushSignedCommit)({
|
|
331312
|
-
repository,
|
|
331313
|
-
octokit,
|
|
331314
|
-
owner,
|
|
331315
|
-
repo,
|
|
331316
|
-
branch: baseBranch,
|
|
331317
|
-
force: false,
|
|
331318
|
-
rebaseOnConflict: true,
|
|
331319
|
-
logger: this.logger
|
|
331320
|
-
});
|
|
331157
|
+
await repository.pushWithRebasingRemote();
|
|
331321
331158
|
const pushedBranch = await repository.getCurrentBranch();
|
|
331322
331159
|
result.branchUrl = `https://github.com/${this.config.uri}/tree/${pushedBranch}`;
|
|
331323
331160
|
this.logger.info(`Pushed branch: ${result.branchUrl}`);
|
|
@@ -615211,7 +615048,7 @@ var AccessTokenPosthogManager = class {
|
|
|
615211
615048
|
properties: {
|
|
615212
615049
|
...event,
|
|
615213
615050
|
...event.properties,
|
|
615214
|
-
version: "4.87.0
|
|
615051
|
+
version: "4.87.0",
|
|
615215
615052
|
usingAccessToken: true
|
|
615216
615053
|
}
|
|
615217
615054
|
});
|
|
@@ -615265,7 +615102,7 @@ var UserPosthogManager = class {
|
|
|
615265
615102
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
615266
615103
|
event: "CLI",
|
|
615267
615104
|
properties: {
|
|
615268
|
-
version: "4.87.0
|
|
615105
|
+
version: "4.87.0",
|
|
615269
615106
|
...event,
|
|
615270
615107
|
...event.properties,
|
|
615271
615108
|
usingAccessToken: false,
|
|
@@ -832787,7 +832624,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
832787
832624
|
var LOGS_FOLDER_NAME = "logs";
|
|
832788
832625
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
832789
832626
|
function getCliSource() {
|
|
832790
|
-
const version7 = "4.87.0
|
|
832627
|
+
const version7 = "4.87.0";
|
|
832791
832628
|
return `cli@${version7}`;
|
|
832792
832629
|
}
|
|
832793
832630
|
var DebugLogger = class {
|
|
@@ -844535,7 +844372,7 @@ var LegacyDocsPublisher = class {
|
|
|
844535
844372
|
previewId,
|
|
844536
844373
|
disableTemplates: void 0,
|
|
844537
844374
|
skipUpload,
|
|
844538
|
-
cliVersion: "4.87.0
|
|
844375
|
+
cliVersion: "4.87.0"
|
|
844539
844376
|
});
|
|
844540
844377
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
844541
844378
|
return { success: false };
|
|
@@ -919923,7 +919760,7 @@ var CliContext = class _CliContext {
|
|
|
919923
919760
|
if (false) {
|
|
919924
919761
|
this.logger.error("CLI_VERSION is not defined");
|
|
919925
919762
|
}
|
|
919926
|
-
return "4.87.0
|
|
919763
|
+
return "4.87.0";
|
|
919927
919764
|
}
|
|
919928
919765
|
getCliName() {
|
|
919929
919766
|
if (false) {
|
package/package.json
CHANGED