@fern-api/generator-cli 0.11.0 → 0.12.1
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 +10 -3
- package/dist/cli.js +135 -51
- package/package.json +1 -1
package/dist/api.js
CHANGED
|
@@ -6303,12 +6303,18 @@ function newRepositoryReference({ remote, owner, repo }) {
|
|
|
6303
6303
|
repoUrl,
|
|
6304
6304
|
cloneUrl,
|
|
6305
6305
|
getAuthedCloneUrl: (installationToken) => {
|
|
6306
|
-
const
|
|
6307
|
-
const userPrefix = isInstallationToken ? "x-access-token:" : "";
|
|
6306
|
+
const userPrefix = isGithubAppToken(installationToken) ? "x-access-token:" : "";
|
|
6308
6307
|
return cloneUrl.replace("https://", `https://${userPrefix}${installationToken}@`);
|
|
6309
6308
|
}
|
|
6310
6309
|
};
|
|
6311
6310
|
}
|
|
6311
|
+
function getGitAuthorizationHeader(installationToken) {
|
|
6312
|
+
const credentials = isGithubAppToken(installationToken) ? `x-access-token:${installationToken}` : `${installationToken}:`;
|
|
6313
|
+
return `Authorization: Basic ${Buffer.from(credentials).toString("base64")}`;
|
|
6314
|
+
}
|
|
6315
|
+
function isGithubAppToken(token) {
|
|
6316
|
+
return token.startsWith("ghs_") || token.startsWith("ghu_");
|
|
6317
|
+
}
|
|
6312
6318
|
function getRepoUrl({ remote, owner, repo }) {
|
|
6313
6319
|
return `https://${remote}/${owner}/${repo}`;
|
|
6314
6320
|
}
|
|
@@ -6369,7 +6375,8 @@ async function cloneRepository({ githubRepository, installationToken, targetDire
|
|
|
6369
6375
|
});
|
|
6370
6376
|
const startTime = Date.now();
|
|
6371
6377
|
try {
|
|
6372
|
-
|
|
6378
|
+
const cloneOptions = installationToken != null ? ["--config", `http.extraHeader=${getGitAuthorizationHeader(installationToken)}`] : [];
|
|
6379
|
+
await git.clone(cloneUrl, ".", cloneOptions);
|
|
6373
6380
|
} catch (error) {
|
|
6374
6381
|
const elapsed = Date.now() - startTime;
|
|
6375
6382
|
const errorMessage = extractErrorMessage(error);
|
package/dist/cli.js
CHANGED
|
@@ -41,6 +41,52 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
41
41
|
mod
|
|
42
42
|
));
|
|
43
43
|
|
|
44
|
+
// ../commons/core-utils/lib/errorMessageOrString.js
|
|
45
|
+
function errorMessageOrString(error) {
|
|
46
|
+
return error instanceof Error ? error.message : String(error);
|
|
47
|
+
}
|
|
48
|
+
var init_errorMessageOrString = __esm({
|
|
49
|
+
"../commons/core-utils/lib/errorMessageOrString.js"() {
|
|
50
|
+
"use strict";
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// ../commons/core-utils/lib/examples.js
|
|
55
|
+
var init_examples = __esm({
|
|
56
|
+
"../commons/core-utils/lib/examples.js"() {
|
|
57
|
+
"use strict";
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// ../commons/core-utils/lib/extractErrorMessage.js
|
|
62
|
+
function extractErrorMessage(e) {
|
|
63
|
+
if (typeof e === "string") {
|
|
64
|
+
return e.length > 0 ? e : "Unknown error";
|
|
65
|
+
}
|
|
66
|
+
if (e instanceof Error) {
|
|
67
|
+
return e.message.length > 0 ? e.message : "Unknown error";
|
|
68
|
+
}
|
|
69
|
+
if (typeof e === "object" && e !== null && "message" in e && typeof e["message"] === "string") {
|
|
70
|
+
return e["message"].length > 0 ? e["message"] : "Unknown error";
|
|
71
|
+
}
|
|
72
|
+
const stringified = String(e);
|
|
73
|
+
return stringified.length > 0 ? stringified : "Unknown error";
|
|
74
|
+
}
|
|
75
|
+
var init_extractErrorMessage = __esm({
|
|
76
|
+
"../commons/core-utils/lib/extractErrorMessage.js"() {
|
|
77
|
+
"use strict";
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// ../commons/core-utils/lib/fernEnvVars.js
|
|
82
|
+
var FERN_JAVA_SKIP_FORMATTING_ENV_VAR;
|
|
83
|
+
var init_fernEnvVars = __esm({
|
|
84
|
+
"../commons/core-utils/lib/fernEnvVars.js"() {
|
|
85
|
+
"use strict";
|
|
86
|
+
FERN_JAVA_SKIP_FORMATTING_ENV_VAR = "FERN_JAVA_SKIP_FORMATTING";
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
44
90
|
// ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/constants.js
|
|
45
91
|
var require_constants = __commonJS({
|
|
46
92
|
"../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/constants.js"(exports2, module2) {
|
|
@@ -2034,6 +2080,17 @@ var require_semver2 = __commonJS({
|
|
|
2034
2080
|
}
|
|
2035
2081
|
});
|
|
2036
2082
|
|
|
2083
|
+
// ../commons/core-utils/lib/index.js
|
|
2084
|
+
var init_lib = __esm({
|
|
2085
|
+
"../commons/core-utils/lib/index.js"() {
|
|
2086
|
+
"use strict";
|
|
2087
|
+
init_errorMessageOrString();
|
|
2088
|
+
init_examples();
|
|
2089
|
+
init_extractErrorMessage();
|
|
2090
|
+
init_fernEnvVars();
|
|
2091
|
+
}
|
|
2092
|
+
});
|
|
2093
|
+
|
|
2037
2094
|
// ../../node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js
|
|
2038
2095
|
var balanced, maybeMatch, range;
|
|
2039
2096
|
var init_esm = __esm({
|
|
@@ -7119,18 +7176,18 @@ var require_build3 = __commonJS({
|
|
|
7119
7176
|
var require_sync = __commonJS({
|
|
7120
7177
|
"../../node_modules/.pnpm/escalade@3.2.0/node_modules/escalade/sync/index.js"(exports2, module2) {
|
|
7121
7178
|
"use strict";
|
|
7122
|
-
var { dirname:
|
|
7179
|
+
var { dirname: dirname7, resolve: resolve8 } = require("path");
|
|
7123
7180
|
var { readdirSync: readdirSync2, statSync: statSync4 } = require("fs");
|
|
7124
7181
|
module2.exports = function(start, callback) {
|
|
7125
7182
|
let dir = resolve8(".", start);
|
|
7126
7183
|
let tmp4, stats = statSync4(dir);
|
|
7127
7184
|
if (!stats.isDirectory()) {
|
|
7128
|
-
dir =
|
|
7185
|
+
dir = dirname7(dir);
|
|
7129
7186
|
}
|
|
7130
7187
|
while (true) {
|
|
7131
7188
|
tmp4 = callback(dir, readdirSync2(dir));
|
|
7132
7189
|
if (tmp4) return resolve8(dir, tmp4);
|
|
7133
|
-
dir =
|
|
7190
|
+
dir = dirname7(tmp4 = dir);
|
|
7134
7191
|
if (tmp4 === dir) break;
|
|
7135
7192
|
}
|
|
7136
7193
|
};
|
|
@@ -7168,7 +7225,7 @@ var require_require_directory = __commonJS({
|
|
|
7168
7225
|
var fs3 = require("fs");
|
|
7169
7226
|
var join19 = require("path").join;
|
|
7170
7227
|
var resolve8 = require("path").resolve;
|
|
7171
|
-
var
|
|
7228
|
+
var dirname7 = require("path").dirname;
|
|
7172
7229
|
var defaultOptions2 = {
|
|
7173
7230
|
extensions: ["js", "json", "coffee"],
|
|
7174
7231
|
recurse: true,
|
|
@@ -7201,7 +7258,7 @@ var require_require_directory = __commonJS({
|
|
|
7201
7258
|
options[prop] = defaultOptions2[prop];
|
|
7202
7259
|
}
|
|
7203
7260
|
}
|
|
7204
|
-
path5 = !path5 ?
|
|
7261
|
+
path5 = !path5 ? dirname7(m.filename) : resolve8(dirname7(m.filename), path5);
|
|
7205
7262
|
fs3.readdirSync(path5).forEach(function(filename) {
|
|
7206
7263
|
var joined = join19(path5, filename), files, key, obj;
|
|
7207
7264
|
if (fs3.statSync(joined).isDirectory() && options.recurse) {
|
|
@@ -30376,7 +30433,7 @@ async function loadBamlDependencies() {
|
|
|
30376
30433
|
configureBamlClient: config.configureBamlClient
|
|
30377
30434
|
};
|
|
30378
30435
|
} catch (error) {
|
|
30379
|
-
const original =
|
|
30436
|
+
const original = errorMessageOrString(error);
|
|
30380
30437
|
throw new Error(`${INSTALL_MESSAGE}
|
|
30381
30438
|
|
|
30382
30439
|
Original error: ${original}`);
|
|
@@ -30386,6 +30443,7 @@ var INSTALL_MESSAGE;
|
|
|
30386
30443
|
var init_loader = __esm({
|
|
30387
30444
|
"../cli/ai/lib/loader.js"() {
|
|
30388
30445
|
"use strict";
|
|
30446
|
+
init_lib();
|
|
30389
30447
|
INSTALL_MESSAGE = "@boundaryml/baml is required for AI features (auto-versioning, sdk-diff).\nInstall it with:\n npm install @boundaryml/baml\n pnpm add @boundaryml/baml";
|
|
30390
30448
|
}
|
|
30391
30449
|
});
|
|
@@ -30410,7 +30468,7 @@ __export(lib_exports, {
|
|
|
30410
30468
|
VersionBump: () => VersionBump3,
|
|
30411
30469
|
loadBamlDependencies: () => loadBamlDependencies
|
|
30412
30470
|
});
|
|
30413
|
-
var
|
|
30471
|
+
var init_lib2 = __esm({
|
|
30414
30472
|
"../cli/ai/lib/index.js"() {
|
|
30415
30473
|
"use strict";
|
|
30416
30474
|
init_loader();
|
|
@@ -30418,23 +30476,8 @@ var init_lib = __esm({
|
|
|
30418
30476
|
}
|
|
30419
30477
|
});
|
|
30420
30478
|
|
|
30421
|
-
//
|
|
30422
|
-
|
|
30423
|
-
if (typeof e === "string") {
|
|
30424
|
-
return e.length > 0 ? e : "Unknown error";
|
|
30425
|
-
}
|
|
30426
|
-
if (e instanceof Error) {
|
|
30427
|
-
return e.message.length > 0 ? e.message : "Unknown error";
|
|
30428
|
-
}
|
|
30429
|
-
if (typeof e === "object" && e !== null && "message" in e && typeof e["message"] === "string") {
|
|
30430
|
-
return e["message"].length > 0 ? e["message"] : "Unknown error";
|
|
30431
|
-
}
|
|
30432
|
-
const stringified = String(e);
|
|
30433
|
-
return stringified.length > 0 ? stringified : "Unknown error";
|
|
30434
|
-
}
|
|
30435
|
-
|
|
30436
|
-
// ../commons/core-utils/lib/fernEnvVars.js
|
|
30437
|
-
var FERN_JAVA_SKIP_FORMATTING_ENV_VAR = "FERN_JAVA_SKIP_FORMATTING";
|
|
30479
|
+
// src/cli.ts
|
|
30480
|
+
init_lib();
|
|
30438
30481
|
|
|
30439
30482
|
// ../commons/path-utils/lib/convertToOsPath.js
|
|
30440
30483
|
function convertToOsPath(path5) {
|
|
@@ -30472,7 +30515,7 @@ function resolve(...paths) {
|
|
|
30472
30515
|
// src/cli.ts
|
|
30473
30516
|
var import_fs18 = __toESM(require("fs"));
|
|
30474
30517
|
var import_promises19 = require("fs/promises");
|
|
30475
|
-
var
|
|
30518
|
+
var import_path28 = __toESM(require("path"));
|
|
30476
30519
|
|
|
30477
30520
|
// ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/build/lib/yerror.js
|
|
30478
30521
|
var YError = class _YError extends Error {
|
|
@@ -32448,6 +32491,7 @@ async function doesPathExist2(filepath) {
|
|
|
32448
32491
|
}
|
|
32449
32492
|
|
|
32450
32493
|
// ../commons/github/lib/cloneRepository.js
|
|
32494
|
+
init_lib();
|
|
32451
32495
|
var import_child_process2 = require("child_process");
|
|
32452
32496
|
init_esm4();
|
|
32453
32497
|
var import_tmp_promise = __toESM(require_tmp_promise(), 1);
|
|
@@ -32486,12 +32530,18 @@ function newRepositoryReference({ remote, owner, repo }) {
|
|
|
32486
32530
|
repoUrl,
|
|
32487
32531
|
cloneUrl,
|
|
32488
32532
|
getAuthedCloneUrl: (installationToken) => {
|
|
32489
|
-
const
|
|
32490
|
-
const userPrefix = isInstallationToken ? "x-access-token:" : "";
|
|
32533
|
+
const userPrefix = isGithubAppToken(installationToken) ? "x-access-token:" : "";
|
|
32491
32534
|
return cloneUrl.replace("https://", `https://${userPrefix}${installationToken}@`);
|
|
32492
32535
|
}
|
|
32493
32536
|
};
|
|
32494
32537
|
}
|
|
32538
|
+
function getGitAuthorizationHeader(installationToken) {
|
|
32539
|
+
const credentials = isGithubAppToken(installationToken) ? `x-access-token:${installationToken}` : `${installationToken}:`;
|
|
32540
|
+
return `Authorization: Basic ${Buffer.from(credentials).toString("base64")}`;
|
|
32541
|
+
}
|
|
32542
|
+
function isGithubAppToken(token) {
|
|
32543
|
+
return token.startsWith("ghs_") || token.startsWith("ghu_");
|
|
32544
|
+
}
|
|
32495
32545
|
function getRepoUrl({ remote, owner, repo }) {
|
|
32496
32546
|
return `https://${remote}/${owner}/${repo}`;
|
|
32497
32547
|
}
|
|
@@ -32552,7 +32602,8 @@ async function cloneRepository({ githubRepository, installationToken, targetDire
|
|
|
32552
32602
|
});
|
|
32553
32603
|
const startTime = Date.now();
|
|
32554
32604
|
try {
|
|
32555
|
-
|
|
32605
|
+
const cloneOptions = installationToken != null ? ["--config", `http.extraHeader=${getGitAuthorizationHeader(installationToken)}`] : [];
|
|
32606
|
+
await git.clone(cloneUrl, ".", cloneOptions);
|
|
32556
32607
|
} catch (error) {
|
|
32557
32608
|
const elapsed = Date.now() - startTime;
|
|
32558
32609
|
const errorMessage = extractErrorMessage(error);
|
|
@@ -40606,6 +40657,7 @@ var consolePipelineLogger = {
|
|
|
40606
40657
|
};
|
|
40607
40658
|
|
|
40608
40659
|
// src/pipeline/PostGenerationPipeline.ts
|
|
40660
|
+
init_lib();
|
|
40609
40661
|
var import_child_process8 = require("child_process");
|
|
40610
40662
|
|
|
40611
40663
|
// src/pipeline/github/constants.ts
|
|
@@ -42874,7 +42926,7 @@ ${body}` : `${COMMIT_MARKER} ${subject}`;
|
|
|
42874
42926
|
if (this.config.ai == null) {
|
|
42875
42927
|
throw new Error("AutoVersionStep: ai config is missing. Set autoVersion.ai to a BAML provider+model pair.");
|
|
42876
42928
|
}
|
|
42877
|
-
const { loadBamlDependencies: loadBamlDependencies2, VersionBump: VersionBump4 } = await Promise.resolve().then(() => (
|
|
42929
|
+
const { loadBamlDependencies: loadBamlDependencies2, VersionBump: VersionBump4 } = await Promise.resolve().then(() => (init_lib2(), lib_exports));
|
|
42878
42930
|
const { BamlClient, configureBamlClient: configureBamlClient2 } = await loadBamlDependencies2();
|
|
42879
42931
|
const registry = configureBamlClient2(this.config.ai);
|
|
42880
42932
|
return {
|
|
@@ -43160,6 +43212,7 @@ function tryRevParse(cwd2, rev) {
|
|
|
43160
43212
|
}
|
|
43161
43213
|
|
|
43162
43214
|
// src/pipeline/steps/GithubStep.ts
|
|
43215
|
+
init_lib();
|
|
43163
43216
|
var import_promises17 = require("fs/promises");
|
|
43164
43217
|
var import_path25 = require("path");
|
|
43165
43218
|
|
|
@@ -43188,6 +43241,7 @@ async function createReplayBranch(repository, branchName, commitMessage, replayC
|
|
|
43188
43241
|
}
|
|
43189
43242
|
|
|
43190
43243
|
// src/pipeline/github/findExistingUpdatablePR.ts
|
|
43244
|
+
init_lib();
|
|
43191
43245
|
async function findExistingUpdatablePR(octokit, owner, repo, baseBranch, logger) {
|
|
43192
43246
|
try {
|
|
43193
43247
|
const { data: pulls } = await octokit.pulls.list({
|
|
@@ -43299,6 +43353,7 @@ ${prBody}`;
|
|
|
43299
43353
|
}
|
|
43300
43354
|
|
|
43301
43355
|
// src/pipeline/github/pushSignedCommit.ts
|
|
43356
|
+
init_lib();
|
|
43302
43357
|
var MAX_CONCURRENT_PUSH_RETRIES = 3;
|
|
43303
43358
|
var MAX_SIGNED_CHAIN_LENGTH = 20;
|
|
43304
43359
|
var PAT_TOKEN_PREFIXES = ["ghp_", "github_pat_"];
|
|
@@ -43775,6 +43830,9 @@ var GithubStep = class extends BaseStep {
|
|
|
43775
43830
|
} catch (error) {
|
|
43776
43831
|
this.logger.debug(`Failed to update PR title/body: ${extractErrorMessage(error)}`);
|
|
43777
43832
|
}
|
|
43833
|
+
if (shouldEnableAutomerge(this.config, resolved)) {
|
|
43834
|
+
await this.tryEnableAutomerge(octokit, existingPR.nodeId, existingPR.number, result);
|
|
43835
|
+
}
|
|
43778
43836
|
} else {
|
|
43779
43837
|
const head = `${owner}:${prBranch}`;
|
|
43780
43838
|
try {
|
|
@@ -43790,21 +43848,7 @@ var GithubStep = class extends BaseStep {
|
|
|
43790
43848
|
result.prUrl = pullRequest.html_url;
|
|
43791
43849
|
result.prNumber = pullRequest.number;
|
|
43792
43850
|
if (shouldEnableAutomerge(this.config, resolved) && pullRequest.node_id) {
|
|
43793
|
-
|
|
43794
|
-
await octokit.graphql(
|
|
43795
|
-
`mutation($pullRequestId: ID!) {
|
|
43796
|
-
enablePullRequestAutoMerge(input: {
|
|
43797
|
-
pullRequestId: $pullRequestId,
|
|
43798
|
-
mergeMethod: SQUASH
|
|
43799
|
-
}) { clientMutationId }
|
|
43800
|
-
}`,
|
|
43801
|
-
{ pullRequestId: pullRequest.node_id }
|
|
43802
|
-
);
|
|
43803
|
-
this.logger.info(`Enabled automerge on PR #${pullRequest.number}`);
|
|
43804
|
-
result.autoMergeEnabled = true;
|
|
43805
|
-
} catch (autoMergeError) {
|
|
43806
|
-
this.logger.warn(`Could not enable automerge: ${extractErrorMessage(autoMergeError)}`);
|
|
43807
|
-
}
|
|
43851
|
+
await this.tryEnableAutomerge(octokit, pullRequest.node_id, pullRequest.number, result);
|
|
43808
43852
|
}
|
|
43809
43853
|
} catch (error) {
|
|
43810
43854
|
const message = extractErrorMessage(error);
|
|
@@ -43817,6 +43861,28 @@ var GithubStep = class extends BaseStep {
|
|
|
43817
43861
|
}
|
|
43818
43862
|
return result;
|
|
43819
43863
|
}
|
|
43864
|
+
/**
|
|
43865
|
+
* Enables GitHub automerge on a non-breaking PR (newly created or updated) via the built-in
|
|
43866
|
+
* octokit.graphql() from @octokit/core. The SDK repo's own branch protection rules govern
|
|
43867
|
+
* whether the PR actually merges.
|
|
43868
|
+
*/
|
|
43869
|
+
async tryEnableAutomerge(octokit, pullRequestNodeId, pullRequestNumber, result) {
|
|
43870
|
+
try {
|
|
43871
|
+
await octokit.graphql(
|
|
43872
|
+
`mutation($pullRequestId: ID!) {
|
|
43873
|
+
enablePullRequestAutoMerge(input: {
|
|
43874
|
+
pullRequestId: $pullRequestId,
|
|
43875
|
+
mergeMethod: SQUASH
|
|
43876
|
+
}) { clientMutationId }
|
|
43877
|
+
}`,
|
|
43878
|
+
{ pullRequestId: pullRequestNodeId }
|
|
43879
|
+
);
|
|
43880
|
+
this.logger.info(`Enabled automerge on PR #${pullRequestNumber}`);
|
|
43881
|
+
result.autoMergeEnabled = true;
|
|
43882
|
+
} catch (autoMergeError) {
|
|
43883
|
+
this.logger.warn(`Could not enable automerge: ${extractErrorMessage(autoMergeError)}`);
|
|
43884
|
+
}
|
|
43885
|
+
}
|
|
43820
43886
|
async executePushMode(repository, resolved) {
|
|
43821
43887
|
const baseBranch = this.config.branch ?? await repository.getDefaultBranch();
|
|
43822
43888
|
if (this.config.branch != null) {
|
|
@@ -44057,7 +44123,7 @@ _Fern Run ID: \`${config.runId}\`_`;
|
|
|
44057
44123
|
function shouldEnableAutomerge(config, breaking = {}) {
|
|
44058
44124
|
const hasBreakingChanges = breaking.hasBreakingChanges ?? config.hasBreakingChanges;
|
|
44059
44125
|
const analysisUnavailable = breaking.analysisWarning != null && breaking.analysisWarning.length > 0;
|
|
44060
|
-
return config.
|
|
44126
|
+
return config.autoMerge === true && hasBreakingChanges !== true && !analysisUnavailable;
|
|
44061
44127
|
}
|
|
44062
44128
|
function shouldCheckNoDiff(config) {
|
|
44063
44129
|
return config.skipIfNoDiff === true;
|
|
@@ -44255,6 +44321,9 @@ var ReplayStep = class extends BaseStep {
|
|
|
44255
44321
|
}
|
|
44256
44322
|
};
|
|
44257
44323
|
|
|
44324
|
+
// src/pipeline/steps/VerificationStep.ts
|
|
44325
|
+
init_lib();
|
|
44326
|
+
|
|
44258
44327
|
// ../cli/generation/local-generation/docker-utils/lib/dockerHubOatLogin.js
|
|
44259
44328
|
var DOCKERHUB_OAT_ENV_VAR = "DOCKERHUB_OAT";
|
|
44260
44329
|
var DOCKERHUB_OAT_USERNAME_ENV_VAR = "DOCKERHUB_OAT_USERNAME";
|
|
@@ -44317,9 +44386,11 @@ ${stderr}`);
|
|
|
44317
44386
|
|
|
44318
44387
|
// ../cli/generation/local-generation/docker-utils/lib/runDocker.js
|
|
44319
44388
|
var import_promises18 = require("fs/promises");
|
|
44389
|
+
var import_path26 = require("path");
|
|
44320
44390
|
var import_tmp_promise3 = __toESM(require_tmp_promise(), 1);
|
|
44321
44391
|
|
|
44322
44392
|
// ../cli/generation/local-generation/docker-utils/lib/buildContainerEnvVars.js
|
|
44393
|
+
init_lib();
|
|
44323
44394
|
var FORWARDED_ENV_VARS = ["FERN_STACK_TRACK", FERN_JAVA_SKIP_FORMATTING_ENV_VAR];
|
|
44324
44395
|
function buildContainerEnvVars({ envVars, processEnv }) {
|
|
44325
44396
|
const forwardedEntries = FORWARDED_ENV_VARS.filter((name) => envVars[name] == null).map((name) => [name, processEnv[name]]).filter((entry) => entry[1] != null && entry[1] !== "");
|
|
@@ -44391,9 +44462,7 @@ async function execInContainer({ logger, containerId, command, runner, envVars =
|
|
|
44391
44462
|
});
|
|
44392
44463
|
const logs = stdout + stderr;
|
|
44393
44464
|
if (writeLogsToFile) {
|
|
44394
|
-
|
|
44395
|
-
await (0, import_promises18.writeFile)(tmpFile.path, logs);
|
|
44396
|
-
logger.info(`Generator logs here: ${tmpFile.path}`);
|
|
44465
|
+
await writeLogsFile({ logger, logs });
|
|
44397
44466
|
}
|
|
44398
44467
|
const resolvedExitCode = exitCode ?? 1;
|
|
44399
44468
|
if (reject && resolvedExitCode !== 0) {
|
|
@@ -44422,6 +44491,21 @@ async function stopContainer({ logger, containerId, runner }) {
|
|
|
44422
44491
|
doNotPipeOutput: true
|
|
44423
44492
|
});
|
|
44424
44493
|
}
|
|
44494
|
+
async function writeLogsFile({ logger, logs, logFilePath }) {
|
|
44495
|
+
if (logFilePath != null) {
|
|
44496
|
+
try {
|
|
44497
|
+
await (0, import_promises18.mkdir)((0, import_path26.dirname)(logFilePath), { recursive: true });
|
|
44498
|
+
await (0, import_promises18.writeFile)(logFilePath, logs);
|
|
44499
|
+
logger.info(`Generator logs here: ${logFilePath}`);
|
|
44500
|
+
return;
|
|
44501
|
+
} catch (error) {
|
|
44502
|
+
logger.warn(`Failed to write logs to ${logFilePath} (${String(error)}); using a temporary file instead.`);
|
|
44503
|
+
}
|
|
44504
|
+
}
|
|
44505
|
+
const tmpFile = await import_tmp_promise3.default.file();
|
|
44506
|
+
await (0, import_promises18.writeFile)(tmpFile.path, logs);
|
|
44507
|
+
logger.info(`Generator logs here: ${tmpFile.path}`);
|
|
44508
|
+
}
|
|
44425
44509
|
|
|
44426
44510
|
// ../cli/logger/lib/LogLevel.js
|
|
44427
44511
|
var LogLevel2 = {
|
|
@@ -44479,7 +44563,7 @@ function createLogger4(log) {
|
|
|
44479
44563
|
|
|
44480
44564
|
// src/pipeline/steps/VerificationStep.ts
|
|
44481
44565
|
var import_fs17 = require("fs");
|
|
44482
|
-
var
|
|
44566
|
+
var import_path27 = require("path");
|
|
44483
44567
|
var CONTAINER_WORKSPACE_PATH = "/workspace";
|
|
44484
44568
|
var VERIFY_SCRIPT_RELATIVE_PATH = ".fern/verify.sh";
|
|
44485
44569
|
var VERIFY_SCRIPT_CONTAINER_PATH = `${CONTAINER_WORKSPACE_PATH}/${VERIFY_SCRIPT_RELATIVE_PATH}`;
|
|
@@ -44495,7 +44579,7 @@ var VerificationStep = class extends BaseStep {
|
|
|
44495
44579
|
generatorVersions;
|
|
44496
44580
|
name = "verify";
|
|
44497
44581
|
async execute(_context) {
|
|
44498
|
-
const verifyScriptHostPath = (0,
|
|
44582
|
+
const verifyScriptHostPath = (0, import_path27.join)(this.outputDir, VERIFY_SCRIPT_RELATIVE_PATH);
|
|
44499
44583
|
if (!(0, import_fs17.existsSync)(verifyScriptHostPath)) {
|
|
44500
44584
|
return { executed: true, success: true, skipped: true };
|
|
44501
44585
|
}
|
|
@@ -45195,7 +45279,7 @@ async function createWriteStream(outputPath) {
|
|
|
45195
45279
|
}
|
|
45196
45280
|
async function createWriteStreamFromFile(filepath) {
|
|
45197
45281
|
if (!await doesPathExist(filepath)) {
|
|
45198
|
-
await (0, import_promises19.mkdir)(
|
|
45282
|
+
await (0, import_promises19.mkdir)(import_path28.default.dirname(filepath), { recursive: true });
|
|
45199
45283
|
}
|
|
45200
45284
|
return import_fs18.default.createWriteStream(filepath);
|
|
45201
45285
|
}
|