@fern-api/fern-api-dev 5.88.0 → 5.89.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/cli.cjs +101 -48
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -456741,10 +456741,10 @@ var init_heap_js_es5 = __esm({
|
|
|
456741
456741
|
};
|
|
456742
456742
|
HeapAsync2.prototype._applyLimit = function() {
|
|
456743
456743
|
if (this._limit && this._limit < this.heapArray.length) {
|
|
456744
|
-
var
|
|
456745
|
-
while (
|
|
456744
|
+
var rm22 = this.heapArray.length - this._limit;
|
|
456745
|
+
while (rm22) {
|
|
456746
456746
|
this.heapArray.pop();
|
|
456747
|
-
--
|
|
456747
|
+
--rm22;
|
|
456748
456748
|
}
|
|
456749
456749
|
}
|
|
456750
456750
|
};
|
|
@@ -457571,10 +457571,10 @@ var init_heap_js_es5 = __esm({
|
|
|
457571
457571
|
};
|
|
457572
457572
|
Heap2.prototype._applyLimit = function() {
|
|
457573
457573
|
if (this._limit > 0 && this._limit < this.heapArray.length) {
|
|
457574
|
-
var
|
|
457575
|
-
while (
|
|
457574
|
+
var rm22 = this.heapArray.length - this._limit;
|
|
457575
|
+
while (rm22) {
|
|
457576
457576
|
this.heapArray.pop();
|
|
457577
|
-
--
|
|
457577
|
+
--rm22;
|
|
457578
457578
|
}
|
|
457579
457579
|
}
|
|
457580
457580
|
};
|
|
@@ -694311,7 +694311,7 @@ var AccessTokenPosthogManager = class {
|
|
|
694311
694311
|
properties: {
|
|
694312
694312
|
...event,
|
|
694313
694313
|
...event.properties,
|
|
694314
|
-
version: "5.
|
|
694314
|
+
version: "5.89.1",
|
|
694315
694315
|
usingAccessToken: true,
|
|
694316
694316
|
...getRunIdProperties()
|
|
694317
694317
|
}
|
|
@@ -694377,7 +694377,7 @@ var UserPosthogManager = class {
|
|
|
694377
694377
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
694378
694378
|
event: "CLI",
|
|
694379
694379
|
properties: {
|
|
694380
|
-
version: "5.
|
|
694380
|
+
version: "5.89.1",
|
|
694381
694381
|
...event,
|
|
694382
694382
|
...event.properties,
|
|
694383
694383
|
usingAccessToken: false,
|
|
@@ -875507,7 +875507,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
875507
875507
|
var LOGS_FOLDER_NAME = "logs";
|
|
875508
875508
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
875509
875509
|
function getCliSource() {
|
|
875510
|
-
const version7 = "5.
|
|
875510
|
+
const version7 = "5.89.1";
|
|
875511
875511
|
return `cli@${version7}`;
|
|
875512
875512
|
}
|
|
875513
875513
|
var DebugLogger = class {
|
|
@@ -908217,7 +908217,7 @@ var LegacyDocsPublisher = class {
|
|
|
908217
908217
|
previewId,
|
|
908218
908218
|
disableTemplates: void 0,
|
|
908219
908219
|
skipUpload,
|
|
908220
|
-
cliVersion: "5.
|
|
908220
|
+
cliVersion: "5.89.1",
|
|
908221
908221
|
loginCommand: "fern auth login"
|
|
908222
908222
|
});
|
|
908223
908223
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -975092,7 +975092,7 @@ function getAutomationContextFromEnv() {
|
|
|
975092
975092
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
975093
975093
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
975094
975094
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
975095
|
-
cli_version: "5.
|
|
975095
|
+
cli_version: "5.89.1"
|
|
975096
975096
|
};
|
|
975097
975097
|
}
|
|
975098
975098
|
function isAutomationMode() {
|
|
@@ -975924,7 +975924,7 @@ var CliContext = class _CliContext {
|
|
|
975924
975924
|
if (false) {
|
|
975925
975925
|
this.logger.error("CLI_VERSION is not defined");
|
|
975926
975926
|
}
|
|
975927
|
-
return "5.
|
|
975927
|
+
return "5.89.1";
|
|
975928
975928
|
}
|
|
975929
975929
|
getCliName() {
|
|
975930
975930
|
if (false) {
|
|
@@ -977713,6 +977713,7 @@ init_lib6();
|
|
|
977713
977713
|
init_esm19();
|
|
977714
977714
|
|
|
977715
977715
|
// src/commands/generate/packLocalOutput.ts
|
|
977716
|
+
init_lib19();
|
|
977716
977717
|
init_lib4();
|
|
977717
977718
|
init_lib8();
|
|
977718
977719
|
init_lib33();
|
|
@@ -977734,7 +977735,8 @@ async function packLocalOutputForGroup({
|
|
|
977734
977735
|
group,
|
|
977735
977736
|
context: context3,
|
|
977736
977737
|
mode = "host",
|
|
977737
|
-
runner
|
|
977738
|
+
runner,
|
|
977739
|
+
packOnly = false
|
|
977738
977740
|
}) {
|
|
977739
977741
|
const failures = [];
|
|
977740
977742
|
for (const generator of group.generators) {
|
|
@@ -977751,7 +977753,22 @@ async function packLocalOutputForGroup({
|
|
|
977751
977753
|
continue;
|
|
977752
977754
|
}
|
|
977753
977755
|
try {
|
|
977754
|
-
await packOutputForLanguage({
|
|
977756
|
+
const artifactProduced = await packOutputForLanguage({
|
|
977757
|
+
language,
|
|
977758
|
+
outputPath,
|
|
977759
|
+
context: context3,
|
|
977760
|
+
mode,
|
|
977761
|
+
runner: runner ?? "docker"
|
|
977762
|
+
});
|
|
977763
|
+
if (packOnly) {
|
|
977764
|
+
if (artifactProduced) {
|
|
977765
|
+
await removeEverythingExceptDist({ outputPath, context: context3 });
|
|
977766
|
+
} else {
|
|
977767
|
+
context3.logger.warn(
|
|
977768
|
+
`Keeping generated source for ${generator.name}: no package artifact was produced, so there is nothing to keep in ${PACK_OUTPUT_DIRECTORY}/.`
|
|
977769
|
+
);
|
|
977770
|
+
}
|
|
977771
|
+
}
|
|
977755
977772
|
} catch (error50) {
|
|
977756
977773
|
const message = error50 instanceof Error ? error50.message : String(error50);
|
|
977757
977774
|
context3.logger.error(`Failed to package ${generator.name} output at ${outputPath}: ${message}`);
|
|
@@ -977784,13 +977801,13 @@ async function packOutputForLanguage({
|
|
|
977784
977801
|
commands.push(["npm", "pack", "--pack-destination", PACK_OUTPUT_DIRECTORY]);
|
|
977785
977802
|
await run(commands);
|
|
977786
977803
|
logArtifacts({ distDir, context: context3 });
|
|
977787
|
-
return;
|
|
977804
|
+
return true;
|
|
977788
977805
|
}
|
|
977789
977806
|
case "python": {
|
|
977790
977807
|
await (0, import_promises168.mkdir)(distDir, { recursive: true });
|
|
977791
977808
|
await run([["python3", "-m", "pip", "wheel", ".", "--no-deps", "--wheel-dir", PACK_OUTPUT_DIRECTORY]]);
|
|
977792
977809
|
logArtifacts({ distDir, context: context3 });
|
|
977793
|
-
return;
|
|
977810
|
+
return true;
|
|
977794
977811
|
}
|
|
977795
977812
|
case "java": {
|
|
977796
977813
|
await (0, import_promises168.mkdir)(distDir, { recursive: true });
|
|
@@ -977798,7 +977815,7 @@ async function packOutputForLanguage({
|
|
|
977798
977815
|
const libsDir = join8(outputPath, RelativeFilePath2.of("build/libs"));
|
|
977799
977816
|
await copyMatchingFiles({ fromDir: libsDir, toDir: distDir, extension: ".jar" });
|
|
977800
977817
|
logArtifacts({ distDir, context: context3 });
|
|
977801
|
-
return;
|
|
977818
|
+
return true;
|
|
977802
977819
|
}
|
|
977803
977820
|
case "csharp": {
|
|
977804
977821
|
await (0, import_promises168.mkdir)(distDir, { recursive: true });
|
|
@@ -977808,7 +977825,7 @@ async function packOutputForLanguage({
|
|
|
977808
977825
|
}
|
|
977809
977826
|
await run([["dotnet", "pack", csproj, "-c", "Release", "-o", PACK_OUTPUT_DIRECTORY]]);
|
|
977810
977827
|
logArtifacts({ distDir, context: context3 });
|
|
977811
|
-
return;
|
|
977828
|
+
return true;
|
|
977812
977829
|
}
|
|
977813
977830
|
case "ruby": {
|
|
977814
977831
|
await (0, import_promises168.mkdir)(distDir, { recursive: true });
|
|
@@ -977819,13 +977836,13 @@ async function packOutputForLanguage({
|
|
|
977819
977836
|
await run([["gem", "build", gemspec]]);
|
|
977820
977837
|
await moveMatchingFiles({ fromDir: outputPath, toDir: distDir, extension: ".gem" });
|
|
977821
977838
|
logArtifacts({ distDir, context: context3 });
|
|
977822
|
-
return;
|
|
977839
|
+
return true;
|
|
977823
977840
|
}
|
|
977824
977841
|
case "php": {
|
|
977825
977842
|
await (0, import_promises168.mkdir)(distDir, { recursive: true });
|
|
977826
977843
|
await run([["composer", "archive", "--format=zip", `--dir=${PACK_OUTPUT_DIRECTORY}`]]);
|
|
977827
977844
|
logArtifacts({ distDir, context: context3 });
|
|
977828
|
-
return;
|
|
977845
|
+
return true;
|
|
977829
977846
|
}
|
|
977830
977847
|
case "rust": {
|
|
977831
977848
|
await (0, import_promises168.mkdir)(distDir, { recursive: true });
|
|
@@ -977833,7 +977850,7 @@ async function packOutputForLanguage({
|
|
|
977833
977850
|
const packageDir = join8(outputPath, RelativeFilePath2.of("target/package"));
|
|
977834
977851
|
await copyMatchingFiles({ fromDir: packageDir, toDir: distDir, extension: ".crate" });
|
|
977835
977852
|
logArtifacts({ distDir, context: context3 });
|
|
977836
|
-
return;
|
|
977853
|
+
return true;
|
|
977837
977854
|
}
|
|
977838
977855
|
case "go": {
|
|
977839
977856
|
await (0, import_promises168.mkdir)(distDir, { recursive: true });
|
|
@@ -977843,13 +977860,13 @@ async function packOutputForLanguage({
|
|
|
977843
977860
|
zipPath: join8(distDir, RelativeFilePath2.of(zipName))
|
|
977844
977861
|
});
|
|
977845
977862
|
logArtifacts({ distDir, context: context3 });
|
|
977846
|
-
return;
|
|
977863
|
+
return true;
|
|
977847
977864
|
}
|
|
977848
977865
|
case "swift":
|
|
977849
977866
|
context3.logger.warn(
|
|
977850
977867
|
"Swift SDKs are distributed as source packages (Swift Package Manager), so there is no package artifact to build. Share the output directory itself, or reference it as a local package dependency."
|
|
977851
977868
|
);
|
|
977852
|
-
return;
|
|
977869
|
+
return false;
|
|
977853
977870
|
default:
|
|
977854
977871
|
assertNever(language);
|
|
977855
977872
|
}
|
|
@@ -977913,6 +977930,28 @@ async function zipDirectory({
|
|
|
977913
977930
|
zip.outputStream.pipe((0, import_fs41.createWriteStream)(zipPath)).on("close", resolve15).on("error", reject);
|
|
977914
977931
|
});
|
|
977915
977932
|
}
|
|
977933
|
+
async function removeEverythingExceptDist({
|
|
977934
|
+
outputPath,
|
|
977935
|
+
context: context3
|
|
977936
|
+
}) {
|
|
977937
|
+
const preserved = /* @__PURE__ */ new Set([PACK_OUTPUT_DIRECTORY, ".git"]);
|
|
977938
|
+
const fernignorePath = join8(outputPath, RelativeFilePath2.of(FERNIGNORE_FILENAME));
|
|
977939
|
+
if (await doesPathExist(fernignorePath)) {
|
|
977940
|
+
for (const ignorePath of await getFernIgnorePaths({ absolutePathToFernignore: fernignorePath })) {
|
|
977941
|
+
const topLevelSegment = ignorePath.split("/")[0];
|
|
977942
|
+
if (topLevelSegment != null && topLevelSegment.length > 0) {
|
|
977943
|
+
preserved.add(topLevelSegment);
|
|
977944
|
+
}
|
|
977945
|
+
}
|
|
977946
|
+
}
|
|
977947
|
+
for (const entry of await (0, import_promises168.readdir)(outputPath)) {
|
|
977948
|
+
if (preserved.has(entry)) {
|
|
977949
|
+
continue;
|
|
977950
|
+
}
|
|
977951
|
+
await (0, import_promises168.rm)(join8(outputPath, RelativeFilePath2.of(entry)), { recursive: true, force: true });
|
|
977952
|
+
}
|
|
977953
|
+
context3.logger.info(`Removed generated SDK source from ${outputPath}; kept ${[...preserved].join(", ")}.`);
|
|
977954
|
+
}
|
|
977916
977955
|
async function removeDistDirIfEmpty(outputPath) {
|
|
977917
977956
|
const distDir = join8(outputPath, RelativeFilePath2.of(PACK_OUTPUT_DIRECTORY));
|
|
977918
977957
|
try {
|
|
@@ -978098,7 +978137,8 @@ async function generateWorkspace({
|
|
|
978098
978137
|
generateTests,
|
|
978099
978138
|
automation,
|
|
978100
978139
|
pack,
|
|
978101
|
-
packMode
|
|
978140
|
+
packMode,
|
|
978141
|
+
packOnly
|
|
978102
978142
|
}) {
|
|
978103
978143
|
if (workspace.generatorsConfiguration == null) {
|
|
978104
978144
|
context3.logger.warn("This workspaces has no generators.yml");
|
|
@@ -978214,7 +978254,7 @@ async function generateWorkspace({
|
|
|
978214
978254
|
});
|
|
978215
978255
|
}
|
|
978216
978256
|
if (pack) {
|
|
978217
|
-
await packLocalOutputForGroup({ group, context: groupContext, mode: packMode, runner });
|
|
978257
|
+
await packLocalOutputForGroup({ group, context: groupContext, mode: packMode, runner, packOnly });
|
|
978218
978258
|
}
|
|
978219
978259
|
})
|
|
978220
978260
|
)
|
|
@@ -978593,7 +978633,8 @@ async function generateAPIWorkspaces({
|
|
|
978593
978633
|
generateTests,
|
|
978594
978634
|
automation,
|
|
978595
978635
|
pack,
|
|
978596
|
-
packMode
|
|
978636
|
+
packMode,
|
|
978637
|
+
packOnly
|
|
978597
978638
|
}) {
|
|
978598
978639
|
let token = void 0;
|
|
978599
978640
|
if (!useLocalDocker) {
|
|
@@ -978674,7 +978715,8 @@ async function generateAPIWorkspaces({
|
|
|
978674
978715
|
generateTests,
|
|
978675
978716
|
automation,
|
|
978676
978717
|
pack,
|
|
978677
|
-
packMode
|
|
978718
|
+
packMode,
|
|
978719
|
+
packOnly
|
|
978678
978720
|
});
|
|
978679
978721
|
});
|
|
978680
978722
|
})
|
|
@@ -985493,6 +985535,13 @@ Example: acme-preview-abc123.docs.buildwithfern.com`,
|
|
|
985493
985535
|
init_lib26();
|
|
985494
985536
|
init_lib6();
|
|
985495
985537
|
init_source();
|
|
985538
|
+
function toPreviewDeployments(urls) {
|
|
985539
|
+
return urls.map((item) => ({
|
|
985540
|
+
url: item.basePath != null ? `${item.domain}${item.basePath}` : item.domain,
|
|
985541
|
+
organizationId: item.organizationId,
|
|
985542
|
+
updatedAt: item.updatedAt
|
|
985543
|
+
}));
|
|
985544
|
+
}
|
|
985496
985545
|
async function listDocsPreview({
|
|
985497
985546
|
cliContext,
|
|
985498
985547
|
limit,
|
|
@@ -985537,12 +985586,7 @@ async function listDocsPreview({
|
|
|
985537
985586
|
}
|
|
985538
985587
|
}
|
|
985539
985588
|
}
|
|
985540
|
-
const
|
|
985541
|
-
const previewDeployments = listResponse.urls.filter((item) => previewUrlPattern.test(item.domain)).map((item) => ({
|
|
985542
|
-
url: item.basePath != null ? `${item.domain}${item.basePath}` : item.domain,
|
|
985543
|
-
organizationId: item.organizationId,
|
|
985544
|
-
updatedAt: item.updatedAt
|
|
985545
|
-
}));
|
|
985589
|
+
const previewDeployments = toPreviewDeployments(listResponse.urls);
|
|
985546
985590
|
if (previewDeployments.length === 0) {
|
|
985547
985591
|
context3.logger.info("No preview deployments found.");
|
|
985548
985592
|
return;
|
|
@@ -992662,14 +992706,18 @@ function addGenerateCommand3(cli, cliContext) {
|
|
|
992662
992706
|
boolean: true,
|
|
992663
992707
|
default: false,
|
|
992664
992708
|
description: "Generate test files even when generating to a local file system (tests are normally only generated for GitHub output modes)"
|
|
992665
|
-
}).option("
|
|
992709
|
+
}).option("package", {
|
|
992666
992710
|
boolean: true,
|
|
992667
992711
|
default: false,
|
|
992668
992712
|
description: "After generating to the local file system, build distributable package artifacts (npm tarball, wheel, JAR, NuGet package, gem, etc.) into a fern-dist/ folder inside the output directory."
|
|
992669
|
-
}).option("
|
|
992713
|
+
}).option("package-mode", {
|
|
992670
992714
|
choices: ["host", "docker"],
|
|
992671
992715
|
default: "host",
|
|
992672
|
-
description: "Where --
|
|
992716
|
+
description: "Where --package runs the packaging toolchain: 'host' uses toolchains installed on this machine; 'docker' runs each toolchain inside an official Docker image (node, python, gradle, dotnet/sdk, ruby, composer, rust) with the output directory mounted, so no local toolchains are needed."
|
|
992717
|
+
}).option("package-only", {
|
|
992718
|
+
boolean: true,
|
|
992719
|
+
default: false,
|
|
992720
|
+
description: "Like --package, but only the fern-dist/ artifact is kept in the output directory \u2014 the generated SDK source is removed after the package is built."
|
|
992673
992721
|
}),
|
|
992674
992722
|
async (argv) => {
|
|
992675
992723
|
if (argv.api != null && argv.api.length > 0 && argv.docs != null) {
|
|
@@ -992745,22 +992793,25 @@ function addGenerateCommand3(cli, cliContext) {
|
|
|
992745
992793
|
{ code: CliError.Code.ConfigError }
|
|
992746
992794
|
);
|
|
992747
992795
|
}
|
|
992748
|
-
|
|
992749
|
-
|
|
992796
|
+
const shouldPackage = argv.package || argv.packageOnly;
|
|
992797
|
+
if (shouldPackage && argv.preview) {
|
|
992798
|
+
return cliContext.failWithoutThrowing("The --package flag cannot be used with --preview.", void 0, {
|
|
992750
992799
|
code: CliError.Code.ConfigError
|
|
992751
992800
|
});
|
|
992752
992801
|
}
|
|
992753
|
-
if (
|
|
992802
|
+
if (shouldPackage && argv.docs != null) {
|
|
992754
992803
|
return cliContext.failWithoutThrowing(
|
|
992755
|
-
"The --
|
|
992804
|
+
"The --package flag can only be used for API generation, not docs generation.",
|
|
992756
992805
|
void 0,
|
|
992757
992806
|
{ code: CliError.Code.ConfigError }
|
|
992758
992807
|
);
|
|
992759
992808
|
}
|
|
992760
|
-
if (argv.
|
|
992761
|
-
return cliContext.failWithoutThrowing(
|
|
992762
|
-
|
|
992763
|
-
|
|
992809
|
+
if (argv.packageMode !== "host" && !shouldPackage) {
|
|
992810
|
+
return cliContext.failWithoutThrowing(
|
|
992811
|
+
"The --package-mode flag can only be used with --package.",
|
|
992812
|
+
void 0,
|
|
992813
|
+
{ code: CliError.Code.ConfigError }
|
|
992814
|
+
);
|
|
992764
992815
|
}
|
|
992765
992816
|
if (argv.output != null && argv.docs != null) {
|
|
992766
992817
|
return cliContext.failWithoutThrowing(
|
|
@@ -992801,8 +992852,9 @@ function addGenerateCommand3(cli, cliContext) {
|
|
|
992801
992852
|
requireEnvVars: argv["require-env-vars"],
|
|
992802
992853
|
skipIfNoDiff: argv["skip-if-no-diff"],
|
|
992803
992854
|
generateTests: argv["generate-tests"],
|
|
992804
|
-
pack:
|
|
992805
|
-
packMode: argv.
|
|
992855
|
+
pack: shouldPackage,
|
|
992856
|
+
packMode: argv.packageMode,
|
|
992857
|
+
packOnly: argv.packageOnly
|
|
992806
992858
|
});
|
|
992807
992859
|
}
|
|
992808
992860
|
if (argv.docs != null) {
|
|
@@ -992865,8 +992917,9 @@ function addGenerateCommand3(cli, cliContext) {
|
|
|
992865
992917
|
requireEnvVars: argv["require-env-vars"],
|
|
992866
992918
|
skipIfNoDiff: argv["skip-if-no-diff"],
|
|
992867
992919
|
generateTests: argv["generate-tests"],
|
|
992868
|
-
pack:
|
|
992869
|
-
packMode: argv.
|
|
992920
|
+
pack: shouldPackage,
|
|
992921
|
+
packMode: argv.packageMode,
|
|
992922
|
+
packOnly: argv.packageOnly
|
|
992870
992923
|
});
|
|
992871
992924
|
}
|
|
992872
992925
|
);
|
package/package.json
CHANGED