@fern-api/generator-cli 0.9.54 → 0.9.56
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 +1 -1
- package/dist/cli.js +63 -27
- package/package.json +1 -1
package/dist/api.js
CHANGED
|
@@ -10834,7 +10834,7 @@ var ReadmeGenerator = class {
|
|
|
10834
10834
|
})
|
|
10835
10835
|
);
|
|
10836
10836
|
}
|
|
10837
|
-
if (this.readmeConfig.requirements != null) {
|
|
10837
|
+
if (this.readmeConfig.requirements != null && this.readmeConfig.requirements.length > 0) {
|
|
10838
10838
|
blocks.push(
|
|
10839
10839
|
await this.generateRequirements({
|
|
10840
10840
|
requirements: this.readmeConfig.requirements
|
package/dist/cli.js
CHANGED
|
@@ -30446,6 +30446,9 @@ function extractErrorMessage(e) {
|
|
|
30446
30446
|
return stringified.length > 0 ? stringified : "Unknown error";
|
|
30447
30447
|
}
|
|
30448
30448
|
|
|
30449
|
+
// ../commons/core-utils/lib/fernEnvVars.js
|
|
30450
|
+
var FERN_JAVA_SKIP_FORMATTING_ENV_VAR = "FERN_JAVA_SKIP_FORMATTING";
|
|
30451
|
+
|
|
30449
30452
|
// ../commons/path-utils/lib/convertToOsPath.js
|
|
30450
30453
|
function convertToOsPath(path5) {
|
|
30451
30454
|
return path5.replace(/\\/g, "/");
|
|
@@ -39242,7 +39245,7 @@ var ReadmeGenerator = class {
|
|
|
39242
39245
|
})
|
|
39243
39246
|
);
|
|
39244
39247
|
}
|
|
39245
|
-
if (this.readmeConfig.requirements != null) {
|
|
39248
|
+
if (this.readmeConfig.requirements != null && this.readmeConfig.requirements.length > 0) {
|
|
39246
39249
|
blocks.push(
|
|
39247
39250
|
await this.generateRequirements({
|
|
39248
39251
|
requirements: this.readmeConfig.requirements
|
|
@@ -43281,7 +43284,9 @@ var GithubStep = class extends BaseStep {
|
|
|
43281
43284
|
let isUpdatingExistingPR = false;
|
|
43282
43285
|
let generationBaseSha;
|
|
43283
43286
|
let existingPR;
|
|
43284
|
-
if (
|
|
43287
|
+
if (this.config.previewMode && this.config.token === "") {
|
|
43288
|
+
this.logger.debug("Preview mode without a GitHub token: skipping lookup of existing PRs");
|
|
43289
|
+
} else if (!this.config.automationMode) {
|
|
43285
43290
|
existingPR = await findExistingUpdatablePR(octokit, owner, repo, baseBranch, this.logger);
|
|
43286
43291
|
}
|
|
43287
43292
|
if (existingPR != null) {
|
|
@@ -43349,30 +43354,34 @@ var GithubStep = class extends BaseStep {
|
|
|
43349
43354
|
success: true,
|
|
43350
43355
|
updatedExistingPr: isUpdatingExistingPR
|
|
43351
43356
|
};
|
|
43352
|
-
if (
|
|
43353
|
-
|
|
43354
|
-
|
|
43355
|
-
|
|
43356
|
-
|
|
43357
|
-
|
|
43358
|
-
|
|
43359
|
-
|
|
43360
|
-
|
|
43361
|
-
|
|
43362
|
-
|
|
43363
|
-
|
|
43364
|
-
|
|
43365
|
-
this.
|
|
43366
|
-
|
|
43367
|
-
|
|
43368
|
-
|
|
43369
|
-
|
|
43370
|
-
|
|
43371
|
-
|
|
43372
|
-
|
|
43373
|
-
|
|
43374
|
-
|
|
43375
|
-
|
|
43357
|
+
if (this.config.previewMode) {
|
|
43358
|
+
this.logger.info(
|
|
43359
|
+
`Preview mode: changes committed locally on branch ${prBranch} at ${this.outputDir}; skipping push and pull request. Re-run without --preview to publish.`
|
|
43360
|
+
);
|
|
43361
|
+
return result;
|
|
43362
|
+
}
|
|
43363
|
+
await pushSignedCommit({
|
|
43364
|
+
repository,
|
|
43365
|
+
octokit,
|
|
43366
|
+
owner,
|
|
43367
|
+
repo,
|
|
43368
|
+
branch: prBranch,
|
|
43369
|
+
force: isUpdatingExistingPR,
|
|
43370
|
+
author: resolveCommitAuthor(this.config.token, this.config.author),
|
|
43371
|
+
logger: this.logger
|
|
43372
|
+
});
|
|
43373
|
+
const pushedBranch = await repository.getCurrentBranch();
|
|
43374
|
+
result.branchUrl = `https://${remote}/${owner}/${repo}/tree/${pushedBranch}`;
|
|
43375
|
+
this.logger.info(`Pushed branch: ${result.branchUrl}`);
|
|
43376
|
+
if (generationBaseSha != null) {
|
|
43377
|
+
try {
|
|
43378
|
+
const sanitizedName = this.config.generatorName?.replace(/\//g, "--");
|
|
43379
|
+
const tagName = sanitizedName != null ? `fern-generation-base--${sanitizedName}` : "fern-generation-base";
|
|
43380
|
+
await repository.createAndPushTag(tagName, generationBaseSha);
|
|
43381
|
+
this.logger.debug(`Pushed ${tagName} tag for generation tracking`);
|
|
43382
|
+
result.generationBaseTagSha = generationBaseSha;
|
|
43383
|
+
} catch (error) {
|
|
43384
|
+
this.logger.debug(`Could not push generation tag: ${extractErrorMessage(error)}`);
|
|
43376
43385
|
}
|
|
43377
43386
|
}
|
|
43378
43387
|
const headSha = await repository.getHeadSha();
|
|
@@ -43885,6 +43894,28 @@ var ReplayStep = class extends BaseStep {
|
|
|
43885
43894
|
// ../cli/generation/local-generation/docker-utils/lib/runDocker.js
|
|
43886
43895
|
var import_promises18 = require("fs/promises");
|
|
43887
43896
|
var import_tmp_promise3 = __toESM(require_tmp_promise(), 1);
|
|
43897
|
+
|
|
43898
|
+
// ../cli/generation/local-generation/docker-utils/lib/buildContainerEnvVars.js
|
|
43899
|
+
var FORWARDED_ENV_VARS = ["FERN_STACK_TRACK", FERN_JAVA_SKIP_FORMATTING_ENV_VAR];
|
|
43900
|
+
function buildContainerEnvVars({ envVars, processEnv }) {
|
|
43901
|
+
const forwardedEntries = FORWARDED_ENV_VARS.filter((name) => envVars[name] == null).map((name) => [name, processEnv[name]]).filter((entry) => entry[1] != null && entry[1] !== "");
|
|
43902
|
+
return {
|
|
43903
|
+
envVars: { ...Object.fromEntries(forwardedEntries), ...envVars },
|
|
43904
|
+
forwardedFromHost: forwardedEntries.map(([name]) => name)
|
|
43905
|
+
};
|
|
43906
|
+
}
|
|
43907
|
+
|
|
43908
|
+
// ../cli/generation/local-generation/docker-utils/lib/runDocker.js
|
|
43909
|
+
function logForwardedEnvVars({ logger, containerEnvVars, forwardedFromHost }) {
|
|
43910
|
+
for (const name of forwardedFromHost) {
|
|
43911
|
+
logger.info(`Forwarding ${name}=${containerEnvVars[name]} into the generator container`);
|
|
43912
|
+
}
|
|
43913
|
+
for (const name of FORWARDED_ENV_VARS) {
|
|
43914
|
+
if (!forwardedFromHost.includes(name) && containerEnvVars[name] == null) {
|
|
43915
|
+
logger.debug(`${name} is not set on the host; not forwarding it into the generator container`);
|
|
43916
|
+
}
|
|
43917
|
+
}
|
|
43918
|
+
}
|
|
43888
43919
|
async function pullImage(imageName, runner, signal) {
|
|
43889
43920
|
await loggingExeca(void 0, runner ?? "docker", ["pull", imageName], {
|
|
43890
43921
|
all: true,
|
|
@@ -43922,7 +43953,12 @@ ${stderr}`);
|
|
|
43922
43953
|
}
|
|
43923
43954
|
async function execInContainer({ logger, containerId, command, runner, envVars = {}, writeLogsToFile = true, reject = true }) {
|
|
43924
43955
|
const containerRunner = runner ?? "docker";
|
|
43925
|
-
const
|
|
43956
|
+
const { envVars: containerEnvVars, forwardedFromHost } = buildContainerEnvVars({
|
|
43957
|
+
envVars,
|
|
43958
|
+
processEnv: process.env
|
|
43959
|
+
});
|
|
43960
|
+
logForwardedEnvVars({ logger, containerEnvVars, forwardedFromHost });
|
|
43961
|
+
const envArgs = Object.entries(containerEnvVars).flatMap(([key, value]) => ["-e", `${key}=${value}`]);
|
|
43926
43962
|
const { stdout, stderr, exitCode } = await loggingExeca(logger, containerRunner, ["exec", "--user", "root", ...envArgs, containerId, ...command], {
|
|
43927
43963
|
reject: false,
|
|
43928
43964
|
all: true,
|